google/argh

Reject subcommands that contain spaces in them

erickt opened this issue · 0 comments

It's rather surprising that we can do this:

use argh::FromArgs;

#[derive(FromArgs)]
#[argh(description="")]
struct Cmd {
    #[argh(subcommand)]
    _sub: SubCmd,
}

#[derive(FromArgs)]
#[argh(subcommand, name = "sub sub", description="")]
struct SubCmd {}

fn main() {
    let _cmd: Cmd = argh::from_env();
}

We can then execute this by running cargo run -- "sub sub". We should probably explicitly reject this.