rustup
rustup copied to clipboard
Add nushell completion support
Problem you are trying to solve
Enable nushell to enjoy first-class completion support, just like shells such as bash and zsh.
Solution you'd like
You can also have native rustup command completion support in nushell.
Notes
We can consider using clap_complete_nushell crate.
In many projects, this clap_complete_nushell crate is used to generate nushell completion scripts, for example:
In addition, according to the clap_complete_nushell crate example, I think the difficulty of integration is very small, but the edge cases of completion may need to be considered.
use clap::Command;
use clap_complete::generate;
use clap_complete_nushell::Nushell;
use std::io;
let mut cmd = Command::new("myapp")
.subcommand(Command::new("test").subcommand(Command::new("config")))
.subcommand(Command::new("hello"));
generate(Nushell, &mut cmd, "myapp", &mut io::stdout());
If there's anything I haven't considered, please let me know.