#completion #cli #bash #zsh #powershell #fish #oh-my-zsh

app cli-completion

cli completion for bash, zsh, fish and powershell

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

#2357 in Command line utilities

MIT license

440KB
83 lines

CLI completion

cli-completion Crate

CLI completion for bash, zsh, fish and powershell.

CLI Completion

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

Dependencies

~2MB
~30K SLoC