From fd9e2638f94ae0fa916499c0928afbdfda2755cd Mon Sep 17 00:00:00 2001 From: jguer Date: Sun, 31 Jan 2021 19:06:32 +0100 Subject: [PATCH] fix(yay): fix completions of -Gp --- cmd.go | 10 +++++----- completions/bash | 5 +---- completions/fish | 2 +- completions/zsh | 7 +------ doc/yay.8 | 8 ++++---- 5 files changed, 12 insertions(+), 20 deletions(-) diff --git a/cmd.go b/cmd.go index 0a51d557..588cffbc 100644 --- a/cmd.go +++ b/cmd.go @@ -38,8 +38,8 @@ operations: New operations: yay {-Y --yay} [options] [package(s)] - yay {-P --show} [options] [package(s)] - yay {-G --getpkgbuild} [package(s)] + yay {-P --show} [options] + yay {-G --getpkgbuild} [options] [package(s)] If no arguments are provided 'yay -Syu' will be performed If no operation is provided -Y will be assumed @@ -131,14 +131,14 @@ show specific options: -g --currentconfig Print current yay configuration -s --stats Display system package statistics -w --news Print arch news - -p --pkgbuild Print pkgbuild of packages yay specific options: -c --clean Remove unneeded dependencies --gendb Generates development package DB used for updating getpkgbuild specific options: - -f --force Force download for existing ABS packages`) + -f --force Force download for existing ABS packages + -p --print Print pkgbuild of packages`) } func handleCmd(cmdArgs *settings.Arguments, dbExecutor db.Executor) error { @@ -240,7 +240,7 @@ func handleYay(cmdArgs *settings.Arguments, dbExecutor db.Executor) error { } func handleGetpkgbuild(cmdArgs *settings.Arguments, dbExecutor db.Executor) error { - if cmdArgs.ExistsArg("p", "pkgbuild") { + if cmdArgs.ExistsArg("p", "print") { return printPkgbuilds(dbExecutor, config.Runtime.HTTPClient, cmdArgs.Targets) } return getPkgbuilds(cmdArgs.Targets, dbExecutor, cmdArgs.ExistsArg("f", "force")) diff --git a/completions/bash b/completions/bash index 8baeb409..ee41e4f7 100644 --- a/completions/bash +++ b/completions/bash @@ -80,7 +80,7 @@ _yay() { 'b d h q r v') yays=('clean gendb' 'c') show=('complete defaultconfig currentconfig stats news' 'c d g s w') - getpkgbuild=('force pkgbuild' 'f p') + getpkgbuild=('force print' 'f p') 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 @@ -119,9 +119,6 @@ _yay() { G) _yay_pkg ;; - P) - _arch_incomp 'p pkgbuild' && _yay_pkg - ;; esac fi true diff --git a/completions/fish b/completions/fish index 2b1bac55..e3c7eac9 100644 --- a/completions/fish +++ b/completions/fish @@ -177,7 +177,7 @@ 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 ABS packages' -f complete -c $progname -n "$getpkgbuild" -xa "$listall" -complete -c $progname -n "$getpkgbuild" -s p -l pkgbuild -d 'Print pkgbuild of packages' -f +complete -c $progname -n "$getpkgbuild" -s p -l print -d 'Print pkgbuild of packages' -f # Permanent configuration settings complete -c $progname -n "not $noopt" -l save -d 'Save current arguments to yay permanent configuration' -f diff --git a/completions/zsh b/completions/zsh index 29471341..6b9567db 100644 --- a/completions/zsh +++ b/completions/zsh @@ -160,7 +160,7 @@ _pacman_opts_yay_modifiers=( # -G _pacman_opts_getpkgbuild_modifiers=( {-f,--force}'[Force download for existing ABS packages]' - {-p,--pkgbuild}'[Print PKGBUILDs]:package:_pacman_completions_all_packages' + {-p,--print}'[Print PKGBUILDs]:package:_pacman_completions_all_packages' ) # -P @@ -508,11 +508,6 @@ _pacman_zsh_comp() { Q*) _pacman_action_query ;; - P*p*) - _arguments -s : \ - "$_pacman_opts_print_modifiers[@]" \ - "*:package:_pacman_all_packages" - ;; P*) _arguments -s : \ "$_pacman_opts_print_modifiers[@]" diff --git a/doc/yay.8 b/doc/yay.8 index fd9c047d..da549397 100644 --- a/doc/yay.8 +++ b/doc/yay.8 @@ -124,10 +124,6 @@ Print new news from the Archlinux homepage. News is considered new if it is newer than the build date of all native packages. Pass this twice to show all available news. -.TP -.B \-p, \-\-pkgbuild -Prints the PKGBUILD of the given packages to stdout. - .TP .B \-q, \-\-quiet Only show titles when printing news. @@ -138,6 +134,10 @@ Only show titles when printing news. Force download for ABS packages that already exist in the current directory. This ensures directories are not accidentally overwritten. +.TP +.B \-p, \-\-print +Prints the PKGBUILD of the given packages to stdout. + .SH PERMANENT CONFIGURATION SETTINGS .TP .B \-\-save