Complete -f for -G and --print -> --show

This commit is contained in:
morganamilo 2018-08-30 16:07:45 +01:00
parent 29642d181f
commit 0657f7e23f
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
3 changed files with 27 additions and 13 deletions

View file

@ -48,7 +48,7 @@ _pacman_repo_list() {
_yay() {
local common core cur database files prev query remove sync upgrade o
local yays show
local yays show getpkgbuild
COMPREPLY=()
_get_comp_words_by_ref cur prev
database=('asdeps asexplicit')
@ -75,9 +75,10 @@ _yay() {
##yay stuff
yays=('clean gendb' 'c')
print=('complete defaultconfig currentconfig stats news' 'c d g s w')
show=('complete defaultconfig currentconfig stats news' 'c d g s w')
getpkgbuild=('force' 'f')
for o in 'D database' 'F files' 'Q query' 'R remove' 'S sync' 'U upgrade' 'Y yays' 'P show'; do
for o in 'D database' 'F files' 'Q query' 'R remove' 'S sync' 'U upgrade' 'Y yays' 'P show' 'G getpkgbuild'; do
_arch_incomp "$o" && break
done

View file

@ -15,7 +15,7 @@ set -l listpacman "(__fish_print_packages)"
set -l noopt 'not __fish_contains_opt -s Y -s G -s V -s P -s S -s D -s Q -s R -s U -s T -s F database query sync remove upgrade deptest files'
set -l database '__fish_contains_opt -s D database'
set -l getpkgbuild '__fish_contains_opt -s G getpkgbuild'
set -l print '__fish_contains_opt -s P print'
set -l show '__fish_contains_opt -s P show'
set -l query '__fish_contains_opt -s Q query'
set -l remove '__fish_contains_opt -s R remove'
set -l sync '__fish_contains_opt -s S sync'
@ -31,7 +31,7 @@ set -l yayspecific '__fish_contains_opt -s Y yay'
complete -c $progname -s D -f -l database -n $noopt -d 'Modify the package database'
complete -c $progname -s F -f -l files -n $noopt -d 'Query the files database'
complete -c $progname -s G -f -l getpkgbuild -n $noopt -d 'Get PKGBUILD from ABS or AUR'
complete -c $progname -s P -f -l print -n $noopt -d 'Print information'
complete -c $progname -s P -f -l show -n $noopt -d 'Print information'
complete -c $progname -s Q -f -l query -n $noopt -d 'Query the package database'
complete -c $progname -s R -f -l remove -n $noopt -d 'Remove packages from the system'
complete -c $progname -s S -f -l sync -n $noopt -d 'Synchronize packages'
@ -134,13 +134,16 @@ complete -c $progname -n "not $noopt" -l completioninterval -d 'Refresh interval
complete -c $progname -n $yayspecific -s c -l clean -d 'Remove unneeded dependencies' -f
complete -c $progname -n $yayspecific -l gendb -d 'Generate development package DB' -f
# Print options
complete -c $progname -n $print -s d -l defaultconfig -d 'Print current yay configuration' -f
complete -c $progname -n $print -s n -l numberupgrades -d 'Print number of updates' -f
complete -c $progname -n $print -s s -l stats -d 'Display system package statistics' -f
complete -c $progname -n $print -s u -l upgrades -d 'Print update list' -f
complete -c $progname -n $print -s w -l news -d 'Print arch news'
complete -c $progname -n $print -s q -l quiet -d 'Do not print news description'
# Show options
complete -c $progname -n $show -s d -l defaultconfig -d 'Print current yay configuration' -f
complete -c $progname -n $show -s n -l numberupgrades -d 'Print number of updates' -f
complete -c $progname -n $show -s s -l stats -d 'Display system package statistics' -f
complete -c $progname -n $show -s u -l upgrades -d 'Print update list' -f
complete -c $progname -n $show -s w -l news -d 'Print arch news'
complete -c $progname -n $show -s q -l quiet -d 'Do not print news description'
# Getpkgbuild options
complete -c $progname -n $getpkgbuild -s f -l force -d 'Force download for existing tar packages' -f
# Transaction options (sync, remove, upgrade)
for condition in sync remove upgrade

View file

@ -11,7 +11,7 @@ _pacman_opts_commands=(
{-G,--getpkgbuild}'[Get PKGBUILD from ABS or AUR]'
{-Q,--query}'[Query the package database]'
{-R,--remove}'[Remove a package from the system]'
{-P,--print}'[Print yay information]'
{-P,--show}'[Print yay information]'
{-S,--sync}'[Synchronize packages]'
{-T,--deptest}'[Check if dependencies are installed]'
{-U,--upgrade}'[Upgrade a package]'
@ -152,6 +152,11 @@ _pacman_opts_yay_modifiers=(
'--gendb[Generates development package DB used for updating]'
)
# -G
_pacman_opts_getpkgbuild_modifiers=(
{-f,--force}'[Force download for existing tar packages]'
)
# -P
_pacman_opts_print_modifiers=(
{-c,--complete}'[Used for completions]'
@ -548,6 +553,11 @@ _pacman_zsh_comp() {
_arguments -s : \
"$_pacman_opts_yay_modifiers[@]"
;;
G*)
_arguments -s : \
"$_pacman_opts_getpkgbuild_modifiers[@]"
;;
*)
case ${(M)words:#--*} in