Merge pull request #390 from Okabe-Junya/rm-completion

feat(misc): support "ghq rm" completion
This commit is contained in:
Masayuki Matsuki 2024-07-12 09:40:05 +09:00 committed by GitHub
commit 9bb6aaa9c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -4,13 +4,15 @@ function _ghq () {
case $cword in
1)
COMPREPLY=( $(compgen -W "get list" -- $cur) );;
COMPREPLY=( $(compgen -W "get list rm" -- $cur) );;
2)
case $prev in
get)
COMPREPLY=( $(compgen -W "$(ghq list --unique)" -- $cur) );;
list)
COMPREPLY=( $(compgen -W "$(ghq list)" -- $cur) );;
rm)
COMPREPLY=( $(compgen -W "$(ghq list)" -- $cur) );;
esac;;
*)
COMPREPLY=( $(compgen -W "$(ls)" -- $cur) );;

View file

@ -51,6 +51,12 @@ function _ghq () {
'(-)*:: :->null_state' \
&& ret=0
;;
(rm)
_arguments -C \
'--dry-run[Do not remove actually]' \
'(-)*:: :->null_state' \
&& ret=0
;;
(help|h)
__ghq_commands && ret=0
;;