Skip to content

Commit

Permalink
fix(yay): fix completions of -Gp
Browse files Browse the repository at this point in the history
  • Loading branch information
Jguer committed Jan 31, 2021
1 parent afc72da commit fd9e263
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 20 deletions.
10 changes: 5 additions & 5 deletions cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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"))
Expand Down
5 changes: 1 addition & 4 deletions completions/bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -119,9 +119,6 @@ _yay() {
G)
_yay_pkg
;;
P)
_arch_incomp 'p pkgbuild' && _yay_pkg
;;
esac
fi
true
Expand Down
2 changes: 1 addition & 1 deletion completions/fish
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions completions/zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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[@]"
Expand Down
8 changes: 4 additions & 4 deletions doc/yay.8
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit fd9e263

Please sign in to comment.