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

fix: Update output for brew_install and cleanup feat: multi suggestions for formulas #1316

Merged
merged 5 commits into from
Jul 2, 2022

Conversation

pyrrolizin
Copy link
Contributor

The output of brew install, if no suitable formula was found, has changed. Before it was an error, now it is a warning with suggestions which formula could be meant.

The function to find the most similar formula doesn't work anymore (_get_formulas()), because the path in brew and the logic has changed. But this is not necessary anymore, because brew provides the matching match.

Example output:

$ brew install gitt
Warning: No available formula with the name "gitt". Did you mean git, gitg or gist?
==> Searching for similarly named formulae...
These similarly named formulae were found:
git-test            git-town            gitter-cli          git
git-tf              git-tracker         moz-git-tools       gitg
git-tig             git-trim            sagittarius-scheme  gist
To install one of them, run (for example):
  brew install git-test
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

The formulas can contain special characters. That is why the regex has been extended.

Rule brew_install and test test_brew_install are adjusted and cleaned up.

closes #1299

Copy link
Collaborator

@scorphus scorphus left a comment

Choose a reason for hiding this comment

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

Nice catch! Thank you.

Please consider my comment below.

@pyrrolizin
Copy link
Contributor Author

okay, the implementation was easier than expected.
@scorphus multi suggestions added (incl. tests).

@pyrrolizin pyrrolizin changed the title fix: Update output for brew_install and cleanup fix: Update output for brew_install and cleanup feat: multi suggestions for formulas Jul 1, 2022
Copy link
Collaborator

@scorphus scorphus left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution, @pyrrolizin! Kudos for the complete patch 👍

@scorphus scorphus merged commit ed40463 into nvbn:master Jul 2, 2022
@pyrrolizin pyrrolizin deleted the change_brew_install branch July 2, 2022 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IndexError when using thefuck with brew install command
2 participants