Conversation
|
Amazing! Does this work for the busybox-style executable as well or only the standalone utils? |
|
So far this only works for single utilities because afaik there is no single |
|
Alright, thanks! |
expr doesn't use clap, but we want to get suggestions for --help and --version. clap adds those by default, but also adds them as -h and -V, which we don't want to suggest.
This increases the overhead for each build.rs file, but makes it easier to add other stuff to a them.
|
I changed a bit how it works: Instead of generating the completions in |
Adds a (hidden) subcommand to the coreutils binary that generates completions for a utility and shell to stdout. use: coreutils completion <utility> <shell> All utilities are now required to have a public `app` module with a `get_app` function (the exact convention could still be changed, there just needs to be a function that returns an `App` for each utility in a place we can find).
|
I opened #2414 with the final (and hopefully simpler) version of this. |
This is a wip pr to enable tab-completions in bash, fish and zsh for all utilities. For now, I implemented this for
sort.(For convenience this is based on #2397)
How to enable completions for a utility
clap::Appcreation into a different file calledapp.rswith a functionget_app(app_name: &str) -> Appbuild.rsto the utility with these contents:app.rsfile toCargo.tomlunder[build-dependencies], e.g.Having
app.rsbe a separate file reduces the amount of dependencies we have to add here, hopefully only clap is ever needed.make install, those files will be copied to the appropriate directories.