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
Generate zsh completions automatically #10403
Conversation
Review period will end on 2021-01-26 at 00:00:00 UTC. |
One other thing I noticed is that the It may be a good idea to split this up a little bit. One option is to have something like a Thoughts on the best thing to do here? |
Okay, good news! I have fish completions working locally as well. Those require the changes in this PR but I'm going to hold off on pushing those, for now, to help reduce the size of this (already pretty big) PR. |
This sounds good to me! Doesn't have to block this PR, though (in fact it may be easier to split up after this is merged). Good thinking about this 🎉 |
This will be available to merge later today (once the conflicts are addressed). Should I go ahead and merge or would you rather I wait until after #10397 is merged per #10397 (review). Not sure what your estimated timing on that one is. Whichever is merged second will need to be rebased. It doesn't matter to me which one it is. |
Don't have a period within first full sentence of the description
Co-Authored-By: Jonathan Chang <me@jonathanchang.org> Co-Authored-By: Eric Knibbe <3324775+EricFromCanada@users.noreply.github.com>
3e1d130
to
0c5edf4
Compare
Review period ended. |
Let's ship this first. Thanks again @Rylan12, great work! |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?brew man
locally and committed any changes?Continuation of the work for #10223.
This PR adds the ability for
brew man
to automatically generate zsh completions. Like with the bash completions, this isn't super intelligent at the moment. It doesn't know how to handle conflicting options or anything like that.One thing that's different for zsh compared to bash completions is that zsh completions allow for descriptions to be used. Descriptions can be used for the brew commands themselves as well as for the options.
To automatically generate the descriptions for options, the
description
parameter defined for the option is used.To generate descriptions for commands, I chose to use the first sentence of the command description. I skimmed through the generated descriptions to make sure they seemed reasonable but didn't look that closely. The way the first sentence is determined is by splitting the description by periods. There were a few cases where the first period was still within the first sentence of the description (when using
i.e.
/e.g.
or referring to a file with a dot in the path). I modified those command descriptions to not use periods within the first sentence.