diff --git a/crates/uv/src/cli.rs b/crates/uv/src/cli.rs index 4e374fd55..71bd446cc 100644 --- a/crates/uv/src/cli.rs +++ b/crates/uv/src/cli.rs @@ -35,11 +35,6 @@ pub(crate) struct Cli { /// The path to a `uv.toml` file to use for configuration. #[arg(long, env = "UV_CONFIG_FILE", hide = true)] pub(crate) config_file: Option, - - /// Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any - /// parent directories. - #[arg(long, hide = true)] - pub(crate) isolated: bool, } #[derive(Parser, Debug, Clone)] @@ -92,6 +87,11 @@ pub(crate) struct GlobalArgs { #[arg(global = true, long, overrides_with("preview"), hide = true)] pub(crate) no_preview: bool, + + /// Avoid discovering a `pyproject.toml` or `uv.toml` file in the current directory or any + /// parent directories. + #[arg(global = true, long, hide = true)] + pub(crate) isolated: bool, } #[derive(Debug, Clone, clap::ValueEnum)] diff --git a/crates/uv/src/main.rs b/crates/uv/src/main.rs index 7290c7929..5821af0ee 100644 --- a/crates/uv/src/main.rs +++ b/crates/uv/src/main.rs @@ -112,7 +112,7 @@ async fn run() -> Result { // 3. The user configuration file. let workspace = if let Some(config_file) = cli.config_file.as_ref() { Some(uv_workspace::Workspace::from_file(config_file)?) - } else if cli.isolated { + } else if cli.global_args.isolated { None } else { let project = uv_workspace::Workspace::find(env::current_dir()?)?; @@ -524,7 +524,7 @@ async fn run() -> Result { args.args, requirements, args.python, - cli.isolated, + globals.isolated, globals.preview, &cache, printer, diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs index 8cb4a9c3c..3f449a420 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -34,6 +34,7 @@ pub(crate) struct GlobalSettings { pub(crate) verbose: u8, pub(crate) color: ColorChoice, pub(crate) native_tls: bool, + pub(crate) isolated: bool, pub(crate) preview: PreviewMode, } @@ -51,6 +52,7 @@ impl GlobalSettings { native_tls: flag(args.native_tls, args.no_native_tls) .or(workspace.and_then(|workspace| workspace.options.native_tls)) .unwrap_or(false), + isolated: args.isolated, preview: PreviewMode::from( flag(args.preview, args.no_preview) .or(workspace.and_then(|workspace| workspace.options.preview))