cli-matic
cli-matic copied to clipboard
Autocompletion
I like the idea, though I don't know how it should work:
See https://github.com/oclif/plugin-autocomplete
It kinda seems like we could just have a few templates that are filled in. zsh completion doesn't seem that hard to generate. https://mads-hartmann.com/2017/08/06/writing-zsh-completion-scripts.html
I would add it as "completion $SHELL" so, like kubectl, you can just run it with your shell name and it'll insert it into the current environment. (or source it). Perhaps protect it with a setting, so if people want to use completion as one of their commands, it doesn't contradict.
we could make it something pretty unlikely and default; you do not often use --shell-completion
as an argument for your source file name, right?
No, I don't.
That sounds like a plan to me. If I have any time, I'll take a stab at it.
Are you going to the conj, by any chance?
On Sun, 25 Nov 2018, 07:39 lenz <[email protected] wrote:
we could make it something pretty unlikely and default; you do not often use --shell-completion as an argument for your source file name, right?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/l3nz/cli-matic/issues/39#issuecomment-441449438, or mute the thread https://github.com/notifications/unsubscribe-auth/AADovN8QYPePrHCGWlxMPztjxFRsJPc6ks5uyrmmgaJpZM4YBUUL .
See also: https://godoc.org/github.com/codegangsta/cli#BashCompleteFunc
pip3 has it too:
[~]$ pip3 completion --bash
# pip bash completion start
_pip_completion()
{
COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
PIP_AUTO_COMPLETE=1 $1 ) )
}
complete -o default -F _pip_completion pip3
# pip bash completion end
$ pip3 completion --fish $ pip3 completion --zsh
See also: https://tuzz.tech/blog/how-bash-completion-works
See also: https://news.ycombinator.com/item?id=23254432
This project has a wondeful on-line help: https://github.com/chriswalz/bit that seems to be created with https://github.com/posener/complete/tree/master