glab icon indicating copy to clipboard operation
glab copied to clipboard

Update/create workflow using files

Open tcpaiva opened this issue 4 years ago • 4 comments

I was wondering if there is a way to deal with issues in a file-like approach. For example

$ glab issue view 123 >> tmp.md
$ xdg-open tmp.md
$ glab issue update 123 --file tmp.md

That is, download the issue to a temporary file, edit as needed, update isse using the modified file.

This would be handy also to clone issues or to use an issue as a template:

$ glab issue create --file tmp.md

I know the --file option is not available, but I would be looking for something similar to that. Markdown is just a suggestion, no strong opinions about the format.

PS: thanks for this useful tool!

tcpaiva avatar Jun 01 '21 20:06 tcpaiva

From what I understand, there is no way for example to get only the description of an issue, right?

tcpaiva avatar Jun 01 '21 20:06 tcpaiva

@tcpaiva thanks for opening this issue... GLab currently does not support creating issues or merge requests using file templates. I think this will be a great add for glab. I will add this to our backlog for consideration. It is however open if anyone would like to work on it.

From what I understand, there is no way for example to get only the description of an issue, right?

You can easily write scripts to get only the description. glab provides the api command to make it easy interact with the GitLab api. You can use the api command command to get the description and use jq to get the description like:

glab api /projects/:id/issues/<issue-id> | jq -r '.description'

Here is an example:

glab api /projects/:id/issues/278 | jq -r '.description'

You can set up an alias and create a custom command for this:

$ glab alias set issue-desc 'glab api /projects/:id/issues/"$1" | jq -r ".description"' --shell  

# and now you can simply do:
$ glab issue-desc 278

profclems avatar Jun 07 '21 01:06 profclems

This issue has been automatically marked as stale because it has not had recent activity. We haven't had the time to address it yet, but we want to keep it open. This message is just a reminder for us to help triage issues.

clemsbot avatar Jul 07 '21 02:07 clemsbot

This issue has been automatically marked as stale because it has not had recent activity. We haven't had the time to address it yet, but we want to keep it open. This message is just a reminder for us to help triage issues.

clemsbot avatar Nov 06 '21 02:11 clemsbot