Skip to content

cmd/dev-cmd: improve handling of invalid input#6835

Merged
MikeMcQuaid merged 6 commits intoHomebrew:masterfrom
EricFromCanada:input-handling
Dec 15, 2019
Merged

cmd/dev-cmd: improve handling of invalid input#6835
MikeMcQuaid merged 6 commits intoHomebrew:masterfrom
EricFromCanada:input-handling

Conversation

@EricFromCanada
Copy link
Copy Markdown
Member

@EricFromCanada EricFromCanada commented Dec 13, 2019

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Raises errors in more cases of missing or invalid input for various commands. Includes improvements for wording and help text.

Comment thread Library/Homebrew/cmd/desc.rb Outdated
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work so far 👏

Comment thread Library/Homebrew/cmd/--version.rb Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if adding a new exception for this specific case would be a good idea (or even an argument to #parse`) ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a shot at implementing this in cli/parser; have a look.

Comment thread Library/Homebrew/cmd/commands.rb Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly: a new exception or an argument to #parse` might be a better fit?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⬆️

Comment thread Library/Homebrew/cmd/link.rb Outdated
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work, love where this is going.

Comment thread Library/Homebrew/cli/parser.rb Outdated
Comment thread Library/Homebrew/cli/parser.rb Outdated
Comment thread Library/Homebrew/cli/parser.rb Outdated
Comment thread Library/Homebrew/cli/parser.rb Outdated
Comment thread Library/Homebrew/cmd/--version.rb Outdated
Comment thread Library/Homebrew/cmd/info.rb Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could/should this be a FormulaUnspecifiedError?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made these a UsageError with a custom message stating that a formula argument is required only for these specific flags, rather than the command in general, as is implied in the wording of FormulaUnspecifiedError.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha 👍

Comment thread Library/Homebrew/cmd/update.sh Outdated
@MikeMcQuaid
Copy link
Copy Markdown
Member

Fantastic work as usual @EricFromCanada!

@MikeMcQuaid MikeMcQuaid merged commit d556d02 into Homebrew:master Dec 15, 2019
@EricFromCanada EricFromCanada deleted the input-handling branch December 15, 2019 21:46
@lock lock bot added the outdated PR was locked due to age label Jan 14, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated PR was locked due to age

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants