cli/parser: Only prefix short options with one dash

- This avoids error messages like:

```
➜ brew list -l
Error: Invalid usage: `--l` cannot be passed without `--formula`.
```
This commit is contained in:
Issy Long 2020-12-24 13:19:02 +00:00
parent 1b4646dee4
commit 570a660758
No known key found for this signature in database
GPG Key ID: 8247C390DADC67D4

View File

@ -533,8 +533,8 @@ module Homebrew
class OptionConstraintError < UsageError
def initialize(arg1, arg2, missing: false)
arg1 = "--#{arg1.tr("_", "-")}"
arg2 = "--#{arg2.tr("_", "-")}"
arg1 = arg1.length > 1 ? "--#{arg1.tr("_", "-")}" : "-#{arg1.tr("_", "-")}"
arg2 = arg2.length > 1 ? "--#{arg2.tr("_", "-")}" : "-#{arg2.tr("_", "-")}"
message = if missing
"`#{arg2}` cannot be passed without `#{arg1}`."