Allow the package spec to be passed positionally in uv tool install (#4564)

Moves `--from` to a hidden argument — we allow it still but we validate
that it is compatible with whatever is passed to `uv tool install
<package>`. The positional package can now be a full specification,
allowing things like `uv tool install black==24.2.0`.
This commit is contained in:
Zanie Blue 2024-06-27 08:35:00 -04:00 committed by GitHub
parent f7fb5a4061
commit 7c3ad62544
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 192 additions and 25 deletions

View file

@ -1908,13 +1908,13 @@ pub struct ToolRunArgs {
#[derive(Args)]
#[allow(clippy::struct_excessive_bools)]
pub struct ToolInstallArgs {
/// The command to install.
pub name: String,
/// The package to install commands from.
pub package: String,
/// Use the given package to provide the command.
/// The package to install commands from.
///
/// By default, the package name is assumed to match the command name.
#[arg(long)]
/// This option is provided for parity with `uv tool run`, but is redundant with `package`.
#[arg(long, hide = true)]
pub from: Option<String>,
/// Include the following extra requirements.