fix(pkgbuild): move pkgbuild to Gp

This commit is contained in:
jguer 2020-12-14 22:30:07 +01:00
parent a288dd754f
commit 28c985b378
No known key found for this signature in database
GPG Key ID: 6D6CC9BEA8556B35
4 changed files with 17 additions and 16 deletions

24
cmd.go
View File

@ -198,31 +198,29 @@ func handleVersion() {
fmt.Printf("yay v%s - libalpm v%s\n", yayVersion, alpm.Version())
}
func handlePrint(cmdArgs *settings.Arguments, dbExecutor db.Executor) (err error) {
func handlePrint(cmdArgs *settings.Arguments, dbExecutor db.Executor) error {
switch {
case cmdArgs.ExistsArg("d", "defaultconfig"):
tmpConfig := settings.DefaultConfig()
fmt.Printf("%v", tmpConfig)
return nil
case cmdArgs.ExistsArg("g", "currentconfig"):
fmt.Printf("%v", config)
return nil
case cmdArgs.ExistsArg("n", "numberupgrades"):
err = printNumberOfUpdates(dbExecutor, cmdArgs.ExistsDouble("u", "sysupgrade"))
return printNumberOfUpdates(dbExecutor, cmdArgs.ExistsDouble("u", "sysupgrade"))
case cmdArgs.ExistsArg("w", "news"):
double := cmdArgs.ExistsDouble("w", "news")
quiet := cmdArgs.ExistsArg("q", "quiet")
err = news.PrintNewsFeed(dbExecutor.LastBuildTime(), config.SortMode, double, quiet)
return news.PrintNewsFeed(dbExecutor.LastBuildTime(), config.SortMode, double, quiet)
case cmdArgs.ExistsDouble("c", "complete"):
err = completion.Show(dbExecutor, config.AURURL, config.Runtime.CompletionPath, config.CompletionInterval, true)
return completion.Show(dbExecutor, config.AURURL, config.Runtime.CompletionPath, config.CompletionInterval, true)
case cmdArgs.ExistsArg("c", "complete"):
err = completion.Show(dbExecutor, config.AURURL, config.Runtime.CompletionPath, config.CompletionInterval, false)
return completion.Show(dbExecutor, config.AURURL, config.Runtime.CompletionPath, config.CompletionInterval, false)
case cmdArgs.ExistsArg("s", "stats"):
err = localStatistics(dbExecutor)
case cmdArgs.ExistsArg("p", "pkgbuild"):
err = printPkgbuilds(dbExecutor, cmdArgs.Targets)
default:
err = nil
return localStatistics(dbExecutor)
}
return err
return nil
}
func handleYay(cmdArgs *settings.Arguments, dbExecutor db.Executor) error {
@ -242,6 +240,10 @@ func handleYay(cmdArgs *settings.Arguments, dbExecutor db.Executor) error {
}
func handleGetpkgbuild(cmdArgs *settings.Arguments, dbExecutor db.Executor) error {
switch {
case cmdArgs.ExistsArg("p", "pkgbuild"):
return printPkgbuilds(dbExecutor, cmdArgs.Targets)
}
return getPkgbuilds(cmdArgs.Targets, dbExecutor, cmdArgs.ExistsArg("f", "force"))
}

View File

@ -79,8 +79,8 @@ _yay() {
searchby batchinstall nobatchinstall'
'b d h q r v')
yays=('clean gendb' 'c')
show=('complete defaultconfig currentconfig stats news pkgbuild' 'c d g s w p')
getpkgbuild=('force' 'f')
show=('complete defaultconfig currentconfig stats news' 'c d g s w')
getpkgbuild=('force pkgbuild' '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

View File

@ -172,13 +172,12 @@ complete -c $progname -n "$show" -s d -l defaultconfig -d 'Print default yay con
complete -c $progname -n "$show" -s g -l currentconfig -d 'Print current yay configuration' -f
complete -c $progname -n "$show" -s s -l stats -d 'Display system package statistics' -f
complete -c $progname -n "$show" -s w -l news -d 'Print arch news' -f
complete -c $progname -n "$show" -s p -l pkgbuild -d 'Print pkgbuild of packages' -f
complete -c $progname -n "$pkgbuild" -xa "$listall"
complete -c $progname -n "$show" -s q -l quiet -d 'Do not print news description' -f
# 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
# Permanent configuration settings
complete -c $progname -n "not $noopt" -l save -d 'Save current arguments to yay permanent configuration' -f

View File

@ -160,6 +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
@ -171,7 +172,6 @@ _pacman_opts_print_modifiers=(
{-s,--stats}'[Display system package statistics]'
{-u,--upgrades}'[Print update list]'
{-w,--news}'[Print arch news]'
{-p,--pkgbuild}'[Print PKGBUILDs]:package:_pacman_completions_all_packages'
)
# options for passing to _arguments: options for --remove command
_pacman_opts_remove=(