You are browsing as a guest. Sign up (or log in) to start making projects!

1h 12m 58s logged

Completionism

A few days ago, I looked up clap on crates.io, and realised there were many crates built to add functionality to CLAP, like clap_mangen, clap-version-flag, and more. The two this devlog is about are clap_complete and clap_complete_nushell. These two allow for the generation of shell completions; clap_complete supports Bash, Zsh, Fish, Elvish, and PowerShell; clap_complete_nushell adds nushell support. The standard package has a new (in-development) feature that allows for the binary itself to be the completion script, allowing for more minimal user setup if downloading from crates.io†. The nushell version does not have this feature, so you have to run it with a special flag and save the output to a completions file in ~/.config/nushell/completions/leading-zero-util.nu.

† crates.io doesn’t have an install step so it doesn’t look in the OUT_DIR at build time, so it doesn’t pick up files like the completion files. This same issue is why I chose not to use clap_mangen, since I only currently distribute through crates.io. If I later make a Homebrew tap, I’ll probably change the way the completions are done and re-add clap_mangen.

0
19

Comments 0

No comments yet. Be the first!