mirror of
https://github.com/astral-sh/uv.git
synced 2025-09-28 13:04:47 +00:00
Show enum defaults in --help
output (#693)
With `Option<T>` and `.unwrap_or_default()` later, the default of `T` isn't shown in the help output. Old: ``` --link-mode <LINK_MODE> The method to use when installing packages from the global cache Possible values: - clone: Clone (i.e., copy-on-write) packages from the wheel into the site packages - copy: Copy packages from the wheel into the site packages - hardlink: Hard link packages from the wheel into the site packages -q, --quiet Do not print any output --resolution <RESOLUTION> Possible values: - highest: Resolve the highest compatible version of each package - lowest: Resolve the lowest compatible version of each package - lowest-direct: Resolve the lowest compatible version of any direct dependencies, and the highest compatible version of any transitive dependencies --prerelease <PRERELEASE> Possible values: - disallow: Disallow all pre-release versions - allow: Allow all pre-release versions - if-necessary: Allow pre-release versions if all versions of a package are pre-release - explicit: Allow pre-release versions for first-party packages with explicit pre-release markers in their version requirements - if-necessary-or-explicit: Allow pre-release versions if all versions of a package are pre-release, or if the package has an explicit pre-release marker in its version requirements ```  New: ``` --link-mode <LINK_MODE> The method to use when installing packages from the global cache [default: hardlink] Possible values: - clone: Clone (i.e., copy-on-write) packages from the wheel into the site packages - copy: Copy packages from the wheel into the site packages - hardlink: Hard link packages from the wheel into the site packages -q, --quiet Do not print any output --resolution <RESOLUTION> [default: highest] Possible values: - highest: Resolve the highest compatible version of each package - lowest: Resolve the lowest compatible version of each package - lowest-direct: Resolve the lowest compatible version of any direct dependencies, and the highest compatible version of any transitive dependencies --prerelease <PRERELEASE> [default: if-necessary-or-explicit] Possible values: - disallow: Disallow all pre-release versions - allow: Allow all pre-release versions - if-necessary: Allow pre-release versions if all versions of a package are pre-release - explicit: Allow pre-release versions for first-party packages with explicit pre-release markers in their version requirements - if-necessary-or-explicit: Allow pre-release versions if all versions of a package are pre-release, or if the package has an explicit pre-release marker in its version requirements ``` 
This commit is contained in:
parent
98fcb76015
commit
43c837f7bb
1 changed files with 18 additions and 18 deletions
|
@ -137,11 +137,11 @@ struct PipCompileArgs {
|
|||
#[clap(long, conflicts_with = "extra")]
|
||||
all_extras: bool,
|
||||
|
||||
#[clap(long, value_enum)]
|
||||
resolution: Option<ResolutionMode>,
|
||||
#[clap(long, value_enum, default_value_t = ResolutionMode::default())]
|
||||
resolution: ResolutionMode,
|
||||
|
||||
#[clap(long, value_enum)]
|
||||
prerelease: Option<PreReleaseMode>,
|
||||
#[clap(long, value_enum, default_value_t = PreReleaseMode::default())]
|
||||
prerelease: PreReleaseMode,
|
||||
|
||||
/// Write the compiled requirements to the given `requirements.txt` file.
|
||||
#[clap(short, long)]
|
||||
|
@ -210,8 +210,8 @@ struct PipSyncArgs {
|
|||
reinstall_package: Vec<PackageName>,
|
||||
|
||||
/// The method to use when installing packages from the global cache.
|
||||
#[clap(long, value_enum)]
|
||||
link_mode: Option<install_wheel_rs::linker::LinkMode>,
|
||||
#[clap(long, value_enum, default_value_t = install_wheel_rs::linker::LinkMode::default())]
|
||||
link_mode: install_wheel_rs::linker::LinkMode,
|
||||
|
||||
/// The URL of the Python Package Index.
|
||||
#[clap(long, short, default_value = IndexUrl::Pypi.as_str())]
|
||||
|
@ -291,14 +291,14 @@ struct PipInstallArgs {
|
|||
reinstall_package: Vec<PackageName>,
|
||||
|
||||
/// The method to use when installing packages from the global cache.
|
||||
#[clap(long, value_enum)]
|
||||
link_mode: Option<install_wheel_rs::linker::LinkMode>,
|
||||
#[clap(long, value_enum, default_value_t = install_wheel_rs::linker::LinkMode::default())]
|
||||
link_mode: install_wheel_rs::linker::LinkMode,
|
||||
|
||||
#[clap(long, value_enum)]
|
||||
resolution: Option<ResolutionMode>,
|
||||
#[clap(long, value_enum, default_value_t = ResolutionMode::default())]
|
||||
resolution: ResolutionMode,
|
||||
|
||||
#[clap(long, value_enum)]
|
||||
prerelease: Option<PreReleaseMode>,
|
||||
#[clap(long, value_enum, default_value_t = PreReleaseMode::default())]
|
||||
prerelease: PreReleaseMode,
|
||||
|
||||
/// Write the compiled requirements to the given `requirements.txt` file.
|
||||
#[clap(short, long)]
|
||||
|
@ -447,8 +447,8 @@ async fn inner() -> Result<ExitStatus> {
|
|||
&overrides,
|
||||
extras,
|
||||
args.output_file.as_deref(),
|
||||
args.resolution.unwrap_or_default(),
|
||||
args.prerelease.unwrap_or_default(),
|
||||
args.resolution,
|
||||
args.prerelease,
|
||||
args.upgrade.into(),
|
||||
index_urls,
|
||||
args.no_build,
|
||||
|
@ -471,7 +471,7 @@ async fn inner() -> Result<ExitStatus> {
|
|||
commands::pip_sync(
|
||||
&sources,
|
||||
&reinstall,
|
||||
args.link_mode.unwrap_or_default(),
|
||||
args.link_mode,
|
||||
index_urls,
|
||||
args.no_build,
|
||||
cache,
|
||||
|
@ -512,11 +512,11 @@ async fn inner() -> Result<ExitStatus> {
|
|||
&constraints,
|
||||
&overrides,
|
||||
&extras,
|
||||
args.resolution.unwrap_or_default(),
|
||||
args.prerelease.unwrap_or_default(),
|
||||
args.resolution,
|
||||
args.prerelease,
|
||||
index_urls,
|
||||
&reinstall,
|
||||
args.link_mode.unwrap_or_default(),
|
||||
args.link_mode,
|
||||
args.no_build,
|
||||
args.exclude_newer,
|
||||
cache,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue