cli-completion

Crates.iocli-completion
lib.rscli-completion
version0.4.0
sourcesrc
created_at2020-11-14 06:42:05.877214
updated_at2021-11-28 22:54:37.481932
descriptioncli completion for bash, zsh, fish and powershell.
homepagehttps://github.com/linux-china/cli-completion
repositoryhttps://github.com/linux-china/cli-completion
max_upload_size
id312267
size477,364
Libing Chen (linux-china)

documentation

https://github.com/linux-china/cli-completion

README

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

Commit count: 40

cargo fmt