sdk
sdk copied to clipboard
Add tab completion to dfx
trafficstars
Motivation
When writing commands, tab completion helps.
Proposed implementation
clap generates tab completion scripts. Can we use it please?
An example of how tab completion is installed in another project: https://rust-lang.github.io/rustup/installation/index.html#enable-tab-completion-for-bash-fish-zsh-or-powershell
- Clap tab completion: https://docs.rs/clap_complete/latest/clap_complete/
- Docs: https://docs.rs/clap_complete/latest/clap_complete/index.html
- Proposed usage:
- Note: The clap example uses the subcommand
generatebutdfxalready uses that for other purposes. - Installing tab completion explicitly:
dfx completions bash > /usr/share/bash-completion/completions/dkg- .. and similar for other shells
- Tab completion could be installed automatically when dkg is installed.
- Note: The clap example uses the subcommand
This is part of our roadmap and will be implemented at some point (hopefully not too far out...).
I'm tackling on it now. For tentative use, you can refer to my samples: https://github.com/ukaznil/dfx-completions Later on, I will think which options we can take to integrate it with this sdk repo.