Skip to content

Commit

Permalink
feat(issue, pr): increase labels limit in keybinds
Browse files Browse the repository at this point in the history
Override `$GH_FZF_DEFAULT_LIMIT` in the keybindings for adding/removing
labels to pull requests and issues.
  • Loading branch information
benelan committed Apr 9, 2024
1 parent 3d66476 commit 1b81c6f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions gh-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ Filters > (alt-a: assignee) (alt-A: author) (alt-m: mention) (alt-s: state=all)
'

# increase the limit when showing labels
[ "$GH_FZF_DEFAULT_LIMIT" -lt 420 ] && label_limit="-L 420"

FZF_DEFAULT_COMMAND="GH_FORCE_TTY=$gh_columns gh issue list $issue_template -L $GH_FZF_DEFAULT_LIMIT $*" \
fzf \
--preview='GH_FORCE_TTY=$FZF_PREVIEW_COLUMNS gh issue view {1} --comments '"$repo_flag" \
Expand All @@ -197,10 +200,10 @@ Filters > (alt-a: assignee) (alt-A: author) (alt-m: mention) (alt-s: state=all)
--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"'
gh issue edit --add-label "$(gh fzf label '"$label_limit"')" {1} '"$repo_flag"'
)' \
--bind='alt-L:execute(
gh issue edit --remove-label "$(gh fzf label)" {1} '"$repo_flag"'
gh issue edit --remove-label "$(gh fzf label '"$label_limit"')" {1} '"$repo_flag"'
)' \
--bind="alt-O:execute(gh issue reopen {1} $repo_flag)" \
--bind="alt-X:execute(gh issue close {1} $repo_flag)" \
Expand Down Expand Up @@ -258,6 +261,8 @@ pr_cmd() {
Filters > (alt-a: assignee) (alt-A: author) (alt-b: branch) (alt-s: state=all)
'
# increase the limit when showing labels
[ "$GH_FZF_DEFAULT_LIMIT" -lt 420 ] && label_limit="-L 420"

FZF_DEFAULT_COMMAND="GH_FORCE_TTY=$gh_columns gh pr list $pr_template -L $GH_FZF_DEFAULT_LIMIT $*" \
fzf \
Expand All @@ -274,10 +279,10 @@ Filters > (alt-a: assignee) (alt-A: author) (alt-b: branch) (alt-s: state=all)
--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"'
gh issue edit --add-label "$(gh fzf label '"$label_limit"')" {1} '"$repo_flag"'
)' \
--bind='alt-L:execute(
gh issue edit --remove-label "$(gh fzf label)" {1} '"$repo_flag"'
gh issue edit --remove-label "$(gh fzf label '"$label_limit"')" {1} '"$repo_flag"'
)' \
--bind='alt-C:execute<gh fzf run -b $(
gh pr view {1} --json headRefName --jq .headRefName '"$repo_flag"'
Expand Down

0 comments on commit 1b81c6f

Please sign in to comment.