diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index 160181994a..641b7481d1 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -508,6 +508,9 @@ module Homebrew class OptionConstraintError < UsageError def initialize(arg1, arg2, missing: false) + arg1 = "--#{arg1.tr("_", "-")}" + arg2 = "--#{arg2.tr("_", "-")}" + message = if !missing "`#{arg1}` and `#{arg2}` should be passed together." else diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb index 24516c39bb..8fe034844e 100644 --- a/Library/Homebrew/cmd/list.rb +++ b/Library/Homebrew/cmd/list.rb @@ -30,14 +30,12 @@ module Homebrew "passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) "\ "which produces the actual output." switch "--versions", - depends_on: "--formula", description: "Show the version number for installed formulae, or only the specified "\ "formulae if are provided." switch "--multiple", depends_on: "--versions", description: "Only show formulae with multiple versions installed." switch "--pinned", - depends_on: "--formula", description: "Show the versions of pinned formulae, or only the specified (pinned) "\ "formulae if are provided. See also `pin`, `unpin`." # passed through to ls @@ -45,14 +43,11 @@ module Homebrew description: "Force output to be one entry per line. " \ "This is the default when output is not to a terminal." switch "-l", - depends_on: "--formula", description: "List formulae in long format. If the output is to a terminal, "\ "a total sum for all the file sizes is printed before the long listing." switch "-r", - depends_on: "--formula", description: "Reverse the order of the formulae sort to list the oldest entries first." switch "-t", - depends_on: "--formula", description: "Sort formulae by time modified, listing most recently modified first." ["-1", "-l", "-r", "-t"].each do |flag| @@ -73,7 +68,11 @@ module Homebrew return list_casks(args: args) if args.cask? - return list_unbrewed if args.unbrewed? + if args.unbrewed? + raise UsageError, "`--unbrewed` does not take a formula/cask argument." unless args.no_named? + + return list_unbrewed + end # Unbrewed uses the PREFIX, which will exist # Things below use the CELLAR, which doesn't until the first formula is installed.