cli: fix global -y flag conflicts in add-prj` and sync commands

`AddPrjArgs` had a local `-y` flag that conflicted with the global flag,
causing runtime panics. Removed the local field and updated callers to
use `global_yes` consistently.

The sync command now respects the global `-y` flag by accepting, you
guessed it, the `global_yes` parameter.

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I7b7c42fabbca0e363bd18a1d8b6b3bb76a6a6964
This commit is contained in:
raf 2026-02-27 22:26:38 +03:00
commit b0a594e892
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 81 additions and 50 deletions

View file

@ -15,6 +15,10 @@ pub struct Cli {
#[clap(short, long, action = clap::ArgAction::Count)]
pub verbose: u8,
/// Skip all confirmation prompts (assume yes)
#[clap(short, long, global = true)]
pub yes: bool,
#[clap(subcommand)]
pub command: Commands,
}
@ -107,10 +111,6 @@ pub struct InitArgs {
/// Mod loaders (format: name=version, can be specified multiple times)
#[clap(short, long = "loaders", value_delimiter = ',')]
pub loaders: Option<Vec<String>>,
/// Skip interactive prompts (use defaults)
#[clap(short, long)]
pub yes: bool,
}
#[derive(Args)]
@ -121,10 +121,6 @@ pub struct ImportArgs {
/// Resolve dependencies
#[clap(short = 'D', long = "deps")]
pub deps: bool,
/// Skip confirmation prompts
#[clap(short, long)]
pub yes: bool,
}
#[derive(Args)]
@ -144,10 +140,6 @@ pub struct AddArgs {
/// Update if already exists
#[clap(short, long)]
pub update: bool,
/// Skip confirmation prompts
#[clap(short, long)]
pub yes: bool,
}
#[derive(Args)]
@ -195,10 +187,6 @@ pub struct AddPrjArgs {
/// Skip resolving dependencies
#[clap(short = 'D', long = "no-deps")]
pub no_deps: bool,
/// Skip confirmation prompts
#[clap(short, long)]
pub yes: bool,
}
#[derive(Args)]
@ -211,10 +199,6 @@ pub struct RmArgs {
#[clap(short = 'a', long)]
pub all: bool,
/// Skip confirmation prompt
#[clap(short, long)]
pub yes: bool,
/// Skip removing dependent projects
#[clap(short = 'D', long = "no-deps")]
pub no_deps: bool,
@ -229,10 +213,6 @@ pub struct UpdateArgs {
/// Update all projects
#[arg(short, long)]
pub all: bool,
/// Skip confirmation prompts
#[arg(short, long)]
pub yes: bool,
}
#[derive(Args)]