Skip to content

Commit

Permalink
chore: cleanup examples and variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan committed Feb 5, 2024
1 parent e3fdcd6 commit 5d32c57
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 25 deletions.
12 changes: 2 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ You can set the [`FZF_DEFAULT_OPTS`](https://github.com/junegunn/fzf/blob/master
environment variable to add/change `fzf` options used by `gh-fzf` commands.
For example, create aliases in the `gh` config file that add new keybindings to
the issue command for assigning and un-assigning yourself:
the issue and pr commands:
```yml
# ~/.config/gh/config.yml
Expand All @@ -205,17 +205,9 @@ aliases:
--bind='alt-+:execute(gh issue edit --add-assignee @me {1})'
--bind='alt--:execute(gh issue edit --remove-assignee @me {1})'
" gh fzf issue
```
Or change the default keybinding for merging pull requests to delete the branch
afterward:
```yml
# ~/.config/gh/config.yml
aliases:
p: |
!FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS
--bind='alt-M:execute(gh pr merge --delete-branch {1})'
--bind='alt-m:execute(gh pr merge --delete-branch --squash {1})'
" gh fzf pr
```
Expand Down
30 changes: 15 additions & 15 deletions gh-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ if [ -z "$GH_FZF_COPY_CMD" ]; then
fi

if [ -n "$GH_FZF_HIDE_HINTS" ]; then
_start="toggle-header"
on_start="toggle-header"
else
_start=""
on_start=""
fi

if [ -n "$GH_FZF_TRUNCATE_FIELDS" ]; then
_columns='100%'
gh_columns='100%'
else
_columns='9999999'
gh_columns='9999999'
fi

# The following fzf options are shared by all commands. They are prepended to
Expand Down Expand Up @@ -125,9 +125,9 @@ FZF_DEFAULT_OPTS='
# --------------------------------------------------------------------- {|}

default_cmd() {
FZF_DEFAULT_COMMAND="printf 'COMMAND\nissue\npr\nrun\n'" \
FZF_DEFAULT_COMMAND="printf 'COMMAND\n%s\n%s\n%s\n' 'issue' 'pr' 'run'" \
fzf \
--preview='GH_FORCE_TTY=$FZF_PREVIEW_COLUMNS gh {} --help' \
--preview='GH_FORCE_TTY=$FZF_PREVIEW_COLUMNS gh help {}' \
--preview-window='right:75%,wrap' \
--bind="enter:execute(gh fzf {})"
}
Expand Down Expand Up @@ -178,11 +178,11 @@ Filters > (alt-a: assignee) (alt-A: author) (alt-m: mention) (alt-s: state=all)
'

FZF_DEFAULT_COMMAND="GH_FORCE_TTY=$_columns gh issue list $issue_template -L $GH_FZF_DEFAULT_LIMIT $*" \
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' \
--preview='GH_FORCE_TTY=$FZF_PREVIEW_COLUMNS gh issue view {1} --comments' \
--header="$issue_header" \
--bind="start:$_start" \
--bind="start:$on_start" \
--bind='ctrl-o:execute-silent(gh issue view --web {1})' \
--bind="ctrl-y:execute-silent(gh issue view {1} --json 'url' -q '.url' | $GH_FZF_COPY_CMD)" \
--bind='enter:execute(gh issue edit {1})' \
Expand Down Expand Up @@ -245,11 +245,11 @@ Filters > (alt-a: assignee) (alt-A: author) (alt-b: branch) (alt-s: state=all)
'

FZF_DEFAULT_COMMAND="GH_FORCE_TTY=$_columns gh pr list $pr_template -L $GH_FZF_DEFAULT_LIMIT $*" \
FZF_DEFAULT_COMMAND="GH_FORCE_TTY=$gh_columns gh pr list $pr_template -L $GH_FZF_DEFAULT_LIMIT $*" \
fzf \
--preview 'GH_FORCE_TTY=$FZF_PREVIEW_COLUMNS gh pr view {1} --comments' \
--preview='GH_FORCE_TTY=$FZF_PREVIEW_COLUMNS gh pr view {1} --comments' \
--header="$pr_header" \
--bind="start:$_start" \
--bind="start:$on_start" \
--bind='ctrl-o:execute-silent(gh pr view --web {1})' \
--bind="ctrl-y:execute-silent(gh pr view {1} --json 'url' -q '.url' | $GH_FZF_COPY_CMD)" \
--bind='enter:execute(gh pr edit {1})' \
Expand Down Expand Up @@ -326,11 +326,11 @@ Filters > (alt-f: failed runs) (alt-b: current branch) (alt-u: current user)
'

FZF_DEFAULT_COMMAND="GH_FORCE_TTY=$_columns gh run list $run_template -L $GH_FZF_DEFAULT_LIMIT $*" \
FZF_DEFAULT_COMMAND="GH_FORCE_TTY=$gh_columns gh run list $run_template -L $GH_FZF_DEFAULT_LIMIT $*" \
fzf \
--preview 'GH_FORCE_TTY=$FZF_PREVIEW_COLUMNS gh run view {-1}' \
--preview='GH_FORCE_TTY=$FZF_PREVIEW_COLUMNS gh run view {-1}' \
--header="$run_header" \
--bind="start:$_start" \
--bind="start:$on_start" \
--bind='ctrl-o:execute-silent(gh run view --web {-1})' \
--bind="ctrl-y:execute-silent(gh run view {-1} --json 'url' -q '.url' | $GH_FZF_COPY_CMD)" \
--bind='enter:execute(gh run watch {-1})' \
Expand Down

0 comments on commit 5d32c57

Please sign in to comment.