Can we have alias subcommands - or commands with spaces in them (and without 'quotes'), that resolve to a top level command? #5782
-
I'm writing a CLI app (using derive) and attempting to make calling a specific command easier. Users may use any of the following: clap_cli run <other args>
clap_cli alias run <other args>
clap_cli also_alias run <other args> I want all of these to result in the same top-level for context here are my structs/enums so far#[derive(Parser)]
#[command(version, about, long_about = None, arg_required_else_help(true))]
pub struct Cli {
#[command(subcommand)]
pub command: Option<Commands>,
}
#[derive(Subcommand)]
pub enum Commands {
Run {},
} and then I |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
We had a For me, one big question that would need to be answered is why not just add those subcommands to the parent command like we do for |
Beta Was this translation helpful? Give feedback.
We had a
replace
feature to support this but it ran into issues, see #1603. I hadn't re-opened the original request (#1603), so I did so.For me, one big question that would need to be answered is why not just add those subcommands to the parent command like we do for
git stash
in https://docs.rs/clap/latest/clap/_derive/_cookbook/git_derive/index.html