Skip to content

Commit

Permalink
update completions
Browse files Browse the repository at this point in the history
  • Loading branch information
threadexio committed May 15, 2022
1 parent 129681e commit 498157d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
19 changes: 18 additions & 1 deletion completions/zeus.bash
Expand Up @@ -24,6 +24,9 @@ _zeus() {
query)
cmd+="__query"
;;
remove)
cmd+="__remove"
;;
sync)
cmd+="__sync"
;;
Expand All @@ -34,7 +37,7 @@ _zeus() {

case "${cmd}" in
zeus)
opts="-h -V -v --help --version --color --verbose --force --builddir --aur sync build query misc help"
opts="-h -V -v --help --version --color --verbose --force --builddir --aur sync remove build query misc help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
Expand Down Expand Up @@ -143,6 +146,20 @@ _zeus() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zeus__remove)
opts="-h --help <packages>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zeus__sync)
opts="-u -h --upgrade --buildargs --image --name --help <packages>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
Expand Down
2 changes: 2 additions & 0 deletions completions/zeus.fish
Expand Up @@ -6,6 +6,7 @@ complete -c zeus -n "__fish_use_subcommand" -s V -l version -d 'Print version in
complete -c zeus -n "__fish_use_subcommand" -s v -l verbose -d 'Be verbose'
complete -c zeus -n "__fish_use_subcommand" -l force -d 'Ignore all warnings'
complete -c zeus -n "__fish_use_subcommand" -f -a "sync" -d 'Sync packages'
complete -c zeus -n "__fish_use_subcommand" -f -a "remove" -d 'Remove packages'
complete -c zeus -n "__fish_use_subcommand" -f -a "build" -d 'Build/Update builder image'
complete -c zeus -n "__fish_use_subcommand" -f -a "query" -d 'Query the AUR'
complete -c zeus -n "__fish_use_subcommand" -f -a "misc" -d 'Generate shell completions & others'
Expand All @@ -15,6 +16,7 @@ complete -c zeus -n "__fish_seen_subcommand_from sync" -l image -d 'Builder imag
complete -c zeus -n "__fish_seen_subcommand_from sync" -l name -d 'Builder container name' -r
complete -c zeus -n "__fish_seen_subcommand_from sync" -s u -l upgrade -d 'Upgrade packages'
complete -c zeus -n "__fish_seen_subcommand_from sync" -s h -l help -d 'Print help information'
complete -c zeus -n "__fish_seen_subcommand_from remove" -s h -l help -d 'Print help information'
complete -c zeus -n "__fish_seen_subcommand_from build" -l archive -d 'Builder image archive' -r
complete -c zeus -n "__fish_seen_subcommand_from build" -l dockerfile -d 'Builder image dockerfile in archive' -r
complete -c zeus -n "__fish_seen_subcommand_from build" -l image -d 'Builder image name' -r
Expand Down
15 changes: 14 additions & 1 deletion completions/zeus.zsh
Expand Up @@ -43,7 +43,14 @@ _arguments "${_arguments_options[@]}" \
'--upgrade[Upgrade packages]' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::packages -- Package names:' \
'*::packages -- Packages to sync:' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'*::packages -- Packages to remove:' \
&& ret=0
;;
(build)
Expand Down Expand Up @@ -88,6 +95,7 @@ esac
_zeus_commands() {
local commands; commands=(
'sync:Sync packages' \
'remove:Remove packages' \
'build:Build/Update builder image' \
'query:Query the AUR' \
'misc:Generate shell completions & others' \
Expand Down Expand Up @@ -115,6 +123,11 @@ _zeus__query_commands() {
local commands; commands=()
_describe -t commands 'zeus query commands' commands "$@"
}
(( $+functions[_zeus__remove_commands] )) ||
_zeus__remove_commands() {
local commands; commands=()
_describe -t commands 'zeus remove commands' commands "$@"
}
(( $+functions[_zeus__sync_commands] )) ||
_zeus__sync_commands() {
local commands; commands=()
Expand Down

0 comments on commit 498157d

Please sign in to comment.