Skip to content

Commit

Permalink
added function envs to show git config list
Browse files Browse the repository at this point in the history
  • Loading branch information
Gennaro Tedesco committed Aug 19, 2022
1 parent 17334f5 commit 927c6fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ takes one of the following arguments or flags
| -s,search | search issues in any repository | interactive prompt: follow instructions
| -m,myissue | search issues you opened somewhere | interactive prompt: follow instructions
| -k,pick | cherrypick files between branches | enter: checkout cherrypicked files from branch
| -e,envs | show git config list | enter: print selected config variable
| -h,help | show help page |
| -V,version | print the current version |

Expand Down
15 changes: 15 additions & 0 deletions gh-f
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ COMMANDS
-s|search: search issues in any repository
-m|myissue: search issues you opened somewhere
-k|pick: cherrypick files from one branch to the other
-e|envs: show git config list
-h|help: show this help message
-V|version: show the current version
Expand Down Expand Up @@ -86,6 +87,11 @@ USAGE
multi-file selection with tab
enter: confirm branch and pick files
gh f -e | gh f envs
show git config --list of environment variables
for the current git project
CUSTOMISATION
The prompt colours are defined via their ANSI sequences: if you like different ones you
Expand Down Expand Up @@ -333,6 +339,11 @@ pick() {
[[ -n ${files} ]] && git restore --source "${from_branch}" ${files}
}

envs() {
config_var=$(git config --list | cut -d= -f1 | fzf -d' ' --prompt 'config list:' --preview='git config {}')
[[ -n "$config_var" ]] && git config "$config_var"
}

# print help page
[[ "$#" -eq 0 ]] && help

Expand Down Expand Up @@ -384,6 +395,10 @@ while [[ "$#" -gt 0 ]]; do
pick
shift
;;
-e | envs)
envs
shift
;;
-V | version)
echo "$VERSION"
shift
Expand Down

0 comments on commit 927c6fa

Please sign in to comment.