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 zsh-completion reference guide #1020

Merged
merged 1 commit into from
Aug 20, 2018

Conversation

okdana
Copy link
Contributor

@okdana okdana commented Aug 20, 2018

As discussed in #1017 again — this adds a brief* explanation of _arguments specifications to the zsh completion function, as a reference for other developers to use when making minor changes to the function. I mainly focussed on option specs, since that's the most common thing to change.

* Not actually that brief, lol. Is it too wordy for a 'reference'? If you have suggestions as to how i could make it more 'skimmable' i'm definitely open to them. Or obv if you have any unanswered questions i can address them

ETA: Fixed very minor typo

Copy link
Owner

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

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

omg yes yes yes! Thank you. This clarifies so much for me. This should hopefully stave off my desire to have this file be auto generated. :-) For now, anyway. :P

Out of curiosity, how similar is setting up auto-completions in bash to zsh? I don't think I realized how high quality these completions were. Now I want them in bash. :-)

# Although there may appear to be six specs here, there are actually nine; we
# use brace expansion to combine specs for options that go by multiple names,
# like `-q` and `--quiet`. This is customary, and ties in with the fact that zsh
# merges completion possibilities together when they have the same description.
Copy link
Owner

Choose a reason for hiding this comment

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

Oh my. This one paragraph just clarified so many things.

@BurntSushi BurntSushi merged commit d8f187e into BurntSushi:master Aug 20, 2018
@okdana
Copy link
Contributor Author

okdana commented Aug 20, 2018

I'm not very knowledgeable about bash's completion system, but i know that it's functionally simpler than zsh's, and there's less abstraction built around it. It doesn't provide any of the fancy menu stuff that zsh has, and it's not especially configurable (mostly because there's not a lot to configure). I think it's possible to do some fancy things with it, but again since there's not much abstraction built around it you often have to do it manually (and so nobody bothers).

I think the bash-completion project provides some helpers to do certain things like handling long options with equals (--color <TAB> vs --color=<TAB>), but i haven't looked too much into that either.

zsh isn't super difficult to switch to, btw, if you ever feel compelled to try it. The default configuration is terrible, but if you set it up right it can be made to work almost like a super-set of bash. I was able to switch the default interactive shell in our product at work over to zsh without any of our tech-support people really even noticing the difference (besides the improved completion).

@BurntSushi
Copy link
Owner

Drats. I was afraid you'd say that. I'm not a bash power user by any means, so I'm sure I could switch to zsh, but I fear the yak shave. Some day, perhaps. :-)

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.

2 participants