Skip to content

Commit

Permalink
feat(issue, pr): keybindings to add/remove label
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan committed Mar 7, 2024
1 parent a6b088b commit fea7b42
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ that can be used with any `gh fzf` command:
- `alt-c`: Add a comment to the selected issue
(see `gh issue comment --help`)
- `alt-X`: Close the issue
- `alt-l`: Open `gh fzf label` and add the label to the selected issue
(see `gh issue edit --help`)
- `alt-L`: Open `gh fzf label` and remove the label from the selected issue
(see `gh issue edit --help`)
(see `gh issue close --help`)
- `alt-O`: Reopen the issue
(see `gh issue reopen --help`)
Expand Down Expand Up @@ -130,6 +134,10 @@ that can be used with any `gh fzf` command:
- `alt-r`: Start/continue/finish a review for the pull request
(see `gh pr review --help`)
- `alt-R`: Mark a draft pull request as "ready for review"
- `alt-l`: Open `gh fzf label` and add the label to the selected pull request
(see `gh issue edit --help`)
- `alt-L`: Open `gh fzf label` and remove the label from the selected pull
request (see `gh issue edit --help`)
(see `gh pr ready --help`)
- `alt-M`: Merge the pull request
(see `gh pr merge --help`)
Expand Down
16 changes: 14 additions & 2 deletions gh-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ issue_cmd() {
{{- end -}}
'\'''

issue_header='Actions > (enter: edit) (alt-o: checkout) (alt-c: comment) (alt-X: close) (alt-O: reopen)
issue_header='Actions > (enter: edit) (alt-o: checkout) (alt-c: comment) (alt-X: close) (alt-O: reopen) (alt-l: add label) (alt-L: remove label)
> (ctrl-o: open url) (ctrl-y: copy url) (ctrl-r: reload)
Filters > (alt-a: assignee) (alt-A: author) (alt-m: mention) (alt-s: state=all)
Expand All @@ -196,6 +196,12 @@ Filters > (alt-a: assignee) (alt-A: author) (alt-m: mention) (alt-s: state=all)
--bind="enter:execute(gh issue edit {1} $repo_flag)" \
--bind="alt-o:execute(gh issue develop --checkout {1} $repo_flag)+abort" \
--bind="alt-c:execute(gh issue comment {1} $repo_flag)" \
--bind='alt-l:execute(
gh issue edit --add-label "$(gh fzf label)" {1} '"$repo_flag"'
)' \
--bind='alt-L:execute(
gh issue edit --remove-label "$(gh fzf label)" {1} '"$repo_flag"'
)' \
--bind="alt-O:execute(gh issue reopen {1} $repo_flag)" \
--bind="alt-X:execute(gh issue close {1} $repo_flag)" \
--bind='alt-a:reload(eval "$FZF_DEFAULT_COMMAND --assignee @me")' \
Expand Down Expand Up @@ -246,7 +252,7 @@ pr_cmd() {
{{- end -}}
'\'''

pr_header='Actions > (enter: edit) (alt-o: checkout) (alt-d: diff) (alt-c: comment) (alt-r: review)
pr_header='Actions > (enter: edit) (alt-o: checkout) (alt-d: diff) (alt-c: comment) (alt-r: review) (alt-l: add label) (alt-L: remove label)
> (alt-C: checks) (alt-M: merge) (alt-X: close) (alt-O: reopen) (alt-R: ready)
> (ctrl-o: open url) (ctrl-y: copy url) (ctrl-r: reload)
Filters > (alt-a: assignee) (alt-A: author) (alt-b: branch) (alt-s: state=all)
Expand All @@ -267,6 +273,12 @@ Filters > (alt-a: assignee) (alt-A: author) (alt-b: branch) (alt-s: state=all)
--bind="alt-d:execute(gh pr diff {1} $repo_flag)" \
--bind="alt-o:execute(gh pr checkout {1} $repo_flag)" \
--bind="alt-r:execute(gh pr review {1} $repo_flag)" \
--bind='alt-l:execute(
gh issue edit --add-label "$(gh fzf label)" {1} '"$repo_flag"'
)' \
--bind='alt-L:execute(
gh issue edit --remove-label "$(gh fzf label)" {1} '"$repo_flag"'
)' \
--bind='alt-C:execute<gh fzf run -b $(
gh pr view {1} --json headRefName --jq .headRefName '"$repo_flag"'
) '"$repo_flag"'>' \
Expand Down

0 comments on commit fea7b42

Please sign in to comment.