-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
cmd/dev-cmd: improve handling of invalid input #6835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f0270a5
c246207
2f7c3af
90e830c
0c8eae8
aea6d79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,7 @@ def gist_logs_args | |
| "be accessible with its link." | ||
| switch :verbose | ||
| switch :debug | ||
| max_named 1 | ||
| end | ||
| end | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,25 +61,29 @@ def info_args | |
|
|
||
| def info | ||
| info_args.parse | ||
|
|
||
| if args.days.present? | ||
| raise UsageError, "days must be one of #{VALID_DAYS.join(", ")}" unless VALID_DAYS.include?(args.days) | ||
| raise UsageError, "--days must be one of #{VALID_DAYS.join(", ")}" unless VALID_DAYS.include?(args.days) | ||
| end | ||
|
|
||
| if args.category.present? | ||
| if ARGV.named.present? && !VALID_FORMULA_CATEGORIES.include?(args.category) | ||
| raise UsageError, "category must be one of #{VALID_FORMULA_CATEGORIES.join(", ")} when querying formulae" | ||
| raise UsageError, "--category must be one of #{VALID_FORMULA_CATEGORIES.join(", ")} when querying formulae" | ||
| end | ||
|
|
||
| unless VALID_CATEGORIES.include?(args.category) | ||
| raise UsageError, "category must be one of #{VALID_CATEGORIES.join(", ")}" | ||
| raise UsageError, "--category must be one of #{VALID_CATEGORIES.join(", ")}" | ||
| end | ||
| end | ||
|
|
||
| if args.json | ||
| raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json | ||
| raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json | ||
| raise UsageError, "This command's option requires a formula argument" if ARGV.named.empty? | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could/should this be a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made these a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha 👍 |
||
|
|
||
| print_json | ||
| elsif args.github? | ||
| raise UsageError, "This command's option requires a formula argument" if ARGV.named.empty? | ||
|
|
||
| exec_browser(*Homebrew.args.formulae.map { |f| github_info(f) }) | ||
| else | ||
| print_info | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.