4 releases (breaking)
0.4.0 | Nov 28, 2021 |
---|---|
0.3.0 | Nov 14, 2020 |
0.2.0 | Nov 14, 2020 |
0.1.0 | Nov 14, 2020 |
#6 in #powershell
440KB
91 lines
CLI completion
CLI completion for bash, zsh, fish and powershell.
How to install?
$ cargo install cli-completion
How to use?
Please refer https://github.com/clap-rs/clap#using-yaml to write YAML file for the cli. Or you can refer multipass.yaml as an example.
$ cli-completion --bash commands/multipass.yaml
bash completion
$ cli-completion --bash xxx.yaml > xxx-completion.sh
fish completion
$ cli-completion --bash xxx.yaml > xxx-completion.fish
zsh completion
$ cli-completion --bash xxx.yaml > /usr/local/share/zsh/site-functions/_xxx
$ autoload -U compinit && compinit
oh-my-zsh completion
$ mkdir ~/.oh-my-zsh/custom/plugins/xxx
$ cli-completion --zsh xxx.yaml > ~/.oh-my-zsh/custom/plugins/xxx/_xxx
Don't forget to enable xxx plugin in ~/.zshrc file!
powershell completion
$ cli-completion --powershell xxx.yaml > xxx-completion.ps
References
- clap-rs: https://github.com/clap-rs/clap
- cli-completion crate: https://crates.io/crates/cli-completion
- Command Line Interface Guidelines: https://clig.dev/
Dependencies
~2MB
~32K SLoC