Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Library/Homebrew/cli/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ def check_constraints
@constraints.each do |primary, secondary, constraint_type|
primary_passed = option_passed?(primary)
secondary_passed = option_passed?(secondary)

primary = name_to_option(primary)
secondary = name_to_option(secondary)

if :mandatory.equal?(constraint_type) && primary_passed && !secondary_passed
raise OptionConstraintError.new(primary, secondary)
end
Expand Down Expand Up @@ -533,9 +537,6 @@ def formulae(argv)

class OptionConstraintError < UsageError
def initialize(arg1, arg2, missing: false)
arg1 = "--#{arg1.tr("_", "-")}"
arg2 = "--#{arg2.tr("_", "-")}"

message = if missing
"`#{arg2}` cannot be passed without `#{arg1}`."
else
Expand Down
3 changes: 3 additions & 0 deletions Library/Homebrew/cmd/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ def list_args
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."

conflicts "--formula", "--cask"
Expand Down