Homebrew / homebrew-command-not-found

🔍 Ubuntu’s command-not-found equivalent for Homebrew on macOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Commands starting with '-' can appear to be options and need quoting

wscott opened this issue · comments

$  -h
Usage: brew which-formula [--explain] command [...]

Prints the formula(e) which provides the given command.

      --explain                    Output explanation of how to get 'cmd' by
                                   installing one of the providing formulae.
  -d, --debug                      Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.

Clearly we are running "brew which-formula $BADCMD" and -h gets passed to brew.

I tried this test:

$ brew which-formula -- -h

but that command appears to just hang so there are so other changes needed and it fell below the threshold where I have time to try putting together a patch.

But I figured I should at least make a bug report.

Thanks for reporting. You're exactly right about what's happening, here. I think the proper thing to do in this case is to not even try to pass to brew which-formula and just fail with the standard "not found" message.