diff --git a/clean.go b/clean.go index 21ecb631..148554aa 100644 --- a/clean.go +++ b/clean.go @@ -52,7 +52,7 @@ func syncClean(ctx context.Context, run *runtime.Runtime, cmdArgs *parser.Argume keepInstalled := false keepCurrent := false - _, removeAll, _ := cmdArgs.GetArg("c", "clean") + removeAll := cmdArgs.ExistsArg("c", "clean") for _, v := range run.PacmanConf.CleanMethod { switch v { diff --git a/cmd.go b/cmd.go index 4400abea..a4842f01 100644 --- a/cmd.go +++ b/cmd.go @@ -51,7 +51,7 @@ New operations: yay {-Y --yay} [options] [package(s)] If no operation is specified 'yay -Syu' will be performed -If no operation is specified and targets are provided -Y will be assumed +If no operation is specified and targets are provided, -Y will be assumed New options: -N --repo Assume targets are from the repositories @@ -122,18 +122,18 @@ Permanent configuration options: --timeupdate Check packages' AUR page for changes during sysupgrade -show specific options: +show specific options (used with -P): -c --complete Used for completions -d --defaultconfig Print default yay configuration -g --currentconfig Print current yay configuration -s --stats Display system package statistics -w --news Print arch news -yay specific options: +yay specific options (used with -Y): -c --clean Remove unneeded dependencies (-cc to ignore optdepends) --gendb Generates development package DB used for updating -getpkgbuild specific options: +getpkgbuild specific options (used with -G): -f --force Force download for existing ABS packages -p --print Print pkgbuild of packages`) } diff --git a/pkg/settings/parser/parser.go b/pkg/settings/parser/parser.go index 83d2597c..52150007 100644 --- a/pkg/settings/parser/parser.go +++ b/pkg/settings/parser/parser.go @@ -542,7 +542,7 @@ func hasParam(arg string) bool { } // Parses short hand options such as: -// -Syu -b/some/path -. +// -Syu -b /some/path -. func (a *Arguments) parseShortOption(arg, param string) (usedNext bool, err error) { if arg == "-" { err = a.AddArg("-") @@ -655,6 +655,14 @@ func (a *Arguments) Parse() error { if len(a.Targets) > 0 { a.Op = "Y" } else { + // Handle args incompatible with -Syu + if a.ExistsArg("c", "clean") { + fmt.Println(gotext.Get("the clean command requires an operation to be specified")) + fmt.Println(gotext.Get("did you mean yay -Scc (clean caches) or yay -Ycc (clean orphaned packages)?")) + + return errors.New(gotext.Get("invalid option")) + } + if _, err := a.parseShortOption("-Syu", ""); err != nil { return err }