Support .env files in uv tool run (#12386)

## Summary

Closes https://github.com/astral-sh/uv/issues/12371.
This commit is contained in:
Charlie Marsh 2025-03-22 08:36:42 -07:00 committed by GitHub
parent 42a87da857
commit 2b3d6fd7b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 161 additions and 0 deletions

View file

@ -4093,6 +4093,17 @@ pub struct ToolRunArgs {
#[arg(long)]
pub isolated: bool,
/// Load environment variables from a `.env` file.
///
/// Can be provided multiple times, with subsequent files overriding values defined in previous
/// files.
#[arg(long, value_delimiter = ' ', env = EnvVars::UV_ENV_FILE)]
pub env_file: Vec<PathBuf>,
/// Avoid reading environment variables from a `.env` file.
#[arg(long, value_parser = clap::builder::BoolishValueParser::new(), env = EnvVars::UV_NO_ENV_FILE)]
pub no_env_file: bool,
#[command(flatten)]
pub installer: ResolverInstallerArgs,