From adde043514695ea20934edac55971507644955df Mon Sep 17 00:00:00 2001 From: smolx <97612210+smolx@users.noreply.github.com> Date: Sun, 11 Jun 2023 18:13:01 +0200 Subject: [PATCH] Add --askyesremovemake option (#2199) Same as --askremovemake option but with "Y" as a default answer. --- cmd.go | 1 + completions/bash | 2 +- completions/fish | 1 + completions/zsh | 1 + doc/yay.8 | 4 ++++ pkg/settings/args.go | 2 ++ pkg/settings/parser/parser.go | 1 + preparer.go | 4 +++- 8 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd.go b/cmd.go index 1d9d9e7d..df1a9275 100644 --- a/cmd.go +++ b/cmd.go @@ -95,6 +95,7 @@ Permanent configuration options: --nodiffmenu Don't show diffs for build files --noeditmenu Don't edit/view PKGBUILDS --askremovemake Ask to remove makedepends after install + --askyesremovemake Ask to remove makedepends after install("Y" as default) --removemake Remove makedepends after install --noremovemake Don't remove makedepends after install diff --git a/completions/bash b/completions/bash index 442b37c8..f29c68b5 100644 --- a/completions/bash +++ b/completions/bash @@ -75,7 +75,7 @@ _yay() { noansweredit noanswerupgrade cleanmenu diffmenu editmenu cleanafter nocleanafter nocleanmenu nodiffmenu provides noprovides pgpfetch nopgpfetch useask nouseask combinedupgrade nocombinedupgrade aur repo makepkgconf - nomakepkgconf askremovemake removemake noremovemake completioninterval aururl aurrpcurl + nomakepkgconf askremovemake askyesremovemake removemake noremovemake completioninterval aururl aurrpcurl searchby batchinstall nobatchinstall' 'b d h q r v') yays=('clean gendb' 'c') diff --git a/completions/fish b/completions/fish index 86ee213b..58f5d55f 100644 --- a/completions/fish +++ b/completions/fish @@ -220,6 +220,7 @@ complete -c $progname -n "not $noopt" -l nocleanmenu -d 'Do not clean build PKGB complete -c $progname -n "not $noopt" -l nodiffmenu -d 'Do not show diffs for build files' -f complete -c $progname -n "not $noopt" -l noeditmenu -d 'Do not edit/view PKGBUILDS' -f complete -c $progname -n "not $noopt" -l askremovemake -d 'Ask to remove make deps after install' -f +complete -c $progname -n "not $noopt" -l askyesremovemake -d 'Ask to remove make deps after install(with "Y" as default)' -f complete -c $progname -n "not $noopt" -l removemake -d 'Remove make deps after install' -f complete -c $progname -n "not $noopt" -l noremovemake -d 'Do not remove make deps after install' -f complete -c $progname -n "not $noopt" -l topdown -d 'Shows repository packages first and then aur' -f diff --git a/completions/zsh b/completions/zsh index bf899cad..77621a5a 100644 --- a/completions/zsh +++ b/completions/zsh @@ -74,6 +74,7 @@ _pacman_opts_common=( "--nodiffmenu[Don't show diffs for build files]" "--noeditmenu[Don't edit/view PKGBUILDS]" "--askremovemake[Ask to remove makedepends after install]" + "--askyesremovemake[Ask to remove makedepends after install(with "Y" as default)]" "--removemake[Remove makedepends after install]" "--noremovemake[Don't remove makedepends after install]" diff --git a/doc/yay.8 b/doc/yay.8 index 6bb45f4d..b368f2db 100644 --- a/doc/yay.8 +++ b/doc/yay.8 @@ -326,6 +326,10 @@ Do not show the edit menu. .B \-\-askremovemake Ask to remove makedepends after installing packages. +.TP +.B \-\-askyesremovemake +Ask to remove makedepends after installing packages(with "Y" as default). + .TP .B \-\-removemake Remove makedepends after installing packages. diff --git a/pkg/settings/args.go b/pkg/settings/args.go index 42f2cbcf..5617561c 100644 --- a/pkg/settings/args.go +++ b/pkg/settings/args.go @@ -199,6 +199,8 @@ func (c *Configuration) handleOption(option, value string) bool { c.RemoveMake = "no" case "askremovemake": c.RemoveMake = "ask" + case "askyesremovemake": + c.RemoveMake = "askyes" case "separatesources": c.SeparateSources = true case "noseparatesources": diff --git a/pkg/settings/parser/parser.go b/pkg/settings/parser/parser.go index b0cc7dac..6e7166b1 100644 --- a/pkg/settings/parser/parser.go +++ b/pkg/settings/parser/parser.go @@ -440,6 +440,7 @@ func isArg(arg string) bool { case "removemake": case "noremovemake": case "askremovemake": + case "askyesremovemake": case "complete": case "stats": case "news": diff --git a/preparer.go b/preparer.go index c1ebe30d..fe677abb 100644 --- a/preparer.go +++ b/preparer.go @@ -115,7 +115,9 @@ func (preper *Preparer) ShouldCleanMakeDeps(cmdArgs *parser.Arguments) PostInsta case "no": return nil default: - if !text.ContinueTask(os.Stdin, gotext.Get("Remove make dependencies after install?"), false, settings.NoConfirm) { + isYesDefault := preper.cfg.RemoveMake == "askyes" + if !text.ContinueTask(os.Stdin, gotext.Get("Remove make dependencies after install?"), + isYesDefault, settings.NoConfirm) { return nil } }