- Nix 86%
- Rust 14%
gleam-complete #
Description #
Gleams argument parsing for the CLI is done via the popular clap crate yet it does not currently enable generating static or even dynamic shell completions.
But as the gleam CLI internally defines its argument parsing in a library it is possible to import the command line argument definition and work with them through the clap_complete crate.
So for dynamic shell completions instead of gleam, gleam-complete is called as a completer binary.
This keeps the Gleam project untouched while the shell completions work just like it was part of gleam itself. As dynamic shell completions use the unstable-dynamic feature it is quite sensible to keep this out of Gleam anyway.
Caveats #
gleam-complete&gleammust be kept in syncgleamexposes the CLI structure as a library but it is not meant to be used externally as such and could therefore be removed at any moment- It is quite heavy as is pulls in a lot of crates
- I'm not experienced with Rust
- As a fish user I haven't tested the other shells
Because of these caveats this project of more a proof of concept and a convenient way to get accurate shell completions for Gleam. But it should no be relied upon in any way and is not related to the Gleam project.
Setup #
The appropriate way to source the completions can be found in the clap_complete documentation.
To get completions gleam-complete must be in your $PATH.
Alternative Completions #
If handwritten shell completions are more your style have a look at these projects:
- For ZSH: zsh_gleam_completions by giacomocavalieri
- For Fish: gleam-completions by glpda