Add dedicated help menu for uvx (#4770)

Closes #4749
This commit is contained in:
Zanie Blue 2024-07-03 12:38:54 -04:00 committed by GitHub
parent c0875fd8fe
commit 1c6c8db1a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 4 deletions

View file

@ -1902,9 +1902,16 @@ pub struct ToolNamespace {
#[derive(Subcommand)]
pub enum ToolCommand {
/// Run a tool
/// Run a tool.
Run(ToolRunArgs),
/// Install a tool
/// Hidden alias for `uv tool run` for invocation from the `uvx` command
#[command(
hide = true,
override_usage = "uvx [OPTIONS] <COMMAND>",
about = "Run a tool."
)]
Uvx(ToolRunArgs),
/// Install a tool.
Install(ToolInstallArgs),
/// List installed tools.
List(ToolListArgs),

View file

@ -11,7 +11,7 @@ fn run() -> Result<ExitStatus, anyhow::Error> {
bail!("Could not determine the location of the `uvx` binary")
};
let uv = bin.join("uv");
let args = ["tool", "run"]
let args = ["tool", "uvx"]
.iter()
.map(OsString::from)
// Skip the `uvx` name

View file

@ -785,7 +785,7 @@ async fn run() -> Result<ExitStatus> {
Ok(ExitStatus::Success)
}
Commands::Tool(ToolNamespace {
command: ToolCommand::Run(args),
command: ToolCommand::Run(args) | ToolCommand::Uvx(args),
}) => {
// Resolve the settings from the command-line arguments and workspace configuration.
let args = settings::ToolRunSettings::resolve(args, filesystem);