diff --git a/crates/uv-cache/src/cli.rs b/crates/uv-cache/src/cli.rs index 092fe20ce..7fea88523 100644 --- a/crates/uv-cache/src/cli.rs +++ b/crates/uv-cache/src/cli.rs @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf}; use uv_static::EnvVars; use crate::Cache; -use clap::Parser; +use clap::{Parser, ValueHint}; use tracing::{debug, warn}; #[derive(Parser, Debug, Clone)] @@ -27,7 +27,7 @@ pub struct CacheArgs { /// `%LOCALAPPDATA%\uv\cache` on Windows. /// /// To view the location of the cache directory, run `uv cache dir`. - #[arg(global = true, long, env = EnvVars::UV_CACHE_DIR)] + #[arg(global = true, long, env = EnvVars::UV_CACHE_DIR, value_hint = ValueHint::DirPath)] pub cache_dir: Option, } diff --git a/crates/uv-cli/src/lib.rs b/crates/uv-cli/src/lib.rs index 0d5d3f198..ce763e0e5 100644 --- a/crates/uv-cli/src/lib.rs +++ b/crates/uv-cli/src/lib.rs @@ -5,11 +5,11 @@ use std::path::PathBuf; use std::str::FromStr; use anyhow::{Result, anyhow}; -use clap::ValueEnum; use clap::builder::styling::{AnsiColor, Effects, Style}; use clap::builder::{PossibleValue, Styles, TypedValueParser, ValueParserFactory}; use clap::error::ErrorKind; use clap::{Args, Parser, Subcommand}; +use clap::{ValueEnum, ValueHint}; use uv_auth::Service; use uv_cache::CacheArgs; @@ -131,7 +131,8 @@ pub struct TopLevelArgs { global = true, long, env = EnvVars::UV_CONFIG_FILE, - help_heading = "Global options" + help_heading = "Global options", + value_hint = ValueHint::FilePath, )] pub config_file: Option, @@ -281,6 +282,7 @@ pub struct GlobalArgs { env = EnvVars::UV_INSECURE_HOST, value_delimiter = ' ', value_parser = parse_insecure_host, + value_hint = ValueHint::Url, )] pub allow_insecure_host: Option>>, @@ -342,7 +344,7 @@ pub struct GlobalArgs { /// Relative paths are resolved with the given directory as the base. /// /// See `--project` to only change the project root directory. - #[arg(global = true, long, env = EnvVars::UV_WORKING_DIR)] + #[arg(global = true, long, env = EnvVars::UV_WORKING_DIR, value_hint = ValueHint::DirPath)] pub directory: Option, /// Discover a project in the given directory. @@ -357,7 +359,7 @@ pub struct GlobalArgs { /// See `--directory` to change the working directory entirely. /// /// This setting has no effect when used in the `uv pip` interface. - #[arg(global = true, long, env = EnvVars::UV_PROJECT)] + #[arg(global = true, long, env = EnvVars::UV_PROJECT, value_hint = ValueHint::DirPath)] pub project: Option, } @@ -575,6 +577,7 @@ pub struct HelpArgs { #[arg(long)] pub no_pager: bool, + #[arg(value_hint = ValueHint::Other)] pub command: Option>, } @@ -584,7 +587,7 @@ pub struct VersionArgs { /// Set the project version to this value /// /// To update the project using semantic versioning components instead, use `--bump`. - #[arg(group = "operation")] + #[arg(group = "operation", value_hint = ValueHint::Other)] pub value: Option, /// Update the project version using the given semantics @@ -649,7 +652,7 @@ pub struct VersionArgs { pub refresh: RefreshArgs, /// Update the version of a specific package in the workspace. - #[arg(long, conflicts_with = "isolated")] + #[arg(long, conflicts_with = "isolated", value_hint = ValueHint::Other)] pub package: Option, /// The Python interpreter to use for resolving and syncing. @@ -662,6 +665,7 @@ pub struct VersionArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, } @@ -845,11 +849,12 @@ pub enum SelfCommand { #[derive(Args, Debug)] pub struct SelfUpdateArgs { /// Update to the specified version. If not provided, uv will update to the latest version. + #[arg(value_hint = ValueHint::Other)] pub target_version: Option, /// A GitHub token for authentication. /// A token is not required but can be used to reduce the chance of encountering rate limits. - #[arg(long, env = EnvVars::UV_GITHUB_TOKEN)] + #[arg(long, env = EnvVars::UV_GITHUB_TOKEN, value_hint = ValueHint::Other)] pub token: Option, /// Run without performing the update. @@ -894,6 +899,7 @@ pub enum CacheCommand { #[derive(Args, Debug)] pub struct CleanArgs { /// The packages to remove from the cache. + #[arg(value_hint = ValueHint::Other)] pub package: Vec, /// Force removal of the cache, ignoring in-use checks. @@ -1350,7 +1356,7 @@ pub struct PipCompileArgs { /// /// The order of the requirements files and the requirements in them is used to determine /// priority during resolution. - #[arg(group = "sources", value_parser = parse_file_path)] + #[arg(group = "sources", value_parser = parse_file_path, value_hint = ValueHint::FilePath)] pub src_file: Vec, /// Constrain versions using the given requirements files. @@ -1360,7 +1366,15 @@ pub struct PipCompileArgs { /// trigger the installation of that package. /// /// This is equivalent to pip's `--constraint` option. - #[arg(long, short, alias = "constraint", env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "constraint", + env = EnvVars::UV_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub constraints: Vec>, /// Override versions using the given requirements files. @@ -1372,7 +1386,14 @@ pub struct PipCompileArgs { /// While constraints are _additive_, in that they're combined with the requirements of the /// constituent packages, overrides are _absolute_, in that they completely replace the /// requirements of the constituent packages. - #[arg(long, alias = "override", env = EnvVars::UV_OVERRIDE, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + alias = "override", + env = EnvVars::UV_OVERRIDE, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub overrides: Vec>, /// Exclude packages from resolution using the given requirements files. @@ -1382,7 +1403,14 @@ pub struct PipCompileArgs { /// dependency list entirely and its own dependencies will be ignored during the resolution /// phase. Excludes are unconditional in that requirement specifiers and markers are ignored; /// any package listed in the provided file will be omitted from all resolved environments. - #[arg(long, alias = "exclude", env = EnvVars::UV_EXCLUDE, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + alias = "exclude", + env = EnvVars::UV_EXCLUDE, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub excludes: Vec>, /// Constrain build dependencies using the given requirements files when building source @@ -1391,7 +1419,15 @@ pub struct PipCompileArgs { /// Constraints files are `requirements.txt`-like files that only control the _version_ of a /// requirement that's installed. However, including a package in a constraints file will _not_ /// trigger the installation of that package. - #[arg(long, short, alias = "build-constraint", env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "build-constraint", + env = EnvVars::UV_BUILD_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub build_constraints: Vec>, /// Include optional dependencies from the specified extra name; may be provided more than once. @@ -1435,7 +1471,7 @@ pub struct PipCompileArgs { /// /// If the file already exists, the existing versions will be preferred when resolving /// dependencies, unless `--upgrade` is also specified. - #[arg(long, short)] + #[arg(long, short, value_hint = ValueHint::FilePath)] pub output_file: Option, /// The format in which the resolution should be output. @@ -1492,7 +1528,7 @@ pub struct PipCompileArgs { /// The header comment to include at the top of the output file generated by `uv pip compile`. /// /// Used to reflect custom build scripts and commands that wrap `uv pip compile`. - #[arg(long, env = EnvVars::UV_CUSTOM_COMPILE_COMMAND)] + #[arg(long, env = EnvVars::UV_CUSTOM_COMPILE_COMMAND, value_hint = ValueHint::Other)] pub custom_compile_command: Option, /// The Python interpreter to use during resolution. @@ -1512,7 +1548,8 @@ pub struct PipCompileArgs { short, verbatim_doc_comment, help_heading = "Python options", - value_parser = parse_maybe_string + value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -1638,7 +1675,7 @@ pub struct PipCompileArgs { /// Specify a package to omit from the output resolution. Its dependencies will still be /// included in the resolution. Equivalent to pip-compile's `--unsafe-package` option. - #[arg(long, alias = "unsafe-package")] + #[arg(long, alias = "unsafe-package", value_hint = ValueHint::Other)] pub no_emit_package: Option>, /// Include `--index-url` and `--extra-index-url` entries in the generated output file. @@ -1712,7 +1749,7 @@ pub struct PipSyncArgs { /// extract the requirements for the relevant project. /// /// If `-` is provided, then requirements will be read from stdin. - #[arg(required(true), value_parser = parse_file_path)] + #[arg(required(true), value_parser = parse_file_path, value_hint = ValueHint::FilePath)] pub src_file: Vec, /// Constrain versions using the given requirements files. @@ -1722,7 +1759,15 @@ pub struct PipSyncArgs { /// trigger the installation of that package. /// /// This is equivalent to pip's `--constraint` option. - #[arg(long, short, alias = "constraint", env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "constraint", + env = EnvVars::UV_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub constraints: Vec>, /// Constrain build dependencies using the given requirements files when building source @@ -1731,7 +1776,15 @@ pub struct PipSyncArgs { /// Constraints files are `requirements.txt`-like files that only control the _version_ of a /// requirement that's installed. However, including a package in a constraints file will _not_ /// trigger the installation of that package. - #[arg(long, short, alias = "build-constraint", env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "build-constraint", + env = EnvVars::UV_BUILD_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub build_constraints: Vec>, /// Include optional dependencies from the specified extra name; may be provided more than once. @@ -1820,6 +1873,7 @@ pub struct PipSyncArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -1866,7 +1920,7 @@ pub struct PipSyncArgs { /// environment and only searches for a Python interpreter to use for package resolution. /// If a suitable Python interpreter cannot be found, uv will install one. /// To disable this, add `--no-python-downloads`. - #[arg(long, conflicts_with = "prefix")] + #[arg(long, conflicts_with = "prefix", value_hint = ValueHint::DirPath)] pub target: Option, /// Install packages into `lib`, `bin`, and other top-level folders under the specified @@ -1881,7 +1935,7 @@ pub struct PipSyncArgs { /// environment and only searches for a Python interpreter to use for package resolution. /// If a suitable Python interpreter cannot be found, uv will install one. /// To disable this, add `--no-python-downloads`. - #[arg(long, conflicts_with = "target")] + #[arg(long, conflicts_with = "target", value_hint = ValueHint::DirPath)] pub prefix: Option, /// Don't build source distributions. @@ -2005,7 +2059,7 @@ pub struct PipInstallArgs { /// Install all listed packages. /// /// The order of the packages is used to determine priority during resolution. - #[arg(group = "sources")] + #[arg(group = "sources", value_hint = ValueHint::Other)] pub package: Vec, /// Install the packages listed in the given files. @@ -2017,7 +2071,14 @@ pub struct PipInstallArgs { /// requirements for the relevant project. /// /// If `-` is provided, then requirements will be read from stdin. - #[arg(long, short, alias = "requirement", group = "sources", value_parser = parse_file_path)] + #[arg( + long, + short, + alias = "requirement", + group = "sources", + value_parser = parse_file_path, + value_hint = ValueHint::FilePath, + )] pub requirements: Vec, /// Install the editable package based on the provided local file path. @@ -2031,7 +2092,15 @@ pub struct PipInstallArgs { /// trigger the installation of that package. /// /// This is equivalent to pip's `--constraint` option. - #[arg(long, short, alias = "constraint", env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "constraint", + env = EnvVars::UV_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub constraints: Vec>, /// Override versions using the given requirements files. @@ -2043,7 +2112,14 @@ pub struct PipInstallArgs { /// While constraints are _additive_, in that they're combined with the requirements of the /// constituent packages, overrides are _absolute_, in that they completely replace the /// requirements of the constituent packages. - #[arg(long, alias = "override", env = EnvVars::UV_OVERRIDE, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + alias = "override", + env = EnvVars::UV_OVERRIDE, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub overrides: Vec>, /// Exclude packages from resolution using the given requirements files. @@ -2053,7 +2129,14 @@ pub struct PipInstallArgs { /// dependency list entirely and its own dependencies will be ignored during the resolution /// phase. Excludes are unconditional in that requirement specifiers and markers are ignored; /// any package listed in the provided file will be omitted from all resolved environments. - #[arg(long, alias = "exclude", env = EnvVars::UV_EXCLUDE, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + alias = "exclude", + env = EnvVars::UV_EXCLUDE, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub excludes: Vec>, /// Constrain build dependencies using the given requirements files when building source @@ -2062,7 +2145,15 @@ pub struct PipInstallArgs { /// Constraints files are `requirements.txt`-like files that only control the _version_ of a /// requirement that's installed. However, including a package in a constraints file will _not_ /// trigger the installation of that package. - #[arg(long, short, alias = "build-constraint", env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "build-constraint", + env = EnvVars::UV_BUILD_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub build_constraints: Vec>, /// Include optional dependencies from the specified extra name; may be provided more than once. @@ -2159,6 +2250,7 @@ pub struct PipInstallArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -2205,7 +2297,7 @@ pub struct PipInstallArgs { /// environment and only searches for a Python interpreter to use for package resolution. /// If a suitable Python interpreter cannot be found, uv will install one. /// To disable this, add `--no-python-downloads`. - #[arg(long, conflicts_with = "prefix")] + #[arg(long, conflicts_with = "prefix", value_hint = ValueHint::DirPath)] pub target: Option, /// Install packages into `lib`, `bin`, and other top-level folders under the specified @@ -2220,7 +2312,7 @@ pub struct PipInstallArgs { /// environment and only searches for a Python interpreter to use for package resolution. /// If a suitable Python interpreter cannot be found, uv will install one. /// To disable this, add `--no-python-downloads`. - #[arg(long, conflicts_with = "target")] + #[arg(long, conflicts_with = "target", value_hint = ValueHint::DirPath)] pub prefix: Option, /// Don't build source distributions. @@ -2347,14 +2439,14 @@ pub struct PipInstallArgs { #[command(group = clap::ArgGroup::new("sources").required(true).multiple(true))] pub struct PipUninstallArgs { /// Uninstall all listed packages. - #[arg(group = "sources")] + #[arg(group = "sources", value_hint = ValueHint::Other)] pub package: Vec, /// Uninstall the packages listed in the given files. /// /// The following formats are supported: `requirements.txt`, `.py` files with inline metadata, /// `pylock.toml`, `pyproject.toml`, `setup.py`, and `setup.cfg`. - #[arg(long, short, alias = "requirement", group = "sources", value_parser = parse_file_path)] + #[arg(long, short, alias = "requirement", group = "sources", value_parser = parse_file_path, value_hint = ValueHint::FilePath)] pub requirements: Vec, /// The Python interpreter from which packages should be uninstalled. @@ -2371,6 +2463,7 @@ pub struct PipUninstallArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -2420,11 +2513,11 @@ pub struct PipUninstallArgs { pub no_break_system_packages: bool, /// Uninstall packages from the specified `--target` directory. - #[arg(long, conflicts_with = "prefix")] + #[arg(long, conflicts_with = "prefix", value_hint = ValueHint::DirPath)] pub target: Option, /// Uninstall packages from the specified `--prefix` directory. - #[arg(long, conflicts_with = "target")] + #[arg(long, conflicts_with = "target", value_hint = ValueHint::DirPath)] pub prefix: Option, /// Perform a dry run, i.e., don't actually uninstall anything but print the resulting plan. @@ -2462,11 +2555,12 @@ pub struct PipFreezeArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, /// Restrict to the specified installation path for listing packages (can be used multiple times). - #[arg(long("path"), value_parser = parse_file_path)] + #[arg(long("path"), value_parser = parse_file_path, value_hint = ValueHint::DirPath)] pub paths: Option>, /// List packages in the system Python environment. @@ -2486,11 +2580,11 @@ pub struct PipFreezeArgs { pub no_system: bool, /// List packages from the specified `--target` directory. - #[arg(long, conflicts_with_all = ["prefix", "paths"])] + #[arg(long, conflicts_with_all = ["prefix", "paths"], value_hint = ValueHint::DirPath)] pub target: Option, /// List packages from the specified `--prefix` directory. - #[arg(long, conflicts_with_all = ["target", "paths"])] + #[arg(long, conflicts_with_all = ["target", "paths"], value_hint = ValueHint::DirPath)] pub prefix: Option, #[command(flatten)] @@ -2508,7 +2602,7 @@ pub struct PipListArgs { pub exclude_editable: bool, /// Exclude the specified package(s) from the output. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub r#exclude: Vec, /// Select the output format. @@ -2549,6 +2643,7 @@ pub struct PipListArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -2569,11 +2664,11 @@ pub struct PipListArgs { pub no_system: bool, /// List packages from the specified `--target` directory. - #[arg(long, conflicts_with = "prefix")] + #[arg(long, conflicts_with = "prefix", value_hint = ValueHint::DirPath)] pub target: Option, /// List packages from the specified `--prefix` directory. - #[arg(long, conflicts_with = "target")] + #[arg(long, conflicts_with = "target", value_hint = ValueHint::DirPath)] pub prefix: Option, #[command(flatten)] @@ -2595,6 +2690,7 @@ pub struct PipCheckArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -2645,6 +2741,7 @@ pub struct PipCheckArgs { #[derive(Args)] pub struct PipShowArgs { /// The package(s) to display. + #[arg(value_hint = ValueHint::Other)] pub package: Vec, /// Validate the Python environment, to detect packages with missing dependencies and other @@ -2672,6 +2769,7 @@ pub struct PipShowArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -2692,11 +2790,11 @@ pub struct PipShowArgs { pub no_system: bool, /// Show a package from the specified `--target` directory. - #[arg(long, conflicts_with = "prefix")] + #[arg(long, conflicts_with = "prefix", value_hint = ValueHint::DirPath)] pub target: Option, /// Show a package from the specified `--prefix` directory. - #[arg(long, conflicts_with = "target")] + #[arg(long, conflicts_with = "target", value_hint = ValueHint::DirPath)] pub prefix: Option, #[command(flatten)] @@ -2736,6 +2834,7 @@ pub struct PipTreeArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -2780,7 +2879,7 @@ pub struct BuildArgs { /// distribution archive to build into a wheel. /// /// Defaults to the current working directory. - #[arg(value_parser = parse_file_path)] + #[arg(value_parser = parse_file_path, value_hint = ValueHint::DirPath)] pub src: Option, /// Build a specific package in the workspace. @@ -2789,7 +2888,7 @@ pub struct BuildArgs { /// directory if no source directory is provided. /// /// If the workspace member does not exist, uv will exit with an error. - #[arg(long, conflicts_with("all_packages"))] + #[arg(long, conflicts_with("all_packages"), value_hint = ValueHint::Other)] pub package: Option, /// Builds all packages in the workspace. @@ -2805,7 +2904,7 @@ pub struct BuildArgs { /// /// Defaults to the `dist` subdirectory within the source directory, or the /// directory containing the source distribution archive. - #[arg(long, short, value_parser = parse_file_path)] + #[arg(long, short, value_parser = parse_file_path, value_hint = ValueHint::DirPath)] pub out_dir: Option, /// Build a source distribution ("sdist") from the given directory. @@ -2862,7 +2961,15 @@ pub struct BuildArgs { /// Constraints files are `requirements.txt`-like files that only control the _version_ of a /// build dependency that's installed. However, including a package in a constraints file will /// _not_ trigger the inclusion of that package on its own. - #[arg(long, short, alias = "build-constraint", env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "build-constraint", + env = EnvVars::UV_BUILD_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub build_constraints: Vec>, /// Require a matching hash for each requirement. @@ -2921,6 +3028,7 @@ pub struct BuildArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -2949,6 +3057,7 @@ pub struct VenvArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -3021,6 +3130,7 @@ pub struct VenvArgs { /// Default to `.venv` in the working directory. /// /// Relative paths are resolved relative to the working directory. + #[arg(value_hint = ValueHint::DirPath)] pub path: Option, /// Provide an alternative prompt prefix for the virtual environment. @@ -3031,7 +3141,7 @@ pub struct VenvArgs { /// /// If "." is provided, the current directory name will be used regardless of whether a path was /// provided to `uv venv`. - #[arg(long, verbatim_doc_comment)] + #[arg(long, verbatim_doc_comment, value_hint = ValueHint::Other)] pub prompt: Option, /// Give the virtual environment access to the system site packages directory. @@ -3186,13 +3296,13 @@ pub struct InitArgs { /// If a `pyproject.toml` is found in any of the parent directories of the target path, the /// project will be added as a workspace member of the parent, unless `--no-workspace` is /// provided. - #[arg(required_if_eq("script", "true"))] + #[arg(required_if_eq("script", "true"), value_hint = ValueHint::DirPath)] pub path: Option, /// The name of the project. /// /// Defaults to the name of the directory. - #[arg(long, conflicts_with = "script")] + #[arg(long, conflicts_with = "script", value_hint = ValueHint::Other)] pub name: Option, /// Only create a `pyproject.toml`. @@ -3258,7 +3368,7 @@ pub struct InitArgs { pub r#script: bool, /// Set the project description. - #[arg(long, conflicts_with = "script", overrides_with = "no_description")] + #[arg(long, conflicts_with = "script", overrides_with = "no_description", value_hint = ValueHint::Other)] pub description: Option, /// Disable the description for the project. @@ -3329,6 +3439,7 @@ pub struct InitArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, } @@ -3342,7 +3453,13 @@ pub struct RunArgs { /// Optional dependencies are defined via `project.optional-dependencies` in a `pyproject.toml`. /// /// This option is only available when running in a project. - #[arg(long, conflicts_with = "all_extras", conflicts_with = "only_group", value_parser = extra_name_with_clap_error)] + #[arg( + long, + conflicts_with = "all_extras", + conflicts_with = "only_group", + value_parser = extra_name_with_clap_error, + value_hint = ValueHint::Other, + )] pub extra: Option>, /// Include all optional dependencies. @@ -3356,7 +3473,7 @@ pub struct RunArgs { /// Exclude the specified optional dependencies, if `--all-extras` is supplied. /// /// May be provided multiple times. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub no_extra: Vec, #[arg(long, overrides_with("all_extras"), hide = true)] @@ -3385,7 +3502,7 @@ pub struct RunArgs { /// Include dependencies from the specified dependency group. /// /// May be provided multiple times. - #[arg(long, conflicts_with_all = ["only_group", "only_dev"])] + #[arg(long, conflicts_with_all = ["only_group", "only_dev"], value_hint = ValueHint::Other)] pub group: Vec, /// Disable the specified dependency group. @@ -3394,7 +3511,7 @@ pub struct RunArgs { /// `--all-groups`, and `--group`. /// /// May be provided multiple times. - #[arg(long, env = EnvVars::UV_NO_GROUP, value_delimiter = ' ')] + #[arg(long, env = EnvVars::UV_NO_GROUP, value_delimiter = ' ', value_hint = ValueHint::Other)] pub no_group: Vec, /// Ignore the default dependency groups. @@ -3409,7 +3526,7 @@ pub struct RunArgs { /// The project and its dependencies will be omitted. /// /// May be provided multiple times. Implies `--no-default-groups`. - #[arg(long, conflicts_with_all = ["group", "dev", "all_groups"])] + #[arg(long, conflicts_with_all = ["group", "dev", "all_groups"], value_hint = ValueHint::Other)] pub only_group: Vec, /// Include dependencies from all dependency groups. @@ -3457,7 +3574,7 @@ pub struct RunArgs { /// /// Can be provided multiple times, with subsequent files overriding values defined in previous /// files. - #[arg(long, env = EnvVars::UV_ENV_FILE)] + #[arg(long, env = EnvVars::UV_ENV_FILE, value_hint = ValueHint::FilePath)] pub env_file: Vec, /// Avoid reading environment variables from a `.env` file. @@ -3476,7 +3593,7 @@ pub struct RunArgs { /// When used in a project, these dependencies will be layered on top of the project environment /// in a separate, ephemeral environment. These dependencies are allowed to conflict with those /// specified by the project. - #[arg(short = 'w', long)] + #[arg(short = 'w', long, value_hint = ValueHint::Other)] pub with: Vec, /// Run with the given packages installed in editable mode. @@ -3484,7 +3601,7 @@ pub struct RunArgs { /// When used in a project, these dependencies will be layered on top of the project environment /// in a separate, ephemeral environment. These dependencies are allowed to conflict with those /// specified by the project. - #[arg(long)] + #[arg(long, value_hint = ValueHint::DirPath)] pub with_editable: Vec, /// Run with the packages listed in the given files. @@ -3495,7 +3612,7 @@ pub struct RunArgs { /// The same environment semantics as `--with` apply. /// /// Using `pyproject.toml`, `setup.py`, or `setup.cfg` files is not allowed. - #[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path)] + #[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path, value_hint = ValueHint::FilePath)] pub with_requirements: Vec>, /// Run the command in an isolated virtual environment. @@ -3582,7 +3699,7 @@ pub struct RunArgs { /// Run the command in a specific package in the workspace. /// /// If the workspace member does not exist, uv will exit with an error. - #[arg(long, conflicts_with = "all_packages")] + #[arg(long, conflicts_with = "all_packages", value_hint = ValueHint::Other)] pub package: Option, /// Avoid discovering the project or workspace. @@ -3608,6 +3725,7 @@ pub struct RunArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -3661,7 +3779,13 @@ pub struct SyncArgs { /// /// Note that all optional dependencies are always included in the resolution; this option only /// affects the selection of packages to install. - #[arg(long, conflicts_with = "all_extras", conflicts_with = "only_group", value_parser = extra_name_with_clap_error)] + #[arg( + long, + conflicts_with = "all_extras", + conflicts_with = "only_group", + value_parser = extra_name_with_clap_error, + value_hint = ValueHint::Other, + )] pub extra: Option>, /// Select the output format. @@ -3681,7 +3805,7 @@ pub struct SyncArgs { /// Exclude the specified optional dependencies, if `--all-extras` is supplied. /// /// May be provided multiple times. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub no_extra: Vec, #[arg(long, overrides_with("all_extras"), hide = true)] @@ -3714,7 +3838,7 @@ pub struct SyncArgs { /// `tool.uv.conflicts`, uv will report an error. /// /// May be provided multiple times. - #[arg(long, conflicts_with_all = ["only_group", "only_dev"])] + #[arg(long, conflicts_with_all = ["only_group", "only_dev"], value_hint = ValueHint::Other)] pub group: Vec, /// Disable the specified dependency group. @@ -3723,7 +3847,7 @@ pub struct SyncArgs { /// `--all-groups`, and `--group`. /// /// May be provided multiple times. - #[arg(long, env = EnvVars::UV_NO_GROUP, value_delimiter = ' ')] + #[arg(long, env = EnvVars::UV_NO_GROUP, value_delimiter = ' ', value_hint = ValueHint::Other)] pub no_group: Vec, /// Ignore the default dependency groups. @@ -3738,7 +3862,7 @@ pub struct SyncArgs { /// The project and its dependencies will be omitted. /// /// May be provided multiple times. Implies `--no-default-groups`. - #[arg(long, conflicts_with_all = ["group", "dev", "all_groups"])] + #[arg(long, conflicts_with_all = ["group", "dev", "all_groups"], value_hint = ValueHint::Other)] pub only_group: Vec, /// Include dependencies from all dependency groups. @@ -3839,11 +3963,11 @@ pub struct SyncArgs { /// /// The inverse `--only-install-package` can be used to install _only_ the specified packages, /// excluding all others. - #[arg(long, conflicts_with = "only_install_package")] + #[arg(long, conflicts_with = "only_install_package", value_hint = ValueHint::Other)] pub no_install_package: Vec, /// Only install the given package(s). - #[arg(long, conflicts_with = "no_install_package", hide = true)] + #[arg(long, conflicts_with = "no_install_package", hide = true, value_hint = ValueHint::Other)] pub only_install_package: Vec, /// Assert that the `uv.lock` will remain unchanged. @@ -3893,7 +4017,7 @@ pub struct SyncArgs { /// declared by the specified workspace member packages. /// /// If any workspace member does not exist, uv will exit with an error. - #[arg(long, conflicts_with = "all_packages")] + #[arg(long, conflicts_with = "all_packages", value_hint = ValueHint::Other)] pub package: Vec, /// Sync the environment for a Python script, rather than the current project. @@ -3918,7 +4042,8 @@ pub struct SyncArgs { conflicts_with = "no_group", conflicts_with = "no_default_groups", conflicts_with = "only_group", - conflicts_with = "all_groups" + conflicts_with = "all_groups", + value_hint = ValueHint::FilePath, )] pub script: Option, @@ -3939,6 +4064,7 @@ pub struct SyncArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -4017,7 +4143,7 @@ pub struct LockArgs { /// /// If provided, uv will lock the script (based on its inline metadata table, in adherence with /// PEP 723) to a `.lock` file adjacent to the script itself. - #[arg(long)] + #[arg(long, value_hint = ValueHint::FilePath)] pub script: Option, #[command(flatten)] @@ -4045,6 +4171,7 @@ pub struct LockArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, } @@ -4053,14 +4180,21 @@ pub struct LockArgs { #[command(group = clap::ArgGroup::new("sources").required(true).multiple(true))] pub struct AddArgs { /// The packages to add, as PEP 508 requirements (e.g., `ruff==0.5.0`). - #[arg(group = "sources")] + #[arg(group = "sources", value_hint = ValueHint::Other)] pub packages: Vec, /// Add the packages listed in the given files. /// /// The following formats are supported: `requirements.txt`, `.py` files with inline metadata, /// `pylock.toml`, `pyproject.toml`, `setup.py`, and `setup.cfg`. - #[arg(long, short, alias = "requirement", group = "sources", value_parser = parse_file_path)] + #[arg( + long, + short, + alias = "requirement", + group = "sources", + value_parser = parse_file_path, + value_hint = ValueHint::FilePath, + )] pub requirements: Vec, /// Constrain versions using the given requirements files. @@ -4070,11 +4204,19 @@ pub struct AddArgs { /// `pyproject.toml` file, but _will_ be respected during dependency resolution. /// /// This is equivalent to pip's `--constraint` option. - #[arg(long, short, alias = "constraint", env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "constraint", + env = EnvVars::UV_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub constraints: Vec>, /// Apply this marker to all added packages. - #[arg(long, short, value_parser = MarkerTree::from_str)] + #[arg(long, short, value_parser = MarkerTree::from_str, value_hint = ValueHint::Other)] pub marker: Option, /// Add the requirements to the development dependency group. @@ -4095,7 +4237,7 @@ pub struct AddArgs { /// The group may then be activated when installing the project with the `--extra` flag. /// /// To enable an optional extra for this requirement instead, see `--extra`. - #[arg(long, conflicts_with("dev"), conflicts_with("group"))] + #[arg(long, conflicts_with("dev"), conflicts_with("group"), value_hint = ValueHint::Other)] pub optional: Option, /// Add the requirements to the specified dependency group. @@ -4105,7 +4247,8 @@ pub struct AddArgs { long, conflicts_with("dev"), conflicts_with("optional"), - conflicts_with("script") + conflicts_with("script"), + value_hint = ValueHint::Other, )] pub group: Option, @@ -4149,15 +4292,15 @@ pub struct AddArgs { pub bounds: Option, /// Commit to use when adding a dependency from Git. - #[arg(long, group = "git-ref", action = clap::ArgAction::Set)] + #[arg(long, group = "git-ref", action = clap::ArgAction::Set, value_hint = ValueHint::Other)] pub rev: Option, /// Tag to use when adding a dependency from Git. - #[arg(long, group = "git-ref", action = clap::ArgAction::Set)] + #[arg(long, group = "git-ref", action = clap::ArgAction::Set, value_hint = ValueHint::Other)] pub tag: Option, /// Branch to use when adding a dependency from Git. - #[arg(long, group = "git-ref", action = clap::ArgAction::Set)] + #[arg(long, group = "git-ref", action = clap::ArgAction::Set, value_hint = ValueHint::Other)] pub branch: Option, /// Whether to use Git LFS when adding a dependency from Git. @@ -4169,7 +4312,7 @@ pub struct AddArgs { /// May be provided more than once. /// /// To add this dependency to an optional extra instead, see `--optional`. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub extra: Option>, /// Avoid syncing the virtual environment. @@ -4212,7 +4355,7 @@ pub struct AddArgs { pub refresh: RefreshArgs, /// Add the dependency to a specific package in the workspace. - #[arg(long, conflicts_with = "isolated")] + #[arg(long, conflicts_with = "isolated", value_hint = ValueHint::Other)] pub package: Option, /// Add the dependency to the specified Python script, rather than to a project. @@ -4226,7 +4369,8 @@ pub struct AddArgs { conflicts_with = "dev", conflicts_with = "optional", conflicts_with = "package", - conflicts_with = "workspace" + conflicts_with = "workspace", + value_hint = ValueHint::FilePath, )] pub script: Option, @@ -4240,6 +4384,7 @@ pub struct AddArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -4353,7 +4498,8 @@ pub struct AddArgs { long, conflicts_with = "frozen", conflicts_with = "no_sync", - conflicts_with = "only_install_package" + conflicts_with = "only_install_package", + value_hint = ValueHint::Other, )] pub no_install_package: Vec, @@ -4363,7 +4509,8 @@ pub struct AddArgs { conflicts_with = "frozen", conflicts_with = "no_sync", conflicts_with = "no_install_package", - hide = true + hide = true, + value_hint = ValueHint::Other, )] pub only_install_package: Vec, } @@ -4371,7 +4518,7 @@ pub struct AddArgs { #[derive(Args)] pub struct RemoveArgs { /// The names of the dependencies to remove (e.g., `ruff`). - #[arg(required = true)] + #[arg(required = true, value_hint = ValueHint::Other)] pub packages: Vec>, /// Remove the packages from the development dependency group. @@ -4385,7 +4532,8 @@ pub struct RemoveArgs { long, conflicts_with("dev"), conflicts_with("group"), - conflicts_with("script") + conflicts_with("script"), + value_hint = ValueHint::Other, )] pub optional: Option, @@ -4394,7 +4542,8 @@ pub struct RemoveArgs { long, conflicts_with("dev"), conflicts_with("optional"), - conflicts_with("script") + conflicts_with("script"), + value_hint = ValueHint::Other, )] pub group: Option, @@ -4438,14 +4587,14 @@ pub struct RemoveArgs { pub refresh: RefreshArgs, /// Remove the dependencies from a specific package in the workspace. - #[arg(long, conflicts_with = "isolated")] + #[arg(long, conflicts_with = "isolated", value_hint = ValueHint::Other)] pub package: Option, /// Remove the dependency from the specified Python script, rather than from a project. /// /// If provided, uv will remove the dependency from the script's inline metadata table, in /// adherence with PEP 723. - #[arg(long)] + #[arg(long, value_hint = ValueHint::FilePath)] pub script: Option, /// The Python interpreter to use for resolving and syncing. @@ -4458,6 +4607,7 @@ pub struct RemoveArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, } @@ -4560,7 +4710,7 @@ pub struct TreeArgs { /// /// If provided, uv will resolve the dependencies based on its inline metadata table, in /// adherence with PEP 723. - #[arg(long)] + #[arg(long, value_hint = ValueHint::FilePath)] pub script: Option, /// The Python version to use when filtering the tree. @@ -4597,6 +4747,7 @@ pub struct TreeArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, } @@ -4626,7 +4777,7 @@ pub struct ExportArgs { /// Export the dependencies for specific packages in the workspace. /// /// If any workspace member does not exist, uv will exit with an error. - #[arg(long, conflicts_with = "all_packages")] + #[arg(long, conflicts_with = "all_packages", value_hint = ValueHint::Other)] pub package: Vec, /// Prune the given package from the dependency tree. @@ -4745,7 +4896,7 @@ pub struct ExportArgs { pub no_hashes: bool, /// Write the exported requirements to the given file. - #[arg(long, short)] + #[arg(long, short, value_hint = ValueHint::FilePath)] pub output_file: Option, /// Do not emit the current project. @@ -4826,7 +4977,8 @@ pub struct ExportArgs { #[arg( long, alias = "no-install-package", - conflicts_with = "only_emit_package" + conflicts_with = "only_emit_package", + value_hint = ValueHint::Other, )] pub no_emit_package: Vec, @@ -4835,7 +4987,8 @@ pub struct ExportArgs { long, alias = "only-install-package", conflicts_with = "no_emit_package", - hide = true + hide = true, + value_hint = ValueHint::Other, )] pub only_emit_package: Vec, @@ -4866,7 +5019,11 @@ pub struct ExportArgs { /// /// If provided, uv will resolve the dependencies based on its inline metadata table, in /// adherence with PEP 723. - #[arg(long, conflicts_with_all = ["all_packages", "package", "no_emit_project", "no_emit_workspace"])] + #[arg( + long, + conflicts_with_all = ["all_packages", "package", "no_emit_project", "no_emit_workspace"], + value_hint = ValueHint::FilePath, + )] pub script: Option, /// The Python interpreter to use during resolution. @@ -4885,6 +5042,7 @@ pub struct ExportArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, } @@ -4904,14 +5062,14 @@ pub struct FormatArgs { /// The version of Ruff to use for formatting. /// /// By default, a version of Ruff pinned by uv will be used. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub version: Option, /// Additional arguments to pass to Ruff. /// /// For example, use `uv format -- --line-length 100` to set the line length or /// `uv format -- src/module/foo.py` to format a specific file. - #[arg(last = true)] + #[arg(last = true, value_hint = ValueHint::Other)] pub extra_args: Vec, /// Avoid discovering a project or workspace. @@ -5061,11 +5219,11 @@ pub struct ToolRunArgs { /// Use the given package to provide the command. /// /// By default, the package name is assumed to match the command name. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub from: Option, /// Run with the given packages installed. - #[arg(short = 'w', long)] + #[arg(short = 'w', long, value_hint = ValueHint::Other)] pub with: Vec, /// Run with the given packages installed in editable mode @@ -5073,14 +5231,19 @@ pub struct ToolRunArgs { /// When used in a project, these dependencies will be layered on top of the uv tool's /// environment in a separate, ephemeral environment. These dependencies are allowed to conflict /// with those specified. - #[arg(long)] + #[arg(long, value_hint = ValueHint::DirPath)] pub with_editable: Vec, /// Run with the packages listed in the given files. /// /// The following formats are supported: `requirements.txt`, `.py` files with inline metadata, /// and `pylock.toml`. - #[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path)] + #[arg( + long, + value_delimiter = ',', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub with_requirements: Vec>, /// Constrain versions using the given requirements files. @@ -5090,7 +5253,15 @@ pub struct ToolRunArgs { /// trigger the installation of that package. /// /// This is equivalent to pip's `--constraint` option. - #[arg(long, short, alias = "constraint", env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "constraint", + env = EnvVars::UV_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub constraints: Vec>, /// Constrain build dependencies using the given requirements files when building source @@ -5099,7 +5270,15 @@ pub struct ToolRunArgs { /// Constraints files are `requirements.txt`-like files that only control the _version_ of a /// requirement that's installed. However, including a package in a constraints file will _not_ /// trigger the installation of that package. - #[arg(long, short, alias = "build-constraint", env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "build-constraint", + env = EnvVars::UV_BUILD_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub build_constraints: Vec>, /// Override versions using the given requirements files. @@ -5111,7 +5290,14 @@ pub struct ToolRunArgs { /// While constraints are _additive_, in that they're combined with the requirements of the /// constituent packages, overrides are _absolute_, in that they completely replace the /// requirements of the constituent packages. - #[arg(long, alias = "override", env = EnvVars::UV_OVERRIDE, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + alias = "override", + env = EnvVars::UV_OVERRIDE, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub overrides: Vec>, /// Run the tool in an isolated virtual environment, ignoring any already-installed tools. @@ -5122,7 +5308,7 @@ pub struct ToolRunArgs { /// /// Can be provided multiple times, with subsequent files overriding values defined in previous /// files. - #[arg(long, value_delimiter = ' ', env = EnvVars::UV_ENV_FILE)] + #[arg(long, value_delimiter = ' ', env = EnvVars::UV_ENV_FILE, value_hint = ValueHint::FilePath)] pub env_file: Vec, /// Avoid reading environment variables from a `.env` file. @@ -5152,6 +5338,7 @@ pub struct ToolRunArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -5201,23 +5388,24 @@ pub struct UvxArgs { #[derive(Args)] pub struct ToolInstallArgs { /// The package to install commands from. + #[arg(value_hint = ValueHint::Other)] pub package: String, /// The package to install commands from. /// /// This option is provided for parity with `uv tool run`, but is redundant with `package`. - #[arg(long, hide = true)] + #[arg(long, hide = true, value_hint = ValueHint::Other)] pub from: Option, /// Include the following additional requirements. - #[arg(short = 'w', long)] + #[arg(short = 'w', long, value_hint = ValueHint::Other)] pub with: Vec, /// Run with the packages listed in the given files. /// /// The following formats are supported: `requirements.txt`, `.py` files with inline metadata, /// and `pylock.toml`. - #[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path)] + #[arg(long, value_delimiter = ',', value_parser = parse_maybe_file_path, value_hint = ValueHint::FilePath)] pub with_requirements: Vec>, /// Install the target package in editable mode, such that changes in the package's source @@ -5226,11 +5414,11 @@ pub struct ToolInstallArgs { pub editable: bool, /// Include the given packages in editable mode. - #[arg(long)] + #[arg(long, value_hint = ValueHint::DirPath)] pub with_editable: Vec, /// Install executables from the following packages. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub with_executables_from: Vec, /// Constrain versions using the given requirements files. @@ -5240,7 +5428,15 @@ pub struct ToolInstallArgs { /// trigger the installation of that package. /// /// This is equivalent to pip's `--constraint` option. - #[arg(long, short, alias = "constraint", env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "constraint", + env = EnvVars::UV_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub constraints: Vec>, /// Override versions using the given requirements files. @@ -5252,7 +5448,14 @@ pub struct ToolInstallArgs { /// While constraints are _additive_, in that they're combined with the requirements of the /// constituent packages, overrides are _absolute_, in that they completely replace the /// requirements of the constituent packages. - #[arg(long, alias = "override", env = EnvVars::UV_OVERRIDE, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + alias = "override", + env = EnvVars::UV_OVERRIDE, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub overrides: Vec>, /// Exclude packages from resolution using the given requirements files. @@ -5262,7 +5465,14 @@ pub struct ToolInstallArgs { /// dependency list entirely and its own dependencies will be ignored during the resolution /// phase. Excludes are unconditional in that requirement specifiers and markers are ignored; /// any package listed in the provided file will be omitted from all resolved environments. - #[arg(long, alias = "exclude", env = EnvVars::UV_EXCLUDE, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + alias = "exclude", + env = EnvVars::UV_EXCLUDE, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub excludes: Vec>, /// Constrain build dependencies using the given requirements files when building source @@ -5271,7 +5481,15 @@ pub struct ToolInstallArgs { /// Constraints files are `requirements.txt`-like files that only control the _version_ of a /// requirement that's installed. However, including a package in a constraints file will _not_ /// trigger the installation of that package. - #[arg(long, short, alias = "build-constraint", env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)] + #[arg( + long, + short, + alias = "build-constraint", + env = EnvVars::UV_BUILD_CONSTRAINT, + value_delimiter = ' ', + value_parser = parse_maybe_file_path, + value_hint = ValueHint::FilePath, + )] pub build_constraints: Vec>, #[command(flatten)] @@ -5303,6 +5521,7 @@ pub struct ToolInstallArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -5381,7 +5600,7 @@ pub struct ToolDirArgs { #[derive(Args)] pub struct ToolUninstallArgs { /// The name of the tool to uninstall. - #[arg(required = true)] + #[arg(required = true, value_hint = ValueHint::Other)] pub name: Vec, /// Uninstall all tools. @@ -5392,7 +5611,7 @@ pub struct ToolUninstallArgs { #[derive(Args)] pub struct ToolUpgradeArgs { /// The name of the tool to upgrade, along with an optional version specifier. - #[arg(required = true)] + #[arg(required = true, value_hint = ValueHint::Other)] pub name: Vec, /// Upgrade all tools. @@ -5410,6 +5629,7 @@ pub struct ToolUpgradeArgs { verbatim_doc_comment, help_heading = "Python options", value_parser = parse_maybe_string, + value_hint = ValueHint::Other, )] pub python: Option>, @@ -5471,7 +5691,7 @@ pub struct ToolUpgradeArgs { /// Reinstall a specific package, regardless of whether it's already installed. Implies /// `--refresh-package`. - #[arg(long, help_heading = "Installer options")] + #[arg(long, help_heading = "Installer options", value_hint = ValueHint::Other)] pub reinstall_package: Vec, /// The strategy to use when resolving against multiple index URLs. @@ -5580,7 +5800,7 @@ pub struct ToolUpgradeArgs { /// Disable isolation when building source distributions for a specific package. /// /// Assumes that the packages' build dependencies specified by PEP 518 are already installed. - #[arg(long, help_heading = "Build options")] + #[arg(long, help_heading = "Build options", value_hint = ValueHint::Other)] pub no_build_isolation_package: Vec, #[arg( @@ -5841,7 +6061,7 @@ pub struct PythonListArgs { pub output_format: PythonListFormat, /// URL pointing to JSON of custom Python installations. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub python_downloads_json_url: Option, } @@ -5871,7 +6091,7 @@ pub struct PythonInstallArgs { /// /// See `uv python dir` to view the current Python installation directory. Defaults to /// `~/.local/share/uv/python`. - #[arg(long, short, env = EnvVars::UV_PYTHON_INSTALL_DIR)] + #[arg(long, short, env = EnvVars::UV_PYTHON_INSTALL_DIR, value_hint = ValueHint::DirPath)] pub install_dir: Option, /// Install a Python executable into the `bin` directory. @@ -5924,7 +6144,7 @@ pub struct PythonInstallArgs { /// `https://github.com/astral-sh/python-build-standalone/releases/download/20240713/cpython-3.12.4%2B20240713-aarch64-apple-darwin-install_only.tar.gz`. /// /// Distributions can be read from a local directory by using the `file://` URL scheme. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Url)] pub mirror: Option, /// Set the URL to use as the source for downloading PyPy installations. @@ -5933,11 +6153,11 @@ pub struct PythonInstallArgs { /// `https://downloads.python.org/pypy/pypy3.8-v7.3.7-osx64.tar.bz2`. /// /// Distributions can be read from a local directory by using the `file://` URL scheme. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Url)] pub pypy_mirror: Option, /// URL pointing to JSON of custom Python installations. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub python_downloads_json_url: Option, /// Reinstall the requested Python version, if it's already installed. @@ -6003,7 +6223,7 @@ pub struct PythonUpgradeArgs { /// /// See `uv python dir` to view the current Python installation directory. Defaults to /// `~/.local/share/uv/python`. - #[arg(long, short, env = EnvVars::UV_PYTHON_INSTALL_DIR)] + #[arg(long, short, env = EnvVars::UV_PYTHON_INSTALL_DIR, value_hint = ValueHint::DirPath)] pub install_dir: Option, /// The Python minor version(s) to upgrade. @@ -6019,7 +6239,7 @@ pub struct PythonUpgradeArgs { /// `https://github.com/astral-sh/python-build-standalone/releases/download/20240713/cpython-3.12.4%2B20240713-aarch64-apple-darwin-install_only.tar.gz`. /// /// Distributions can be read from a local directory by using the `file://` URL scheme. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Url)] pub mirror: Option, /// Set the URL to use as the source for downloading PyPy installations. @@ -6028,7 +6248,7 @@ pub struct PythonUpgradeArgs { /// `https://downloads.python.org/pypy/pypy3.8-v7.3.7-osx64.tar.bz2`. /// /// Distributions can be read from a local directory by using the `file://` URL scheme. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Url)] pub pypy_mirror: Option, /// Reinstall the latest Python patch, if it's already installed. @@ -6039,7 +6259,7 @@ pub struct PythonUpgradeArgs { pub reinstall: bool, /// URL pointing to JSON of custom Python installations. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub python_downloads_json_url: Option, } @@ -6057,7 +6277,7 @@ impl PythonUpgradeArgs { #[derive(Args)] pub struct PythonUninstallArgs { /// The directory where the Python was installed. - #[arg(long, short, env = EnvVars::UV_PYTHON_INSTALL_DIR)] + #[arg(long, short, env = EnvVars::UV_PYTHON_INSTALL_DIR, value_hint = ValueHint::DirPath)] pub install_dir: Option, /// The Python version(s) to uninstall. @@ -6110,7 +6330,8 @@ pub struct PythonFindArgs { conflicts_with = "request", conflicts_with = "no_project", conflicts_with = "system", - conflicts_with = "no_system" + conflicts_with = "no_system", + value_hint = ValueHint::FilePath, )] pub script: Option, @@ -6119,7 +6340,7 @@ pub struct PythonFindArgs { pub show_version: bool, /// URL pointing to JSON of custom Python installations. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub python_downloads_json_url: Option, } @@ -6177,7 +6398,7 @@ pub struct AuthLogoutArgs { pub service: Service, /// The username to logout. - #[arg(long, short)] + #[arg(long, short, value_hint = ValueHint::Other)] pub username: Option, /// The keyring provider to use for storage of credentials. @@ -6195,16 +6416,17 @@ pub struct AuthLogoutArgs { #[derive(Args)] pub struct AuthLoginArgs { /// The domain or URL of the service to log into. + #[arg(value_hint = ValueHint::Url)] pub service: Service, /// The username to use for the service. - #[arg(long, short, conflicts_with = "token")] + #[arg(long, short, conflicts_with = "token", value_hint = ValueHint::Other)] pub username: Option, /// The password to use for the service. /// /// Use `-` to read the password from stdin. - #[arg(long, conflicts_with = "token")] + #[arg(long, conflicts_with = "token", value_hint = ValueHint::Other)] pub password: Option, /// The token to use for the service. @@ -6212,7 +6434,7 @@ pub struct AuthLoginArgs { /// The username will be set to `__token__`. /// /// Use `-` to read the token from stdin. - #[arg(long, short, conflicts_with = "username", conflicts_with = "password")] + #[arg(long, short, conflicts_with = "username", conflicts_with = "password", value_hint = ValueHint::Other)] pub token: Option, /// The keyring provider to use for storage of credentials. @@ -6230,10 +6452,11 @@ pub struct AuthLoginArgs { #[derive(Args)] pub struct AuthTokenArgs { /// The domain or URL of the service to lookup. + #[arg(value_hint = ValueHint::Url)] pub service: Service, /// The username to lookup. - #[arg(long, short)] + #[arg(long, short, value_hint = ValueHint::Other)] pub username: Option, /// The keyring provider to use for reading credentials. @@ -6248,6 +6471,7 @@ pub struct AuthTokenArgs { #[derive(Args)] pub struct AuthDirArgs { /// The domain or URL of the service to lookup. + #[arg(value_hint = ValueHint::Url)] pub service: Option, } @@ -6411,7 +6635,7 @@ pub struct RefreshArgs { pub no_refresh: bool, /// Refresh cached data for a specific package. - #[arg(long, help_heading = "Cache options")] + #[arg(long, help_heading = "Cache options", value_hint = ValueHint::Other)] pub refresh_package: Vec, } @@ -6440,7 +6664,13 @@ pub struct BuildOptionsArgs { pub build: bool, /// Don't build source distributions for a specific package. - #[arg(long, help_heading = "Build options", env = EnvVars::UV_NO_BUILD_PACKAGE, value_delimiter = ' ')] + #[arg( + long, + help_heading = "Build options", + env = EnvVars::UV_NO_BUILD_PACKAGE, + value_delimiter = ' ', + value_hint = ValueHint::Other, + )] pub no_build_package: Vec, /// Don't install pre-built wheels. @@ -6465,7 +6695,13 @@ pub struct BuildOptionsArgs { pub binary: bool, /// Don't install pre-built wheels for a specific package. - #[arg(long, help_heading = "Build options", env = EnvVars::UV_NO_BINARY_PACKAGE, value_delimiter = ' ')] + #[arg( + long, + help_heading = "Build options", + env = EnvVars::UV_NO_BINARY_PACKAGE, + value_delimiter = ' ', + value_hint = ValueHint::Other, + )] pub no_binary_package: Vec, } @@ -6495,7 +6731,7 @@ pub struct InstallerArgs { /// Reinstall a specific package, regardless of whether it's already installed. Implies /// `--refresh-package`. - #[arg(long, help_heading = "Installer options")] + #[arg(long, help_heading = "Installer options", value_hint = ValueHint::Other)] pub reinstall_package: Vec, /// The strategy to use when resolving against multiple index URLs. @@ -6786,7 +7022,7 @@ pub struct ResolverArgs { /// Disable isolation when building source distributions for a specific package. /// /// Assumes that the packages' build dependencies specified by PEP 518 are already installed. - #[arg(long, help_heading = "Build options")] + #[arg(long, help_heading = "Build options", value_hint = ValueHint::Other)] pub no_build_isolation_package: Vec, #[arg( @@ -6884,7 +7120,7 @@ pub struct ResolverInstallerArgs { /// Allow upgrades for a specific package, ignoring pinned versions in any existing output file. /// Implies `--refresh-package`. - #[arg(long, short = 'P', help_heading = "Resolver options")] + #[arg(long, short = 'P', help_heading = "Resolver options", value_hint = ValueHint::Other)] pub upgrade_package: Vec>, /// Reinstall all packages, regardless of whether they're already installed. Implies @@ -6907,7 +7143,7 @@ pub struct ResolverInstallerArgs { /// Reinstall a specific package, regardless of whether it's already installed. Implies /// `--refresh-package`. - #[arg(long, help_heading = "Installer options")] + #[arg(long, help_heading = "Installer options", value_hint = ValueHint::Other)] pub reinstall_package: Vec, /// The strategy to use when resolving against multiple index URLs. @@ -6989,7 +7225,8 @@ pub struct ResolverInstallerArgs { long, short = 'C', alias = "config-settings", - help_heading = "Build options" + help_heading = "Build options", + value_hint = ValueHint::Other, )] pub config_setting: Option>, @@ -6997,7 +7234,8 @@ pub struct ResolverInstallerArgs { #[arg( long, alias = "config-settings-package", - help_heading = "Build options" + help_heading = "Build options", + value_hint = ValueHint::Other, )] pub config_settings_package: Option>, @@ -7016,7 +7254,7 @@ pub struct ResolverInstallerArgs { /// Disable isolation when building source distributions for a specific package. /// /// Assumes that the packages' build dependencies specified by PEP 518 are already installed. - #[arg(long, help_heading = "Build options")] + #[arg(long, help_heading = "Build options", value_hint = ValueHint::Other)] pub no_build_isolation_package: Vec, #[arg( @@ -7037,7 +7275,12 @@ pub struct ResolverInstallerArgs { /// Durations do not respect semantics of the local time zone and are always resolved to a fixed /// number of seconds assuming that a day is 24 hours (e.g., DST transitions are ignored). /// Calendar units such as months and years are not allowed. - #[arg(long, env = EnvVars::UV_EXCLUDE_NEWER, help_heading = "Resolver options")] + #[arg( + long, + env = EnvVars::UV_EXCLUDE_NEWER, + help_heading = "Resolver options", + value_hint = ValueHint::Other, + )] pub exclude_newer: Option, /// Limit candidate packages for specific packages to those that were uploaded prior to the @@ -7054,7 +7297,7 @@ pub struct ResolverInstallerArgs { /// Calendar units such as months and years are not allowed. /// /// Can be provided multiple times for different packages. - #[arg(long, help_heading = "Resolver options")] + #[arg(long, help_heading = "Resolver options", value_hint = ValueHint::Other)] pub exclude_newer_package: Option>, /// The method to use when installing packages from the global cache. @@ -7170,11 +7413,11 @@ pub struct DisplayTreeArgs { pub depth: u8, /// Prune the given package from the display of the dependency tree. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub prune: Vec, /// Display only the specified packages. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub package: Vec, /// Do not de-duplicate repeated dependencies. Usually, when a package has already displayed its @@ -7204,7 +7447,7 @@ pub struct PublishArgs { /// /// Defaults to the `dist` directory. Selects only wheels and source distributions /// and their attestations, while ignoring other files. - #[arg(default_value = "dist/*")] + #[arg(default_value = "dist/*", value_hint = ValueHint::FilePath)] pub files: Vec, /// The name of an index in the configuration to use for publishing. @@ -7231,16 +7474,17 @@ pub struct PublishArgs { verbatim_doc_comment, env = EnvVars::UV_PUBLISH_INDEX, conflicts_with = "publish_url", - conflicts_with = "check_url" + conflicts_with = "check_url", + value_hint = ValueHint::Other, )] pub index: Option, /// The username for the upload. - #[arg(short, long, env = EnvVars::UV_PUBLISH_USERNAME)] + #[arg(short, long, env = EnvVars::UV_PUBLISH_USERNAME, value_hint = ValueHint::Other)] pub username: Option, /// The password for the upload. - #[arg(short, long, env = EnvVars::UV_PUBLISH_PASSWORD)] + #[arg(short, long, env = EnvVars::UV_PUBLISH_PASSWORD, value_hint = ValueHint::Other)] pub password: Option, /// The token for the upload. @@ -7252,7 +7496,8 @@ pub struct PublishArgs { long, env = EnvVars::UV_PUBLISH_TOKEN, conflicts_with = "username", - conflicts_with = "password" + conflicts_with = "password", + value_hint = ValueHint::Other, )] pub token: Option, @@ -7350,7 +7595,7 @@ pub struct MetadataArgs; #[derive(Args, Debug)] pub struct WorkspaceDirArgs { /// Display the path to a specific package in the workspace. - #[arg(long)] + #[arg(long, value_hint = ValueHint::Other)] pub package: Option, }