From 90995f9f409994a0802311818790d2d039f33083 Mon Sep 17 00:00:00 2001 From: jdx <216188+jdx@users.noreply.github.com> Date: Wed, 14 Jan 2026 12:05:42 -0600 Subject: [PATCH] feat(cli): use installed_tool completer for mise upgrade Changes the `mise upgrade` command to use `INSTALLED_TOOL@VERSION` instead of `TOOL@VERSION` for shell completions. This makes more sense since you can only upgrade tools that are already installed. The `installed_tool@version` completer shows only installed tools (including non-registry tools like `aqua:foo/bar`), which is the correct behavior for the upgrade command. Resolves: https://github.com/jdx/mise/discussions/7648 Co-Authored-By: Claude Opus 4.5 --- docs/cli/index.md | 2 +- docs/cli/upgrade.md | 4 ++-- man/man1/mise.1 | 4 ++-- mise.usage.kdl | 2 +- src/cli/upgrade.rs | 2 +- xtasks/fig/src/mise.ts | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/cli/index.md b/docs/cli/index.md index 612d99c445..e8f051cbab 100644 --- a/docs/cli/index.md +++ b/docs/cli/index.md @@ -170,7 +170,7 @@ Can also use `MISE_NO_HOOKS=1` - [`mise uninstall [-a --all] [-n --dry-run] [INSTALLED_TOOL@VERSION]…`](/cli/uninstall.md) - [`mise unset [-f --file ] [-g --global] [ENV_KEY]…`](/cli/unset.md) - [`mise unuse [FLAGS] …`](/cli/unuse.md) -- [`mise upgrade [FLAGS] [TOOL@VERSION]…`](/cli/upgrade.md) +- [`mise upgrade [FLAGS] [INSTALLED_TOOL@VERSION]…`](/cli/upgrade.md) - [`mise use [FLAGS] [TOOL@VERSION]…`](/cli/use.md) - [`mise version [-J --json]`](/cli/version.md) - [`mise watch [FLAGS] [TASK] [ARGS]…`](/cli/watch.md) diff --git a/docs/cli/upgrade.md b/docs/cli/upgrade.md index 35720ce110..382077de1c 100644 --- a/docs/cli/upgrade.md +++ b/docs/cli/upgrade.md @@ -1,7 +1,7 @@ # `mise upgrade` -- **Usage**: `mise upgrade [FLAGS] [TOOL@VERSION]…` +- **Usage**: `mise upgrade [FLAGS] [INSTALLED_TOOL@VERSION]…` - **Aliases**: `up` - **Source code**: [`src/cli/upgrade.rs`](https://github.com/jdx/mise/blob/main/src/cli/upgrade.rs) @@ -15,7 +15,7 @@ This will update mise.lock if it is enabled, see ] ... +\fBUsage:\fR mise upgrade [OPTIONS] [] ... .PP \fBOptions:\fR .PP @@ -2862,7 +2862,7 @@ Directly pipe stdin/stdout/stderr from plugin to user Sets \-\-jobs=1 \fBArguments:\fR .PP .TP -\fB\fR +\fB\fR Tool(s) to upgrade e.g.: node@20 python@3.10 If not specified, all current tools will be upgraded diff --git a/mise.usage.kdl b/mise.usage.kdl index 745fa24689..0ef4fa7c1a 100644 --- a/mise.usage.kdl +++ b/mise.usage.kdl @@ -1129,7 +1129,7 @@ cmd upgrade help="Upgrades outdated tools" { arg } flag --raw help="Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1" - arg "[TOOL@VERSION]…" help="Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded" required=#false var=#true + arg "[INSTALLED_TOOL@VERSION]…" help="Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded" required=#false var=#true } cmd usage hide=#true help="Generate a usage CLI spec" { long_help "Generate a usage CLI spec\n\nSee https://usage.jdx.dev for more information on this specification." diff --git a/src/cli/upgrade.rs b/src/cli/upgrade.rs index 61da4002ee..79cd936d54 100644 --- a/src/cli/upgrade.rs +++ b/src/cli/upgrade.rs @@ -28,7 +28,7 @@ pub struct Upgrade { /// Tool(s) to upgrade /// e.g.: node@20 python@3.10 /// If not specified, all current tools will be upgraded - #[clap(value_name = "TOOL@VERSION", verbatim_doc_comment)] + #[clap(value_name = "INSTALLED_TOOL@VERSION", verbatim_doc_comment)] tool: Vec, /// Display multiselect menu to choose which tools to upgrade diff --git a/xtasks/fig/src/mise.ts b/xtasks/fig/src/mise.ts index 2dcdd486be..c5d280d761 100644 --- a/xtasks/fig/src/mise.ts +++ b/xtasks/fig/src/mise.ts @@ -3286,12 +3286,12 @@ const completionSpec: Fig.Spec = { }, ], args: { - name: "tool@version", + name: "installed_tool@version", description: "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", isOptional: true, isVariadic: true, - generators: toolVersionGenerator, + generators: installedToolVersionGenerator, debounce: true, }, },