Skip to content

Commit

Permalink
Improve "unknown command" error
Browse files Browse the repository at this point in the history
Clarify it is a `brew` command.

Fixes #17627
  • Loading branch information
MikeMcQuaid committed Jul 5, 2024
1 parent 21ba72b commit 45b6687
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Library/Homebrew/brew.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
end
# Check for cask explicitly because it's very common in old guides
odie "`brew cask` is no longer a `brew` command. Use `brew <command> --cask` instead." if cmd == "cask"
odie "Unknown command: #{cmd}"
odie "Unknown command: brew #{cmd}"

Check warning on line 119 in Library/Homebrew/brew.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/brew.rb#L119

Added line #L119 was not covered by tests
end

# Unset HOMEBREW_HELP to avoid confusing the tap
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Command < AbstractCommand
def run
args.named.each do |cmd|
path = Commands.path(cmd)
odie "Unknown command: #{cmd}" unless path
odie "Unknown command: brew #{cmd}" unless path
puts path
end
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/cmd/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def run
puts_options(Formula.installed.sort)
elsif args.command.present?
cmd_options = Commands.command_options(T.must(args.command))
odie "Unknown command: #{args.command}" if cmd_options.nil?
odie "Unknown command: brew #{args.command}" if cmd_options.nil?

if args.compact?
puts cmd_options.sort.map(&:first) * " "
Expand Down

0 comments on commit 45b6687

Please sign in to comment.