Skip to content

Commit

Permalink
feat: Add _name to distinguish the same flags of different subcomma…
Browse files Browse the repository at this point in the history
…nds during compile time.
  • Loading branch information
shannmu committed Oct 8, 2024
1 parent 9d66d13 commit 845bb8b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ pub mod heading {
pub trait CommandExt: Sized {
fn _arg(self, arg: Arg) -> Self;

fn _name(&self) -> String;

/// Do not use this method, it is only for backwards compatibility.
/// Use `arg_package_spec_no_all` instead.
fn arg_package_spec(
Expand Down Expand Up @@ -480,6 +482,10 @@ impl CommandExt for Command {
fn _arg(self, arg: Arg) -> Self {
self.arg(arg)
}

fn _name(&self) -> String {
self.get_name().to_string()
}
}

pub fn flag(name: &'static str, help: &'static str) -> Arg {
Expand Down

0 comments on commit 845bb8b

Please sign in to comment.