Skip to content

completions: fix zsh autocompletion issues#10845

Merged
nandahkrishna merged 5 commits intoHomebrew:masterfrom
nandahkrishna:fix-completions-zsh
Mar 17, 2021
Merged

completions: fix zsh autocompletion issues#10845
nandahkrishna merged 5 commits intoHomebrew:masterfrom
nandahkrishna:fix-completions-zsh

Conversation

@nandahkrishna
Copy link
Copy Markdown
Member

@nandahkrishna nandahkrishna commented Mar 13, 2021

  • 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. - Modified the old tests.
  • 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?

This PR aims to improve the ZSH completions.

Earlier, conflicts weren't handled:

➜ brew livecheck
zsh: do you wish to see all 9397 possibilities (4699 lines)?

➜ brew livecheck --formula
zsh: do you wish to see all 9397 possibilities (4699 lines)?

➜ brew livecheck --cask
zsh: do you wish to see all 9397 possibilities (4699 lines)?

Now:

➜ brew livecheck
zsh: do you wish to see all 9397 possibilities (4699 lines)?

➜ brew livecheck --formula
zsh: do you wish to see all 5541 possibilities (2771 lines)?

➜ brew livecheck --cask
zsh: do you wish to see all 3856 possibilities (1928 lines)?

Also, this fixes the problem of only one formula/cask/named argument being suggested despite a command being able to take multiple named arguments. However, it isn't smart enough yet (to handle minimum/maximum number of arguments).

Note: So far, I've only handled "direct" conflicts related to named arguments. Some other (known) issues do exist, even with respect to handling conflicts. For example,

➜ brew --cache --build-from-source
zsh: do you wish to see all 9397 possibilities (4699 lines)?

(This shouldn't suggest casks.)

@BrewTestBot
Copy link
Copy Markdown
Contributor

Review period will end on 2021-03-16 at 00:00:00 UTC.

@BrewTestBot BrewTestBot added the waiting for feedback Merging is blocked until sufficient time has passed for review label Mar 13, 2021
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.

Very cool, nice work!

@nandahkrishna nandahkrishna enabled auto-merge March 15, 2021 14:50
@BrewTestBot BrewTestBot removed the waiting for feedback Merging is blocked until sufficient time has passed for review label Mar 16, 2021
@BrewTestBot
Copy link
Copy Markdown
Contributor

Review period ended.

auto-merge was automatically disabled March 16, 2021 00:14

Base branch was modified

Copy link
Copy Markdown
Member

@Rylan12 Rylan12 left a comment

Choose a reason for hiding this comment

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

This is really cool. It doesn't work with commands like brew uninstall yet, though (I think because of the difference between formula and installed_formula). Would it be difficult to get that working in this PR?

@nandahkrishna
Copy link
Copy Markdown
Member Author

I have an approach in mind, although it may not be ideal. I'll try to get it done in this PR.

@nandahkrishna nandahkrishna requested a review from Rylan12 March 16, 2021 05:32
Copy link
Copy Markdown
Member

@Rylan12 Rylan12 left a comment

Choose a reason for hiding this comment

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

Fantastic! Works great! Thanks for working on this, @nandahkrishna!

@nandahkrishna nandahkrishna merged commit 53f34af into Homebrew:master Mar 17, 2021
@nandahkrishna nandahkrishna deleted the fix-completions-zsh branch March 17, 2021 05:25
@github-actions github-actions bot added the outdated PR was locked due to age label Apr 17, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 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.

4 participants