Skip to content
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

add function to define path #10031

Merged
merged 3 commits into from Dec 28, 2020

Conversation

hyuraku
Copy link
Contributor

@hyuraku hyuraku commented Dec 15, 2020

  • 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 typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?
  • Have you successfully run brew man locally and committed any changes?

refactor how to assign only whether :formula or :cask in commands like cmd/fetch.rb.

Copy link
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.

Nice refactor! Perhaps in cases where only is used once then args.only_path_formula_or_cask could be passed as a parameter directly?

@hyuraku
Copy link
Contributor Author

hyuraku commented Dec 15, 2020

Perhaps in cases where only is used once then args.only_path_formula_or_cask could be passed as a parameter directly?

Thank you for the advice. I will change only into args.only_path_formula_or_cask

@@ -133,6 +133,11 @@ def context
Context::ContextStruct.new(debug: debug?, quiet: quiet?, verbose: verbose?)
end

def only_path_formula_or_cask
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def only_path_formula_or_cask
def only_formula_or_cask

Not sure why path should be in the name.

@reitermarkus
Copy link
Member

reitermarkus commented Dec 15, 2020

Given that all of these are passed from Args to NamedArgs which already contains a reference to Args (self.parent), we could just set the default value on the methods themselves, e.g.

def to_paths(only: self.parent&.only_formula_or_cask)

@MikeMcQuaid MikeMcQuaid merged commit dc52ff6 into Homebrew:master Dec 28, 2020
@MikeMcQuaid
Copy link
Member

Thanks again @hyuraku!

@hyuraku hyuraku deleted the only_path_formula_or_cask branch January 27, 2021 12:32
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Feb 27, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Feb 27, 2021
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.

None yet

4 participants