CLI completion for bash, zsh, fish and powershell.
$ cargo install cli-completion
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 xxx.yaml > xxx-completion.sh
$ cli-completion --bash xxx.yaml > xxx-completion.fish
$ cli-completion --bash xxx.yaml > /usr/local/share/zsh/site-functions/_xxx
$ autoload -U compinit && compinit
$ mkdir ~/.oh-my-zsh/custom/plugins/xxx
$ cli-completion --bash xxx.yaml > ~/.oh-my-zsh/custom/plugins/xxx/_xxx
Don't forget to enable xxx plugin in ~/.zshrc fileļ¼
$ cli-completion --powershell xxx.yaml > xxx-completion.ps