Make --directory a global argument (#5579)

## Summary

Cargo makes this global (and uses the same technique). It's still hidden
so we can always decide to remove it.
This commit is contained in:
Charlie Marsh 2024-07-29 19:43:55 -04:00 committed by GitHub
parent 3e329029bc
commit c46adee48d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 18 additions and 59 deletions

View file

@ -164,6 +164,10 @@ pub struct GlobalArgs {
/// Hides all progress outputs when set
#[arg(global = true, long)]
pub no_progress: bool,
/// Change to the given directory prior to running the command.
#[arg(global = true, long, hide = true)]
pub directory: Option<PathBuf>,
}
#[derive(Debug, Copy, Clone, clap::ValueEnum)]
@ -1932,10 +1936,6 @@ pub struct RunArgs {
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[arg(long, short, env = "UV_PYTHON", verbatim_doc_comment)]
pub python: Option<String>,
/// The path to the project. Defaults to the current working directory.
#[arg(long, hide = true)]
pub directory: Option<PathBuf>,
}
#[derive(Args)]
@ -2000,10 +2000,6 @@ pub struct SyncArgs {
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[arg(long, short, env = "UV_PYTHON", verbatim_doc_comment)]
pub python: Option<String>,
/// The path to the project. Defaults to the current working directory.
#[arg(long, hide = true)]
pub directory: Option<PathBuf>,
}
#[derive(Args)]
@ -2039,10 +2035,6 @@ pub struct LockArgs {
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[arg(long, short, env = "UV_PYTHON", verbatim_doc_comment)]
pub python: Option<String>,
/// The path to the project. Defaults to the current working directory.
#[arg(long, hide = true)]
pub directory: Option<PathBuf>,
}
#[derive(Args)]