Skip to content

Duplicating a subcommand name as a subcommand alias is not prevented #3888

@epage

Description

@epage

The following should panic in a debug assert but doesn't. It should mirror the asserts for duplicate flags

#!/usr/bin/env -S rust-script --debug

//! ```cargo
//! [dependencies]
//! clap = { path = "../clap", features = ["env", "derive"] }
//! ```

fn main() {
    let mut cmd = clap::Command::new("myprog")
        .subcommand(clap::Command::new("foo"))
        .subcommand(clap::Command::new("bar").alias("foo"));
    cmd.build();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-builderArea: Builder APIC-bugCategory: bugE-easyCall for participation: Experience needed to fix: Easy / not muchM-breaking-changeMeta: Implementing or merging this will introduce a breaking change.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions