Skip to content

Commit

Permalink
Remove some Clap-level conflicts in argument groups
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Apr 11, 2024
1 parent 8507ba8 commit 443b7c0
Showing 1 changed file with 24 additions and 112 deletions.
136 changes: 24 additions & 112 deletions crates/uv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ struct PipCompileArgs {
#[clap(long, value_enum, default_value_t = ResolutionMode::default(), env = "UV_RESOLUTION")]
resolution: ResolutionMode,

#[clap(long, value_enum, default_value_t = PreReleaseMode::default(), conflicts_with = "pre", env = "UV_PRERELEASE")]
#[clap(long, value_enum, default_value_t = PreReleaseMode::default(), env = "UV_PRERELEASE")]
prerelease: PreReleaseMode,

#[clap(long, hide = true, conflicts_with = "prerelease")]
#[clap(long, hide = true)]
pre: bool,

/// Write the compiled requirements to the given `requirements.txt` file.
Expand Down Expand Up @@ -385,7 +385,7 @@ struct PipCompileArgs {

/// Ignore the registry index (e.g., PyPI), instead relying on direct URL dependencies and those
/// discovered via `--find-links`.
#[clap(long, conflicts_with = "index_url", conflicts_with = "extra_index_url")]
#[clap(long)]
no_index: bool,

/// The strategy to use when resolving against multiple index URLs.
Expand Down Expand Up @@ -581,7 +581,7 @@ struct PipSyncArgs {

/// Ignore the registry index (e.g., PyPI), instead relying on direct URL dependencies and those
/// discovered via `--find-links`.
#[clap(long, conflicts_with = "index_url", conflicts_with = "extra_index_url")]
#[clap(long)]
no_index: bool,

/// The strategy to use when resolving against multiple index URLs.
Expand Down Expand Up @@ -626,13 +626,7 @@ struct PipSyncArgs {
/// `python3.10` on Linux and macOS.
/// - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`.
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[clap(
long,
short,
verbatim_doc_comment,
conflicts_with = "system",
group = "discovery"
)]
#[clap(long, short, verbatim_doc_comment, group = "discovery")]
python: Option<String>,

/// Install packages into the system Python.
Expand All @@ -643,12 +637,7 @@ struct PipSyncArgs {
///
/// WARNING: `--system` is intended for use in continuous integration (CI) environments and
/// should be used with caution, as it can modify the system Python installation.
#[clap(
long,
conflicts_with = "python",
env = "UV_SYSTEM_PYTHON",
group = "discovery"
)]
#[clap(long, env = "UV_SYSTEM_PYTHON", group = "discovery")]
system: bool,

/// Allow `uv` to modify an `EXTERNALLY-MANAGED` Python installation.
Expand Down Expand Up @@ -825,10 +814,10 @@ struct PipInstallArgs {
#[clap(long, value_enum, default_value_t = ResolutionMode::default(), env = "UV_RESOLUTION")]
resolution: ResolutionMode,

#[clap(long, value_enum, default_value_t = PreReleaseMode::default(), conflicts_with = "pre", env = "UV_PRERELEASE")]
#[clap(long, value_enum, default_value_t = PreReleaseMode::default(), env = "UV_PRERELEASE")]
prerelease: PreReleaseMode,

#[clap(long, hide = true, conflicts_with = "prerelease")]
#[clap(long, hide = true)]
pre: bool,

/// The URL of the Python package index (by default: <https://pypi.org/simple>).
Expand Down Expand Up @@ -865,7 +854,7 @@ struct PipInstallArgs {

/// Ignore the registry index (e.g., PyPI), instead relying on direct URL dependencies and those
/// discovered via `--find-links`.
#[clap(long, conflicts_with = "index_url", conflicts_with = "extra_index_url")]
#[clap(long)]
no_index: bool,

/// The strategy to use when resolving against multiple index URLs.
Expand Down Expand Up @@ -910,13 +899,7 @@ struct PipInstallArgs {
/// `python3.10` on Linux and macOS.
/// - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`.
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[clap(
long,
short,
verbatim_doc_comment,
conflicts_with = "system",
group = "discovery"
)]
#[clap(long, short, verbatim_doc_comment, group = "discovery")]
python: Option<String>,

/// Install packages into the system Python.
Expand All @@ -927,12 +910,7 @@ struct PipInstallArgs {
///
/// WARNING: `--system` is intended for use in continuous integration (CI) environments and
/// should be used with caution, as it can modify the system Python installation.
#[clap(
long,
conflicts_with = "python",
env = "UV_SYSTEM_PYTHON",
group = "discovery"
)]
#[clap(long, env = "UV_SYSTEM_PYTHON", group = "discovery")]
system: bool,

/// Allow `uv` to modify an `EXTERNALLY-MANAGED` Python installation.
Expand Down Expand Up @@ -1048,13 +1026,7 @@ struct PipUninstallArgs {
/// `python3.10` on Linux and macOS.
/// - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`.
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[clap(
long,
short,
verbatim_doc_comment,
conflicts_with = "system",
group = "discovery"
)]
#[clap(long, short, verbatim_doc_comment, group = "discovery")]
python: Option<String>,

/// Attempt to use `keyring` for authentication for remote requirements files.
Expand All @@ -1072,12 +1044,7 @@ struct PipUninstallArgs {
///
/// WARNING: `--system` is intended for use in continuous integration (CI) environments and
/// should be used with caution, as it can modify the system Python installation.
#[clap(
long,
conflicts_with = "python",
env = "UV_SYSTEM_PYTHON",
group = "discovery"
)]
#[clap(long, env = "UV_SYSTEM_PYTHON", group = "discovery")]
system: bool,

/// Allow `uv` to modify an `EXTERNALLY-MANAGED` Python installation.
Expand Down Expand Up @@ -1117,13 +1084,7 @@ struct PipFreezeArgs {
/// `python3.10` on Linux and macOS.
/// - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`.
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[clap(
long,
short,
verbatim_doc_comment,
conflicts_with = "system",
group = "discovery"
)]
#[clap(long, short, verbatim_doc_comment, group = "discovery")]
python: Option<String>,

/// List packages for the system Python.
Expand All @@ -1135,12 +1096,7 @@ struct PipFreezeArgs {
///
/// WARNING: `--system` is intended for use in continuous integration (CI) environments and
/// should be used with caution.
#[clap(
long,
conflicts_with = "python",
env = "UV_SYSTEM_PYTHON",
group = "discovery"
)]
#[clap(long, env = "UV_SYSTEM_PYTHON", group = "discovery")]
system: bool,
}

Expand Down Expand Up @@ -1179,13 +1135,7 @@ struct PipListArgs {
/// `python3.10` on Linux and macOS.
/// - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`.
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[clap(
long,
short,
verbatim_doc_comment,
conflicts_with = "system",
group = "discovery"
)]
#[clap(long, short, verbatim_doc_comment, group = "discovery")]
python: Option<String>,

/// List packages for the system Python.
Expand All @@ -1197,12 +1147,7 @@ struct PipListArgs {
///
/// WARNING: `--system` is intended for use in continuous integration (CI) environments and
/// should be used with caution.
#[clap(
long,
conflicts_with = "python",
env = "UV_SYSTEM_PYTHON",
group = "discovery"
)]
#[clap(long, env = "UV_SYSTEM_PYTHON", group = "discovery")]
system: bool,
}

Expand All @@ -1220,13 +1165,7 @@ struct PipCheckArgs {
/// `python3.10` on Linux and macOS.
/// - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`.
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[clap(
long,
short,
verbatim_doc_comment,
conflicts_with = "system",
group = "discovery"
)]
#[clap(long, short, verbatim_doc_comment, group = "discovery")]
python: Option<String>,

/// List packages for the system Python.
Expand All @@ -1238,12 +1177,7 @@ struct PipCheckArgs {
///
/// WARNING: `--system` is intended for use in continuous integration (CI) environments and
/// should be used with caution.
#[clap(
long,
conflicts_with = "python",
env = "UV_SYSTEM_PYTHON",
group = "discovery"
)]
#[clap(long, env = "UV_SYSTEM_PYTHON", group = "discovery")]
system: bool,
}

Expand All @@ -1269,13 +1203,7 @@ struct PipShowArgs {
/// `python3.10` on Linux and macOS.
/// - `python3.10` or `python.exe` looks for a binary with the given name in `PATH`.
/// - `/home/ferris/.local/bin/python3.10` uses the exact Python at the given path.
#[clap(
long,
short,
verbatim_doc_comment,
conflicts_with = "system",
group = "discovery"
)]
#[clap(long, short, verbatim_doc_comment, group = "discovery")]
python: Option<String>,

/// List packages for the system Python.
Expand All @@ -1287,12 +1215,7 @@ struct PipShowArgs {
///
/// WARNING: `--system` is intended for use in continuous integration (CI) environments and
/// should be used with caution.
#[clap(
long,
conflicts_with = "python",
env = "UV_SYSTEM_PYTHON",
group = "discovery"
)]
#[clap(long, env = "UV_SYSTEM_PYTHON", group = "discovery")]
system: bool,
}

Expand All @@ -1309,13 +1232,7 @@ struct VenvArgs {
///
/// Note that this is different from `--python-version` in `pip compile`, which takes `3.10` or `3.10.13` and
/// doesn't look for a Python interpreter on disk.
#[clap(
long,
short,
verbatim_doc_comment,
conflicts_with = "system",
group = "discovery"
)]
#[clap(long, short, verbatim_doc_comment, group = "discovery")]
python: Option<String>,

/// Use the system Python to uninstall packages.
Expand All @@ -1326,12 +1243,7 @@ struct VenvArgs {
///
/// WARNING: `--system` is intended for use in continuous integration (CI) environments and
/// should be used with caution, as it can modify the system Python installation.
#[clap(
long,
conflicts_with = "python",
env = "UV_SYSTEM_PYTHON",
group = "discovery"
)]
#[clap(long, env = "UV_SYSTEM_PYTHON", group = "discovery")]
system: bool,

/// Install seed packages (`pip`, `setuptools`, and `wheel`) into the virtual environment.
Expand Down Expand Up @@ -1389,7 +1301,7 @@ struct VenvArgs {

/// Ignore the registry index (e.g., PyPI), instead relying on direct URL dependencies and those
/// discovered via `--find-links`.
#[clap(long, conflicts_with = "index_url", conflicts_with = "extra_index_url")]
#[clap(long)]
no_index: bool,

/// The strategy to use when resolving against multiple index URLs.
Expand Down

0 comments on commit 443b7c0

Please sign in to comment.