mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-01 14:31:12 +00:00
Make isolated a global argument (#3558)
Closes https://github.com/astral-sh/uv/issues/3557.
This commit is contained in:
parent
44363d25c2
commit
7ed14fa124
3 changed files with 9 additions and 7 deletions
|
@ -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<PathBuf>,
|
||||
|
||||
/// 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)]
|
||||
|
|
|
@ -112,7 +112,7 @@ async fn run() -> Result<ExitStatus> {
|
|||
// 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<ExitStatus> {
|
|||
args.args,
|
||||
requirements,
|
||||
args.python,
|
||||
cli.isolated,
|
||||
globals.isolated,
|
||||
globals.preview,
|
||||
&cache,
|
||||
printer,
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue