sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Add tab completion to dfx

Open bitdivine opened this issue 3 years ago • 2 comments
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 generate but dfx already 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.

bitdivine avatar Jul 23 '22 01:07 bitdivine

This is part of our roadmap and will be implemented at some point (hopefully not too far out...).

viviveevee avatar Aug 02 '22 08:08 viviveevee

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.

ukaznil avatar May 02 '23 05:05 ukaznil