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

help: show help text for tapped external command #8653

Merged
merged 1 commit into from
Sep 9, 2020
Merged

help: show help text for tapped external command #8653

merged 1 commit into from
Sep 9, 2020

Conversation

Rylan12
Copy link
Member

@Rylan12 Rylan12 commented Sep 8, 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 tests with your changes locally?

Fixes #8641

Previously, running e.g. brew help bundle when homebrew-bundle was not tapped would tap homebrew-bundle and then run brew bundle showing Error: No Brewfile found instead of the expected help text.

I also added a message that lets the user know how to remove a tap that was automatically added. This was briefly discussed in #8641 but no conclusion was made so if this isn't wanted it can be easily removed.

Before:

$ brew help bundle
==> Tapping homebrew/bundle
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle'...
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 5159 (delta 4), reused 1 (delta 0), pack-reused 5145
Receiving objects: 100% (5159/5159), 1.15 MiB | 795.00 KiB/s, done.
Resolving deltas: 100% (3019/3019), done.
Tapped 1 command (104 files, 1.5MB).
Error: No Brewfile found

After:

$ brew help bundle
==> Tapping homebrew/bundle
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-bundle'...
remote: Enumerating objects: 14, done.
remote: Counting objects: 100% (14/14), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 5159 (delta 4), reused 1 (delta 0), pack-reused 5145
Receiving objects: 100% (5159/5159), 1.15 MiB | 5.13 MiB/s, done.
Resolving deltas: 100% (3019/3019), done.
Tapped 1 command (104 files, 1.5MB).
Usage: brew bundle [subcommand]

Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask, Mac App Store
and Whalebrew.
...

Sorry, something went wrong.

@maxim-belkin
Copy link
Contributor

I know this is not within the scope of this PR, but... it seems strange that brew help taps things instead of reporting back to the user that there is nothing to display unless they tap X.

@Rylan12
Copy link
Member Author

Rylan12 commented Sep 8, 2020

@maxim-belkin take a look at #8641 for some discussion (feel free to chime in as well). That was proposed but it was decided that the best option was to add a message letting the user know what happened after the fact.

(That issue's been repurposed a little but the initial conversation is about your concern)

@@ -141,9 +141,14 @@ class MissingEnvironmentVariables < RuntimeError; end
end
tap_commands += %W[#{HOMEBREW_BREW_FILE} tap #{possible_tap.name}]
safe_system(*tap_commands)
ohai "Automatically tapped #{possible_tap.name}. To remove, run `brew untap #{possible_tap.name}`"
Copy link
Member

Choose a reason for hiding this comment

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

The output indicates it was tapped so don't think this is necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair, but it does sound like there is some confusion based on the linked issue. However, it's only one person (that I've seen) so I'm willing to remove it. If it comes up more in the future I'd ask that we take another look.

@MikeMcQuaid
Copy link
Member

I know this is not within the scope of this PR, but... it seems strange that brew help taps things instead of reporting back to the user that there is nothing to display unless they tap X.

These are "official external commands" so this behaviour is intentional. Perhaps they should/could be migrated to Homebrew/brew instead but until then allowing brew bundle or brew services to work without extra intervention is desirable.

Verified

This commit was signed with the committer’s verified signature.
mkmik Marko Mikulicic
Previously, running e.g. `brew help bundle` when homebrew-bundle was not
tapped would tap homebrew-bundle and then run `brew bundle` showing
`Error: No Brewfile found` instead of the expected help text.
@Rylan12 Rylan12 requested a review from MikeMcQuaid September 8, 2020 19:51
@MikeMcQuaid MikeMcQuaid merged commit 91ee29d into Homebrew:master Sep 9, 2020
@MikeMcQuaid
Copy link
Member

Very nice and simple 👏🏻 . Thanks for the fix, @Rylan12!

@Rylan12 Rylan12 deleted the help-external-command-fix branch September 9, 2020 12:01
@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 13, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 13, 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.

brew help bundle runs brew bundle after tapping
4 participants