Skip to content

Commit

Permalink
feat: add -g short version for unuse cmd (#4330)
Browse files Browse the repository at this point in the history
For consistency with the inverse command 'use'.
  • Loading branch information
kimle authored Feb 6, 2025
1 parent c1f69f4 commit e11027a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Can also use `MISE_NO_CONFIG=1`
- [`mise trust [FLAGS] [CONFIG_FILE]`](/cli/trust.md)
- [`mise uninstall [-a --all] [-n --dry-run] [INSTALLED_TOOL@VERSION]...`](/cli/uninstall.md)
- [`mise unset [-f --file <FILE>] [-g --global] [ENV_KEY]...`](/cli/unset.md)
- [`mise unuse [--no-prune] [--global] <INSTALLED_TOOL@VERSION>...`](/cli/unuse.md)
- [`mise unuse [--no-prune] [-g --global] <INSTALLED_TOOL@VERSION>...`](/cli/unuse.md)
- [`mise upgrade [FLAGS] [TOOL@VERSION]...`](/cli/upgrade.md)
- [`mise use [FLAGS] [TOOL@VERSION]...`](/cli/use.md)
- [`mise version [-J --json]`](/cli/version.md)
Expand Down
9 changes: 6 additions & 3 deletions docs/cli/unuse.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `mise unuse`

- **Usage**: `mise unuse [--no-prune] [--global] <INSTALLED_TOOL@VERSION>...`
- **Usage**: `mise unuse [--no-prune] [-g --global] <INSTALLED_TOOL@VERSION>...`
- **Aliases**: `rm`, `remove`
- **Source code**: [`src/cli/unuse.rs`](https://github.com/jdx/mise/blob/main/src/cli/unuse.rs)

Expand All @@ -20,13 +20,16 @@ Tool(s) to remove

Do not also prune the installed version

### `--global`
### `-g --global`

Remove tool from global config

Examples:

```
# will uninstall specific version
$ mise remove [email protected]
$ mise unuse [email protected]
# will uninstall specific version from global config
$ mise unuse -g [email protected]
```
4 changes: 2 additions & 2 deletions mise.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -903,9 +903,9 @@ cmd unset help="Remove environment variable(s) from the config file." {
cmd unuse help="Removes installed tool versions from mise.toml" {
alias rm remove
long_help "Removes installed tool versions from mise.toml\n\nWill also prune the installed version if no other configurations are using it."
after_long_help "Examples:\n\n # will uninstall specific version\n $ mise remove [email protected]\n"
after_long_help "Examples:\n\n # will uninstall specific version\n $ mise unuse [email protected]\n\n # will uninstall specific version from global config\n $ mise unuse -g [email protected]\n"
flag --no-prune help="Do not also prune the installed version"
flag --global help="Remove tool from global config"
flag "-g --global" help="Remove tool from global config"
arg <INSTALLED_TOOL@VERSION>... help="Tool(s) to remove" var=#true
}
cmd upgrade help="Upgrades outdated tools" {
Expand Down
7 changes: 5 additions & 2 deletions src/cli/unuse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Unuse {
no_prune: bool,

/// Remove tool from global config
#[clap(long)]
#[clap(short, long)]
global: bool,
}

Expand Down Expand Up @@ -81,6 +81,9 @@ static AFTER_LONG_HELP: &str = color_print::cstr!(
r#"<bold><underline>Examples:</underline></bold>
# will uninstall specific version
$ <bold>mise remove [email protected]</bold>
$ <bold>mise unuse [email protected]</bold>
# will uninstall specific version from global config
$ <bold>mise unuse -g [email protected]</bold>
"#
);
2 changes: 1 addition & 1 deletion xtasks/fig/src/mise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2673,7 +2673,7 @@ const completionSpec: Fig.Spec = {
isRepeatable: false,
},
{
name: "--global",
name: ["-g", "--global"],
description: "Remove tool from global config",
isRepeatable: false,
},
Expand Down

0 comments on commit e11027a

Please sign in to comment.