diff --git a/docs/.vitepress/cli_commands.ts b/docs/.vitepress/cli_commands.ts index 12b8a787f3..3197626ecc 100644 --- a/docs/.vitepress/cli_commands.ts +++ b/docs/.vitepress/cli_commands.ts @@ -11,23 +11,6 @@ export const commands: { [key: string]: Command } = { activate: { hide: false, }, - alias: { - hide: false, - subcommands: { - get: { - hide: false, - }, - ls: { - hide: false, - }, - set: { - hide: false, - }, - unset: { - hide: false, - }, - }, - }, asdf: { hide: true, }, @@ -260,6 +243,23 @@ export const commands: { [key: string]: Command } = { shell: { hide: false, }, + "shell-alias": { + hide: false, + subcommands: { + get: { + hide: false, + }, + ls: { + hide: false, + }, + set: { + hide: false, + }, + unset: { + hide: false, + }, + }, + }, sync: { hide: false, subcommands: { @@ -306,6 +306,23 @@ export const commands: { [key: string]: Command } = { tool: { hide: false, }, + "tool-alias": { + hide: false, + subcommands: { + get: { + hide: false, + }, + ls: { + hide: false, + }, + set: { + hide: false, + }, + unset: { + hide: false, + }, + }, + }, "tool-stub": { hide: false, }, diff --git a/docs/cli/alias.md b/docs/cli/alias.md deleted file mode 100644 index 989c7978f2..0000000000 --- a/docs/cli/alias.md +++ /dev/null @@ -1,25 +0,0 @@ - -# `mise alias` - -- **Usage**: `mise alias [-p --plugin ] [--no-header] ` -- **Aliases**: `a` -- **Source code**: [`src/cli/alias/mod.rs`](https://github.com/jdx/mise/blob/main/src/cli/alias/mod.rs) - -Manage version aliases. - -## Flags - -### `-p --plugin ` - -filter aliases by plugin - -### `--no-header` - -Don't show table header - -## Subcommands - -- [`mise alias get `](/cli/alias/get.md) -- [`mise alias ls [--no-header] [TOOL]`](/cli/alias/ls.md) -- [`mise alias set …`](/cli/alias/set.md) -- [`mise alias unset [ALIAS]`](/cli/alias/unset.md) diff --git a/docs/cli/alias/get.md b/docs/cli/alias/get.md deleted file mode 100644 index 1f7cf4fef6..0000000000 --- a/docs/cli/alias/get.md +++ /dev/null @@ -1,26 +0,0 @@ - -# `mise alias get` - -- **Usage**: `mise alias get ` -- **Source code**: [`src/cli/alias/get.rs`](https://github.com/jdx/mise/blob/main/src/cli/alias/get.rs) - -Show an alias for a plugin - -This is the contents of an alias.<PLUGIN> entry in ~/.config/mise/config.toml - -## Arguments - -### `` - -The plugin to show the alias for - -### `` - -The alias to show - -Examples: - -``` -$ mise alias get node lts-hydrogen -20.0.0 -``` diff --git a/docs/cli/index.md b/docs/cli/index.md index aaac5a215e..fb2f74c686 100644 --- a/docs/cli/index.md +++ b/docs/cli/index.md @@ -68,11 +68,11 @@ Can also use `MISE_NO_CONFIG=1` ## Subcommands - [`mise activate [FLAGS] [SHELL_TYPE]`](/cli/activate.md) -- [`mise alias [-p --plugin ] [--no-header] `](/cli/alias.md) -- [`mise alias get `](/cli/alias/get.md) -- [`mise alias ls [--no-header] [TOOL]`](/cli/alias/ls.md) -- [`mise alias set …`](/cli/alias/set.md) -- [`mise alias unset [ALIAS]`](/cli/alias/unset.md) +- [`mise tool-alias [-p --plugin ] [--no-header] `](/cli/tool-alias.md) +- [`mise tool-alias get `](/cli/tool-alias/get.md) +- [`mise tool-alias ls [--no-header] [TOOL]`](/cli/tool-alias/ls.md) +- [`mise tool-alias set …`](/cli/tool-alias/set.md) +- [`mise tool-alias unset [ALIAS]`](/cli/tool-alias/unset.md) - [`mise backends `](/cli/backends.md) - [`mise backends ls`](/cli/backends/ls.md) - [`mise bin-paths [TOOL@VERSION]…`](/cli/bin-paths.md) @@ -134,6 +134,11 @@ Can also use `MISE_NO_CONFIG=1` - [`mise settings set [-l --local] `](/cli/settings/set.md) - [`mise settings unset [-l --local] `](/cli/settings/unset.md) - [`mise shell [FLAGS] …`](/cli/shell.md) +- [`mise shell-alias [--no-header] `](/cli/shell-alias.md) +- [`mise shell-alias get `](/cli/shell-alias/get.md) +- [`mise shell-alias ls [--no-header]`](/cli/shell-alias/ls.md) +- [`mise shell-alias set `](/cli/shell-alias/set.md) +- [`mise shell-alias unset `](/cli/shell-alias/unset.md) - [`mise sync `](/cli/sync.md) - [`mise sync node [FLAGS]`](/cli/sync/node.md) - [`mise sync python [--pyenv] [--uv]`](/cli/sync/python.md) diff --git a/docs/cli/shell-alias.md b/docs/cli/shell-alias.md new file mode 100644 index 0000000000..0858fb2bb1 --- /dev/null +++ b/docs/cli/shell-alias.md @@ -0,0 +1,20 @@ + +# `mise shell-alias` + +- **Usage**: `mise shell-alias [--no-header] ` +- **Source code**: [`src/cli/shell_alias/mod.rs`](https://github.com/jdx/mise/blob/main/src/cli/shell_alias/mod.rs) + +Manage shell aliases. + +## Flags + +### `--no-header` + +Don't show table header + +## Subcommands + +- [`mise shell-alias get `](/cli/shell-alias/get.md) +- [`mise shell-alias ls [--no-header]`](/cli/shell-alias/ls.md) +- [`mise shell-alias set `](/cli/shell-alias/set.md) +- [`mise shell-alias unset `](/cli/shell-alias/unset.md) diff --git a/docs/cli/shell-alias/get.md b/docs/cli/shell-alias/get.md new file mode 100644 index 0000000000..7680dbed56 --- /dev/null +++ b/docs/cli/shell-alias/get.md @@ -0,0 +1,20 @@ + +# `mise shell-alias get` + +- **Usage**: `mise shell-alias get ` +- **Source code**: [`src/cli/shell_alias/get.rs`](https://github.com/jdx/mise/blob/main/src/cli/shell_alias/get.rs) + +Show the command for a shell alias + +## Arguments + +### `` + +The alias to show + +Examples: + +``` +$ mise shell-alias get ll +ls -la +``` diff --git a/docs/cli/shell-alias/ls.md b/docs/cli/shell-alias/ls.md new file mode 100644 index 0000000000..1ba6309968 --- /dev/null +++ b/docs/cli/shell-alias/ls.md @@ -0,0 +1,26 @@ + +# `mise shell-alias ls` + +- **Usage**: `mise shell-alias ls [--no-header]` +- **Aliases**: `list` +- **Source code**: [`src/cli/shell_alias/ls.rs`](https://github.com/jdx/mise/blob/main/src/cli/shell_alias/ls.rs) + +List shell aliases + +Shows the shell aliases that are set in the current directory. +These are defined in `mise.toml` under the `[shell_alias]` section. + +## Flags + +### `--no-header` + +Don't show table header + +Examples: + +``` +$ mise shell-alias ls +alias command +ll ls -la +gs git status +``` diff --git a/docs/cli/shell-alias/set.md b/docs/cli/shell-alias/set.md new file mode 100644 index 0000000000..514b6aae91 --- /dev/null +++ b/docs/cli/shell-alias/set.md @@ -0,0 +1,27 @@ + +# `mise shell-alias set` + +- **Usage**: `mise shell-alias set ` +- **Aliases**: `add`, `create` +- **Source code**: [`src/cli/shell_alias/set.rs`](https://github.com/jdx/mise/blob/main/src/cli/shell_alias/set.rs) + +Add/update a shell alias + +This modifies the contents of ~/.config/mise/config.toml + +## Arguments + +### `` + +The alias name + +### `` + +The command to run + +Examples: + +``` +mise shell-alias set ll "ls -la" +mise shell-alias set gs "git status" +``` diff --git a/docs/cli/shell-alias/unset.md b/docs/cli/shell-alias/unset.md new file mode 100644 index 0000000000..174870d82d --- /dev/null +++ b/docs/cli/shell-alias/unset.md @@ -0,0 +1,22 @@ + +# `mise shell-alias unset` + +- **Usage**: `mise shell-alias unset ` +- **Aliases**: `rm`, `remove`, `delete`, `del` +- **Source code**: [`src/cli/shell_alias/unset.rs`](https://github.com/jdx/mise/blob/main/src/cli/shell_alias/unset.rs) + +Removes a shell alias + +This modifies the contents of ~/.config/mise/config.toml + +## Arguments + +### `` + +The alias to remove + +Examples: + +``` +mise shell-alias unset ll +``` diff --git a/docs/cli/tool-alias.md b/docs/cli/tool-alias.md new file mode 100644 index 0000000000..33488651de --- /dev/null +++ b/docs/cli/tool-alias.md @@ -0,0 +1,24 @@ + +# `mise tool-alias` + +- **Usage**: `mise tool-alias [-p --plugin ] [--no-header] ` +- **Source code**: [`src/cli/tool_alias/mod.rs`](https://github.com/jdx/mise/blob/main/src/cli/tool_alias/mod.rs) + +Manage tool version aliases. + +## Flags + +### `-p --plugin ` + +filter aliases by plugin + +### `--no-header` + +Don't show table header + +## Subcommands + +- [`mise tool-alias get `](/cli/tool-alias/get.md) +- [`mise tool-alias ls [--no-header] [TOOL]`](/cli/tool-alias/ls.md) +- [`mise tool-alias set …`](/cli/tool-alias/set.md) +- [`mise tool-alias unset [ALIAS]`](/cli/tool-alias/unset.md) diff --git a/docs/cli/tool-alias/get.md b/docs/cli/tool-alias/get.md new file mode 100644 index 0000000000..f3bafb6bab --- /dev/null +++ b/docs/cli/tool-alias/get.md @@ -0,0 +1,26 @@ + +# `mise tool-alias get` + +- **Usage**: `mise tool-alias get ` +- **Source code**: [`src/cli/tool_alias/get.rs`](https://github.com/jdx/mise/blob/main/src/cli/tool_alias/get.rs) + +Show an alias for a plugin + +This is the contents of a tool_alias.<PLUGIN> entry in ~/.config/mise/config.toml + +## Arguments + +### `` + +The plugin to show the alias for + +### `` + +The alias to show + +Examples: + +``` +$ mise tool-alias get node lts-hydrogen +20.0.0 +``` diff --git a/docs/cli/alias/ls.md b/docs/cli/tool-alias/ls.md similarity index 63% rename from docs/cli/alias/ls.md rename to docs/cli/tool-alias/ls.md index 7e4792bb9d..4de565a282 100644 --- a/docs/cli/alias/ls.md +++ b/docs/cli/tool-alias/ls.md @@ -1,18 +1,18 @@ -# `mise alias ls` +# `mise tool-alias ls` -- **Usage**: `mise alias ls [--no-header] [TOOL]` +- **Usage**: `mise tool-alias ls [--no-header] [TOOL]` - **Aliases**: `list` -- **Source code**: [`src/cli/alias/ls.rs`](https://github.com/jdx/mise/blob/main/src/cli/alias/ls.rs) +- **Source code**: [`src/cli/tool_alias/ls.rs`](https://github.com/jdx/mise/blob/main/src/cli/tool_alias/ls.rs) -List aliases +List tool version aliases Shows the aliases that can be specified. These can come from user config or from plugins in `bin/list-aliases`. For user config, aliases are defined like the following in `~/.config/mise/config.toml`: ``` -[alias.node.versions] +[tool_alias.node.versions] lts = "22.0.0" ``` @@ -31,6 +31,6 @@ Don't show table header Examples: ``` -$ mise aliases +$ mise tool-alias ls node lts-jod 22 ``` diff --git a/docs/cli/alias/set.md b/docs/cli/tool-alias/set.md similarity index 55% rename from docs/cli/alias/set.md rename to docs/cli/tool-alias/set.md index 5e35330e89..cb3c489a4b 100644 --- a/docs/cli/alias/set.md +++ b/docs/cli/tool-alias/set.md @@ -1,9 +1,9 @@ -# `mise alias set` +# `mise tool-alias set` -- **Usage**: `mise alias set …` +- **Usage**: `mise tool-alias set …` - **Aliases**: `add`, `create` -- **Source code**: [`src/cli/alias/set.rs`](https://github.com/jdx/mise/blob/main/src/cli/alias/set.rs) +- **Source code**: [`src/cli/tool_alias/set.rs`](https://github.com/jdx/mise/blob/main/src/cli/tool_alias/set.rs) Add/update an alias for a backend/plugin @@ -26,6 +26,6 @@ The value to set the alias to Examples: ``` -mise alias set maven asdf:mise-plugins/mise-maven -mise alias set node lts-jod 22.0.0 +mise tool-alias set maven asdf:mise-plugins/mise-maven +mise tool-alias set node lts-jod 22.0.0 ``` diff --git a/docs/cli/alias/unset.md b/docs/cli/tool-alias/unset.md similarity index 55% rename from docs/cli/alias/unset.md rename to docs/cli/tool-alias/unset.md index ea0b0ba0ad..e3cd15fd6f 100644 --- a/docs/cli/alias/unset.md +++ b/docs/cli/tool-alias/unset.md @@ -1,9 +1,9 @@ -# `mise alias unset` +# `mise tool-alias unset` -- **Usage**: `mise alias unset [ALIAS]` +- **Usage**: `mise tool-alias unset [ALIAS]` - **Aliases**: `rm`, `remove`, `delete`, `del` -- **Source code**: [`src/cli/alias/unset.rs`](https://github.com/jdx/mise/blob/main/src/cli/alias/unset.rs) +- **Source code**: [`src/cli/tool_alias/unset.rs`](https://github.com/jdx/mise/blob/main/src/cli/tool_alias/unset.rs) Clears an alias for a backend/plugin @@ -22,6 +22,6 @@ The alias to remove Examples: ``` -mise alias unset maven -mise alias unset node lts-jod +mise tool-alias unset maven +mise tool-alias unset node lts-jod ``` diff --git a/man/man1/mise.1 b/man/man1/mise.1 index ab9e11fd1b..b345f514aa 100644 --- a/man/man1/mise.1 +++ b/man/man1/mise.1 @@ -101,28 +101,25 @@ Task arguments \fBactivate\fR Initializes mise in the current shell session .TP -\fBalias\fR -Manage version aliases. -.RS -\fIAliases: \fRa -.RE +\fBtool\-alias\fR +Manage tool version aliases. .TP -\fBalias get\fR +\fBtool\-alias get\fR Show an alias for a plugin .TP -\fBalias ls\fR -List aliases +\fBtool\-alias ls\fR +List tool version aliases .RS \fIAliases: \fRlist .RE .TP -\fBalias set\fR +\fBtool\-alias set\fR Add/update an alias for a backend/plugin .RS \fIAliases: \fRadd, create .RE .TP -\fBalias unset\fR +\fBtool\-alias unset\fR Clears an alias for a backend/plugin .RS \fIAliases: \fRrm, remove, delete, del @@ -401,6 +398,30 @@ Sets a tool version for the current session. \fIAliases: \fRsh .RE .TP +\fBshell\-alias\fR +Manage shell aliases. +.TP +\fBshell\-alias get\fR +Show the command for a shell alias +.TP +\fBshell\-alias ls\fR +List shell aliases +.RS +\fIAliases: \fRlist +.RE +.TP +\fBshell\-alias set\fR +Add/update a shell alias +.RS +\fIAliases: \fRadd, create +.RE +.TP +\fBshell\-alias unset\fR +Removes a shell alias +.RS +\fIAliases: \fRrm, remove, delete, del +.RE +.TP \fBsync\fR Synchronize tools from other version managers with mise .TP @@ -546,10 +567,10 @@ Show "mise: @" message when changing directories .TP \fB\fR Shell type to generate the script for -.SH "MISE ALIAS" -Manage version aliases. +.SH "MISE TOOL-ALIAS" +Manage tool version aliases. .PP -\fBUsage:\fR mise alias [OPTIONS] [COMMAND] +\fBUsage:\fR mise tool\-alias [OPTIONS] [COMMAND] .PP \fBOptions:\fR .PP @@ -559,12 +580,12 @@ filter aliases by plugin .TP \fB\-\-no\-header\fR Don't show table header -.SH "MISE ALIAS GET" +.SH "MISE TOOL-ALIAS GET" Show an alias for a plugin -This is the contents of an alias. entry in ~/.config/mise/config.toml +This is the contents of a tool_alias. entry in ~/.config/mise/config.toml .PP -\fBUsage:\fR mise alias get +\fBUsage:\fR mise tool\-alias get .PP \fBArguments:\fR .PP @@ -574,17 +595,17 @@ The plugin to show the alias for .TP \fB\fR The alias to show -.SH "MISE ALIAS LS" -List aliases +.SH "MISE TOOL-ALIAS LS" +List tool version aliases Shows the aliases that can be specified. These can come from user config or from plugins in `bin/list\-aliases`. For user config, aliases are defined like the following in `~/.config/mise/config.toml`: - [alias.node.versions] + [tool_alias.node.versions] lts = "22.0.0" .PP -\fBUsage:\fR mise alias ls [OPTIONS] [] +\fBUsage:\fR mise tool\-alias ls [OPTIONS] [] .PP \fBOptions:\fR .PP @@ -596,12 +617,12 @@ Don't show table header .TP \fB\fR Show aliases for -.SH "MISE ALIAS SET" +.SH "MISE TOOL-ALIAS SET" Add/update an alias for a backend/plugin This modifies the contents of ~/.config/mise/config.toml .PP -\fBUsage:\fR mise alias set [] +\fBUsage:\fR mise tool\-alias set [] .PP \fBArguments:\fR .PP @@ -614,12 +635,12 @@ The alias to set .TP \fB\fR The value to set the alias to -.SH "MISE ALIAS UNSET" +.SH "MISE TOOL-ALIAS UNSET" Clears an alias for a backend/plugin This modifies the contents of ~/.config/mise/config.toml .PP -\fBUsage:\fR mise alias unset [] +\fBUsage:\fR mise tool\-alias unset [] .PP \fBArguments:\fR .PP @@ -2112,6 +2133,66 @@ Directly pipe stdin/stdout/stderr from plugin to user Sets \-\-jobs=1 .TP \fB\fR Tool(s) to use +.SH "MISE SHELL-ALIAS" +Manage shell aliases. +.PP +\fBUsage:\fR mise shell\-alias [OPTIONS] [COMMAND] +.PP +\fBOptions:\fR +.PP +.TP +\fB\-\-no\-header\fR +Don't show table header +.SH "MISE SHELL-ALIAS GET" +Show the command for a shell alias +.PP +\fBUsage:\fR mise shell\-alias get +.PP +\fBArguments:\fR +.PP +.TP +\fB\fR +The alias to show +.SH "MISE SHELL-ALIAS LS" +List shell aliases + +Shows the shell aliases that are set in the current directory. +These are defined in `mise.toml` under the `[shell_alias]` section. +.PP +\fBUsage:\fR mise shell\-alias ls [OPTIONS] +.PP +\fBOptions:\fR +.PP +.TP +\fB\-\-no\-header\fR +Don't show table header +.SH "MISE SHELL-ALIAS SET" +Add/update a shell alias + +This modifies the contents of ~/.config/mise/config.toml +.PP +\fBUsage:\fR mise shell\-alias set +.PP +\fBArguments:\fR +.PP +.TP +\fB\fR +The alias name +.TP +\fB\fR +The command to run +.SH "MISE SHELL-ALIAS UNSET" +Removes a shell alias + +This modifies the contents of ~/.config/mise/config.toml +.PP +\fBUsage:\fR mise shell\-alias unset +.PP +\fBArguments:\fR +.PP +.TP +\fB\fR +The alias to remove .SH "MISE SYNC NODE" Symlinks all tool versions from an external tool into mise diff --git a/mise.usage.kdl b/mise.usage.kdl index b720fc53c9..4f0bd88184 100644 --- a/mise.usage.kdl +++ b/mise.usage.kdl @@ -78,30 +78,29 @@ cmd activate help="Initializes mise in the current shell session" { choices bash elvish fish nu xonsh zsh pwsh } } -cmd alias help="Manage version aliases." { - alias a - alias aliases hide=#true +cmd tool-alias help="Manage tool version aliases." { + alias alias aliases hide=#true flag "-p --plugin" help="filter aliases by plugin" { arg } flag --no-header help="Don't show table header" cmd get help="Show an alias for a plugin" { - long_help "Show an alias for a plugin\n\nThis is the contents of an alias. entry in ~/.config/mise/config.toml" - after_long_help "Examples:\n\n $ mise alias get node lts-hydrogen\n 20.0.0\n" + long_help "Show an alias for a plugin\n\nThis is the contents of a tool_alias. entry in ~/.config/mise/config.toml" + after_long_help "Examples:\n\n $ mise tool-alias get node lts-hydrogen\n 20.0.0\n" arg help="The plugin to show the alias for" arg help="The alias to show" } - cmd ls help="List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`." { + cmd ls help="List tool version aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`." { alias list - long_help "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.\n\nFor user config, aliases are defined like the following in `~/.config/mise/config.toml`:\n\n [alias.node.versions]\n lts = \"22.0.0\"" - after_long_help "Examples:\n\n $ mise aliases\n node lts-jod 22\n" + long_help "List tool version aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.\n\nFor user config, aliases are defined like the following in `~/.config/mise/config.toml`:\n\n [tool_alias.node.versions]\n lts = \"22.0.0\"" + after_long_help "Examples:\n\n $ mise tool-alias ls\n node lts-jod 22\n" flag --no-header help="Don't show table header" arg "[TOOL]" help="Show aliases for " required=#false } cmd set help="Add/update an alias for a backend/plugin" { alias add create long_help "Add/update an alias for a backend/plugin\n\nThis modifies the contents of ~/.config/mise/config.toml" - after_long_help "Examples:\n\n $ mise alias set maven asdf:mise-plugins/mise-maven\n $ mise alias set node lts-jod 22.0.0\n" + after_long_help "Examples:\n\n $ mise tool-alias set maven asdf:mise-plugins/mise-maven\n $ mise tool-alias set node lts-jod 22.0.0\n" arg help="The backend/plugin to set the alias for" arg help="The alias to set" arg "[VALUE]" help="The value to set the alias to" required=#false @@ -109,7 +108,7 @@ cmd alias help="Manage version aliases." { cmd unset help="Clears an alias for a backend/plugin" { alias rm remove delete del long_help "Clears an alias for a backend/plugin\n\nThis modifies the contents of ~/.config/mise/config.toml" - after_long_help "Examples:\n\n $ mise alias unset maven\n $ mise alias unset node lts-jod\n" + after_long_help "Examples:\n\n $ mise tool-alias unset maven\n $ mise tool-alias unset node lts-jod\n" arg help="The backend/plugin to remove the alias from" arg "[ALIAS]" help="The alias to remove" required=#false } @@ -835,6 +834,32 @@ cmd shell help="Sets a tool version for the current session." { flag --raw help="Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1" arg … help="Tool(s) to use" var=#true } +cmd shell-alias help="Manage shell aliases." { + flag --no-header help="Don't show table header" + cmd get help="Show the command for a shell alias" { + after_long_help "Examples:\n\n $ mise shell-alias get ll\n ls -la\n" + arg help="The alias to show" + } + cmd ls help="List shell aliases" { + alias list + long_help "List shell aliases\n\nShows the shell aliases that are set in the current directory.\nThese are defined in `mise.toml` under the `[shell_alias]` section." + after_long_help "Examples:\n\n $ mise shell-alias ls\n alias command\n ll ls -la\n gs git status\n" + flag --no-header help="Don't show table header" + } + cmd set help="Add/update a shell alias" { + alias add create + long_help "Add/update a shell alias\n\nThis modifies the contents of ~/.config/mise/config.toml" + after_long_help "Examples:\n\n $ mise shell-alias set ll \"ls -la\"\n $ mise shell-alias set gs \"git status\"\n" + arg help="The alias name" + arg help="The command to run" + } + cmd unset help="Removes a shell alias" { + alias rm remove delete del + long_help "Removes a shell alias\n\nThis modifies the contents of ~/.config/mise/config.toml" + after_long_help "Examples:\n\n $ mise shell-alias unset ll\n" + arg help="The alias to remove" + } +} cmd sync subcommand_required=#true help="Synchronize tools from other version managers with mise" { cmd node help="Symlinks all tool versions from an external tool into mise" { long_help "Symlinks all tool versions from an external tool into mise\n\nFor example, use this to import all Homebrew node installs into mise\n\nThis won't overwrite any existing installs but will overwrite any existing symlinks" diff --git a/src/cli/mod.rs b/src/cli/mod.rs index ff757fd7bd..2121acbcad 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -10,7 +10,6 @@ use eyre::bail; use std::path::PathBuf; mod activate; -mod alias; pub mod args; mod asdf; pub mod backends; @@ -31,6 +30,7 @@ mod generate; mod global; mod hook_env; mod hook_not_found; +mod tool_alias; pub use hook_env::HookReason; mod implode; @@ -58,6 +58,7 @@ pub mod self_update; mod set; mod settings; mod shell; +mod shell_alias; mod sync; mod tasks; mod test_tool; @@ -191,7 +192,7 @@ pub struct Cli { #[strum(serialize_all = "kebab-case")] pub enum Commands { Activate(activate::Activate), - Alias(Box), + ToolAlias(Box), Asdf(asdf::Asdf), Backends(backends::Backends), BinPaths(bin_paths::BinPaths), @@ -235,6 +236,7 @@ pub enum Commands { Set(set::Set), Settings(settings::Settings), Shell(shell::Shell), + ShellAlias(shell_alias::ShellAlias), Sync(sync::Sync), Tasks(tasks::Tasks), TestTool(test_tool::TestTool), @@ -257,7 +259,7 @@ impl Commands { pub async fn run(self) -> Result<()> { match self { Self::Activate(cmd) => cmd.run(), - Self::Alias(cmd) => cmd.run().await, + Self::ToolAlias(cmd) => cmd.run().await, Self::Asdf(cmd) => cmd.run().await, Self::Backends(cmd) => cmd.run().await, Self::BinPaths(cmd) => cmd.run().await, @@ -301,6 +303,7 @@ impl Commands { Self::Set(cmd) => cmd.run().await, Self::Settings(cmd) => cmd.run().await, Self::Shell(cmd) => cmd.run().await, + Self::ShellAlias(cmd) => cmd.run().await, Self::Sync(cmd) => cmd.run().await, Self::Tasks(cmd) => cmd.run().await, Self::TestTool(cmd) => cmd.run().await, diff --git a/src/cli/shell_alias/get.rs b/src/cli/shell_alias/get.rs new file mode 100644 index 0000000000..199f1ebed5 --- /dev/null +++ b/src/cli/shell_alias/get.rs @@ -0,0 +1,33 @@ +use color_eyre::eyre::{Result, eyre}; + +use crate::config::Config; + +/// Show the command for a shell alias +#[derive(Debug, clap::Args)] +#[clap(after_long_help = AFTER_LONG_HELP, verbatim_doc_comment)] +pub struct ShellAliasGet { + /// The alias to show + #[clap(name = "shell_alias")] + pub alias: String, +} + +impl ShellAliasGet { + pub async fn run(self) -> Result<()> { + let config = Config::get().await?; + match config.shell_aliases.get(&self.alias) { + Some((command, _path)) => { + miseprintln!("{command}"); + Ok(()) + } + None => Err(eyre!("Unknown shell alias: {}", &self.alias)), + } + } +} + +static AFTER_LONG_HELP: &str = color_print::cstr!( + r#"Examples: + + $ mise shell-alias get ll + ls -la +"# +); diff --git a/src/cli/shell_alias/ls.rs b/src/cli/shell_alias/ls.rs new file mode 100644 index 0000000000..5a273cc560 --- /dev/null +++ b/src/cli/shell_alias/ls.rs @@ -0,0 +1,51 @@ +use eyre::Result; +use tabled::Tabled; + +use crate::config::Config; +use crate::ui::table; + +/// List shell aliases +/// +/// Shows the shell aliases that are set in the current directory. +/// These are defined in `mise.toml` under the `[shell_alias]` section. +#[derive(Debug, clap::Args)] +#[clap(visible_alias = "list", after_long_help = AFTER_LONG_HELP, verbatim_doc_comment)] +pub struct ShellAliasLs { + /// Don't show table header + #[clap(long)] + pub no_header: bool, +} + +impl ShellAliasLs { + pub async fn run(self) -> Result<()> { + let config = Config::get().await?; + let rows = config + .shell_aliases + .iter() + .map(|(name, (command, _path))| Row { + alias: name.clone(), + command: command.clone(), + }) + .collect::>(); + let mut table = tabled::Table::new(rows); + table::default_style(&mut table, self.no_header); + miseprintln!("{table}"); + Ok(()) + } +} + +#[derive(Tabled)] +struct Row { + alias: String, + command: String, +} + +static AFTER_LONG_HELP: &str = color_print::cstr!( + r#"Examples: + + $ mise shell-alias ls + alias command + ll ls -la + gs git status +"# +); diff --git a/src/cli/shell_alias/mod.rs b/src/cli/shell_alias/mod.rs new file mode 100644 index 0000000000..91fdd412a6 --- /dev/null +++ b/src/cli/shell_alias/mod.rs @@ -0,0 +1,47 @@ +use clap::Subcommand; +use eyre::Result; + +mod get; +mod ls; +mod set; +mod unset; + +#[derive(Debug, clap::Args)] +#[clap(name = "shell-alias", about = "Manage shell aliases.")] +pub struct ShellAlias { + #[clap(subcommand)] + command: Option, + + /// Don't show table header + #[clap(long)] + pub no_header: bool, +} + +#[derive(Debug, Subcommand)] +enum Commands { + Get(get::ShellAliasGet), + Ls(ls::ShellAliasLs), + Set(set::ShellAliasSet), + Unset(unset::ShellAliasUnset), +} + +impl Commands { + pub async fn run(self) -> Result<()> { + match self { + Self::Get(cmd) => cmd.run().await, + Self::Ls(cmd) => cmd.run().await, + Self::Set(cmd) => cmd.run().await, + Self::Unset(cmd) => cmd.run().await, + } + } +} + +impl ShellAlias { + pub async fn run(self) -> Result<()> { + let cmd = self.command.unwrap_or(Commands::Ls(ls::ShellAliasLs { + no_header: self.no_header, + })); + + cmd.run().await + } +} diff --git a/src/cli/shell_alias/set.rs b/src/cli/shell_alias/set.rs new file mode 100644 index 0000000000..fe34a904da --- /dev/null +++ b/src/cli/shell_alias/set.rs @@ -0,0 +1,33 @@ +use eyre::Result; + +use crate::config::Config; +use crate::config::config_file::ConfigFile; + +/// Add/update a shell alias +/// +/// This modifies the contents of ~/.config/mise/config.toml +#[derive(Debug, clap::Args)] +#[clap(visible_aliases = ["add", "create"], after_long_help = AFTER_LONG_HELP, verbatim_doc_comment)] +pub struct ShellAliasSet { + /// The alias name + #[clap(name = "shell_alias")] + pub alias: String, + /// The command to run + pub command: String, +} + +impl ShellAliasSet { + pub async fn run(self) -> Result<()> { + let mut global_config = Config::get().await?.global_config()?; + global_config.set_shell_alias(&self.alias, &self.command)?; + global_config.save() + } +} + +static AFTER_LONG_HELP: &str = color_print::cstr!( + r#"Examples: + + $ mise shell-alias set ll "ls -la" + $ mise shell-alias set gs "git status" +"# +); diff --git a/src/cli/shell_alias/unset.rs b/src/cli/shell_alias/unset.rs new file mode 100644 index 0000000000..1d579e67ed --- /dev/null +++ b/src/cli/shell_alias/unset.rs @@ -0,0 +1,30 @@ +use eyre::Result; + +use crate::config::Config; +use crate::config::config_file::ConfigFile; + +/// Removes a shell alias +/// +/// This modifies the contents of ~/.config/mise/config.toml +#[derive(Debug, clap::Args)] +#[clap(visible_aliases = ["rm", "remove", "delete", "del"], after_long_help = AFTER_LONG_HELP, verbatim_doc_comment)] +pub struct ShellAliasUnset { + /// The alias to remove + #[clap(name = "shell_alias")] + pub alias: String, +} + +impl ShellAliasUnset { + pub async fn run(self) -> Result<()> { + let mut global_config = Config::get().await?.global_config()?; + global_config.remove_shell_alias(&self.alias)?; + global_config.save() + } +} + +static AFTER_LONG_HELP: &str = color_print::cstr!( + r#"Examples: + + $ mise shell-alias unset ll +"# +); diff --git a/src/cli/alias/get.rs b/src/cli/tool_alias/get.rs similarity index 83% rename from src/cli/alias/get.rs rename to src/cli/tool_alias/get.rs index 4cb0598c3a..eed9ebc8bd 100644 --- a/src/cli/alias/get.rs +++ b/src/cli/tool_alias/get.rs @@ -5,18 +5,18 @@ use crate::config::Config; /// Show an alias for a plugin /// -/// This is the contents of an alias. entry in ~/.config/mise/config.toml +/// This is the contents of a tool_alias. entry in ~/.config/mise/config.toml /// #[derive(Debug, clap::Args)] #[clap(after_long_help = AFTER_LONG_HELP, verbatim_doc_comment)] -pub struct AliasGet { +pub struct ToolAliasGet { /// The plugin to show the alias for pub plugin: BackendArg, /// The alias to show pub alias: String, } -impl AliasGet { +impl ToolAliasGet { pub async fn run(self) -> Result<()> { let config = Config::get().await?; match config.all_aliases.get(&self.plugin.short) { @@ -35,7 +35,7 @@ impl AliasGet { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise alias get node lts-hydrogen + $ mise tool-alias get node lts-hydrogen 20.0.0 "# ); diff --git a/src/cli/alias/ls.rs b/src/cli/tool_alias/ls.rs similarity index 92% rename from src/cli/alias/ls.rs rename to src/cli/tool_alias/ls.rs index 31de9335dd..4be840d5ae 100644 --- a/src/cli/alias/ls.rs +++ b/src/cli/tool_alias/ls.rs @@ -6,17 +6,17 @@ use crate::cli::args::BackendArg; use crate::config::Config; use crate::ui::table; -/// List aliases +/// List tool version aliases /// Shows the aliases that can be specified. /// These can come from user config or from plugins in `bin/list-aliases`. /// /// For user config, aliases are defined like the following in `~/.config/mise/config.toml`: /// -/// [alias.node.versions] +/// [tool_alias.node.versions] /// lts = "22.0.0" #[derive(Debug, clap::Args)] #[clap(visible_alias = "list", after_long_help = AFTER_LONG_HELP, verbatim_doc_comment)] -pub struct AliasLs { +pub struct ToolAliasLs { /// Show aliases for #[clap()] pub tool: Option, @@ -26,7 +26,7 @@ pub struct AliasLs { pub no_header: bool, } -impl AliasLs { +impl ToolAliasLs { pub async fn run(self) -> Result<()> { let config = Config::get().await?; let rows = config @@ -66,7 +66,7 @@ struct Row { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise aliases + $ mise tool-alias ls node lts-jod 22 "# ); diff --git a/src/cli/alias/mod.rs b/src/cli/tool_alias/mod.rs similarity index 73% rename from src/cli/alias/mod.rs rename to src/cli/tool_alias/mod.rs index 50480f26e9..b7575e725a 100644 --- a/src/cli/alias/mod.rs +++ b/src/cli/tool_alias/mod.rs @@ -10,11 +10,12 @@ mod unset; #[derive(Debug, clap::Args)] #[clap( - about = "Manage version aliases.", - visible_alias = "a", + name = "tool-alias", + about = "Manage tool version aliases.", + alias = "alias", alias = "aliases" )] -pub struct Alias { +pub struct ToolAlias { #[clap(subcommand)] command: Option, @@ -29,10 +30,10 @@ pub struct Alias { #[derive(Debug, Subcommand)] enum Commands { - Get(get::AliasGet), - Ls(ls::AliasLs), - Set(set::AliasSet), - Unset(unset::AliasUnset), + Get(get::ToolAliasGet), + Ls(ls::ToolAliasLs), + Set(set::ToolAliasSet), + Unset(unset::ToolAliasUnset), } impl Commands { @@ -46,9 +47,9 @@ impl Commands { } } -impl Alias { +impl ToolAlias { pub async fn run(self) -> Result<()> { - let cmd = self.command.unwrap_or(Commands::Ls(ls::AliasLs { + let cmd = self.command.unwrap_or(Commands::Ls(ls::ToolAliasLs { tool: self.plugin, no_header: self.no_header, })); diff --git a/src/cli/alias/set.rs b/src/cli/tool_alias/set.rs similarity index 85% rename from src/cli/alias/set.rs rename to src/cli/tool_alias/set.rs index 6f57caae9f..bc1da1eb7b 100644 --- a/src/cli/alias/set.rs +++ b/src/cli/tool_alias/set.rs @@ -9,7 +9,7 @@ use crate::config::config_file::ConfigFile; /// This modifies the contents of ~/.config/mise/config.toml #[derive(Debug, clap::Args)] #[clap(visible_aliases = ["add", "create"], after_long_help = AFTER_LONG_HELP, verbatim_doc_comment)] -pub struct AliasSet { +pub struct ToolAliasSet { /// The backend/plugin to set the alias for pub plugin: BackendArg, /// The alias to set @@ -18,7 +18,7 @@ pub struct AliasSet { pub value: Option, } -impl AliasSet { +impl ToolAliasSet { pub async fn run(self) -> Result<()> { let mut global_config = Config::get().await?.global_config()?; match &self.value { @@ -32,7 +32,7 @@ impl AliasSet { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise alias set maven asdf:mise-plugins/mise-maven - $ mise alias set node lts-jod 22.0.0 + $ mise tool-alias set maven asdf:mise-plugins/mise-maven + $ mise tool-alias set node lts-jod 22.0.0 "# ); diff --git a/src/cli/alias/unset.rs b/src/cli/tool_alias/unset.rs similarity index 87% rename from src/cli/alias/unset.rs rename to src/cli/tool_alias/unset.rs index b4c2b4ab5f..0cd533cb31 100644 --- a/src/cli/alias/unset.rs +++ b/src/cli/tool_alias/unset.rs @@ -9,14 +9,14 @@ use crate::config::config_file::ConfigFile; /// This modifies the contents of ~/.config/mise/config.toml #[derive(Debug, clap::Args)] #[clap(visible_aliases = ["rm", "remove", "delete", "del"], after_long_help = AFTER_LONG_HELP, verbatim_doc_comment)] -pub struct AliasUnset { +pub struct ToolAliasUnset { /// The backend/plugin to remove the alias from pub plugin: BackendArg, /// The alias to remove pub alias: Option, } -impl AliasUnset { +impl ToolAliasUnset { pub async fn run(self) -> Result<()> { let mut global_config = Config::get().await?.global_config()?; match self.alias { @@ -34,7 +34,7 @@ impl AliasUnset { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise alias unset maven - $ mise alias unset node lts-jod + $ mise tool-alias unset maven + $ mise tool-alias unset node lts-jod "# ); diff --git a/src/config/config_file/mise_toml.rs b/src/config/config_file/mise_toml.rs index 597c39dd4f..a4a76a27db 100644 --- a/src/config/config_file/mise_toml.rs +++ b/src/config/config_file/mise_toml.rs @@ -209,7 +209,7 @@ impl MiseToml { self.doc_mut()? .get_mut() .unwrap() - .entry("alias") + .entry("tool_alias") .or_insert_with(table) .as_table_like_mut() .unwrap() @@ -218,7 +218,7 @@ impl MiseToml { } pub fn set_alias(&mut self, fa: &BackendArg, from: &str, to: &str) -> eyre::Result<()> { - self.alias + self.tool_alias .entry(fa.short.to_string()) .or_default() .versions @@ -226,7 +226,7 @@ impl MiseToml { self.doc_mut()? .get_mut() .unwrap() - .entry("alias") + .entry("tool_alias") .or_insert_with(table) .as_table_like_mut() .unwrap() @@ -245,41 +245,77 @@ impl MiseToml { pub fn remove_backend_alias(&mut self, fa: &BackendArg) -> eyre::Result<()> { let mut doc = self.doc_mut()?; let doc = doc.get_mut().unwrap(); - if let Some(aliases) = doc.get_mut("alias").and_then(|v| v.as_table_mut()) { - aliases.remove(&fa.short); - if aliases.is_empty() { - doc.as_table_mut().remove("alias"); + // Remove from both tool_alias and deprecated alias sections + for section in ["tool_alias", "alias"] { + if let Some(aliases) = doc.get_mut(section).and_then(|v| v.as_table_mut()) { + aliases.remove(&fa.short); + if aliases.is_empty() { + doc.as_table_mut().remove(section); + } } } Ok(()) } pub fn remove_alias(&mut self, fa: &BackendArg, from: &str) -> eyre::Result<()> { - if let Some(aliases) = self.alias.get_mut(&fa.short) { - aliases.versions.shift_remove(from); - if aliases.versions.is_empty() && aliases.backend.is_none() { - self.alias.shift_remove(&fa.short); + // Remove from both tool_alias and deprecated alias in memory + for alias_map in [&mut self.tool_alias, &mut self.alias] { + if let Some(aliases) = alias_map.get_mut(&fa.short) { + aliases.versions.shift_remove(from); + if aliases.versions.is_empty() && aliases.backend.is_none() { + alias_map.shift_remove(&fa.short); + } } } let mut doc = self.doc_mut()?; let doc = doc.get_mut().unwrap(); - if let Some(aliases) = doc.get_mut("alias").and_then(|v| v.as_table_mut()) { - if let Some(alias) = aliases - .get_mut(&fa.to_string()) - .and_then(|v| v.as_table_mut()) - { - if let Some(versions) = alias.get_mut("versions").and_then(|v| v.as_table_mut()) { - versions.remove(from); - if versions.is_empty() { - alias.remove("versions"); + // Remove from both tool_alias and deprecated alias sections in doc + for section in ["tool_alias", "alias"] { + if let Some(aliases) = doc.get_mut(section).and_then(|v| v.as_table_mut()) { + if let Some(alias) = aliases + .get_mut(&fa.to_string()) + .and_then(|v| v.as_table_mut()) + { + if let Some(versions) = alias.get_mut("versions").and_then(|v| v.as_table_mut()) + { + versions.remove(from); + if versions.is_empty() { + alias.remove("versions"); + } + } + if alias.is_empty() { + aliases.remove(&fa.to_string()); } } - if alias.is_empty() { - aliases.remove(&fa.to_string()); + if aliases.is_empty() { + doc.as_table_mut().remove(section); } } - if aliases.is_empty() { - doc.as_table_mut().remove("alias"); + } + Ok(()) + } + + pub fn set_shell_alias(&mut self, name: &str, command: &str) -> eyre::Result<()> { + self.shell_alias.insert(name.into(), command.into()); + self.doc_mut()? + .get_mut() + .unwrap() + .entry("shell_alias") + .or_insert_with(table) + .as_table_like_mut() + .unwrap() + .insert(name, value(command)); + Ok(()) + } + + pub fn remove_shell_alias(&mut self, name: &str) -> eyre::Result<()> { + self.shell_alias.shift_remove(name); + let mut doc = self.doc_mut()?; + let doc = doc.get_mut().unwrap(); + if let Some(shell_alias) = doc.get_mut("shell_alias").and_then(|v| v.as_table_mut()) { + shell_alias.remove(name); + if shell_alias.is_empty() { + doc.as_table_mut().remove("shell_alias"); } } Ok(()) @@ -1957,7 +1993,7 @@ mod tests { file::write( &p, formatdoc! {r#" - [alias.node.versions] + [tool_alias.node.versions] 16 = "16.0.0" 18 = "18.0.0" "#}, @@ -1970,7 +2006,7 @@ mod tests { cf.set_alias(&node, "20", "20.0.0").unwrap(); cf.set_alias(&python, "3.10", "3.10.0").unwrap(); - assert_debug_snapshot!(cf.alias); + assert_debug_snapshot!(cf.tool_alias); let cf: Box = Box::new(cf); assert_snapshot!(cf); file::remove_file(&p).unwrap(); diff --git a/xtasks/fig/addCustomGenerators.ts b/xtasks/fig/addCustomGenerators.ts index d28299a2b4..edd38f136c 100644 --- a/xtasks/fig/addCustomGenerators.ts +++ b/xtasks/fig/addCustomGenerators.ts @@ -15,6 +15,10 @@ const customGenerators: GeneratorIdentifier[] = [ identifier: "alias", generator_name: "aliasGenerator", }, + { + identifier: "shell_alias", + generator_name: "shellAliasGenerator", + }, { identifier: "plugin", generator_name: "pluginGenerator", @@ -126,6 +130,33 @@ function transformer(context: ts.TransformationContext) { } } const newNode = ts.visitEachChild(node, visit, context); + // Add generators to objects that should have them but don't + if ( + newNode && + has_property(newNode, '"name"') && + has_property(newNode, '"description"') && + !has_property(newNode, '"generators"') && + !has_property(newNode, '"subcommands"') && + !has_property(newNode, '"options"') + ) { + const id = get_identifier(newNode); + if (id) { + const objLiteralExpr = newNode as ts.ObjectLiteralExpression; + const generatorsProperty = ts.factory.createPropertyAssignment( + '"generators"', + id + ); + const debounceProperty = ts.factory.createPropertyAssignment( + '"debounce"', + ts.factory.createIdentifier("true") + ); + return ts.factory.updateObjectLiteralExpression(objLiteralExpr, [ + ...objLiteralExpr.properties, + generatorsProperty, + debounceProperty, + ]); + } + } if ( newNode && has_property(newNode, '"generators"') && diff --git a/xtasks/fig/generators.ts b/xtasks/fig/generators.ts index d90b05291b..f193c21290 100644 --- a/xtasks/fig/generators.ts +++ b/xtasks/fig/generators.ts @@ -50,6 +50,20 @@ const aliasGenerator: Fig.Generator = { }, }; +const shellAliasGenerator: Fig.Generator = { + script: ["sh", "-c", "mise shell-alias ls --no-header"], + postProcess: (out) => { + if (!out.trim()) return []; + return out + .split("\n") + .filter((l) => l.trim().length > 0) + .map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[0], description: tokens.slice(1).join(" ") }; + }); + }, +}; + const pluginWithAlias: Fig.Generator = { script: "mise alias ls".split(" "), postProcess: (output: string) => { diff --git a/xtasks/fig/src/mise.ts b/xtasks/fig/src/mise.ts index 23b5018154..28ecc77046 100644 --- a/xtasks/fig/src/mise.ts +++ b/xtasks/fig/src/mise.ts @@ -50,6 +50,20 @@ const aliasGenerator: Fig.Generator = { }, }; +const shellAliasGenerator: Fig.Generator = { + script: ["sh", "-c", "mise shell-alias ls --no-header"], + postProcess: (out) => { + if (!out.trim()) return []; + return out + .split("\n") + .filter((l) => l.trim().length > 0) + .map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[0], description: tokens.slice(1).join(" ") }; + }); + }, +}; + const pluginWithAlias: Fig.Generator = { script: "mise alias ls".split(" "), postProcess: (output: string) => { @@ -538,8 +552,8 @@ const completionSpec: Fig.Spec = { }, }, { - name: ["alias", "a"], - description: "Manage version aliases.", + name: "tool-alias", + description: "Manage tool version aliases.", subcommands: [ { name: "get", @@ -562,7 +576,7 @@ const completionSpec: Fig.Spec = { { name: ["ls", "list"], description: - "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + "List tool version aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", options: [ { name: "--no-header", @@ -2393,6 +2407,66 @@ const completionSpec: Fig.Spec = { debounce: true, }, }, + { + name: "shell-alias", + description: "Manage shell aliases.", + subcommands: [ + { + name: "get", + description: "Show the command for a shell alias", + args: { + name: "shell_alias", + description: "The alias to show", + generators: shellAliasGenerator, + debounce: true, + }, + }, + { + name: ["ls", "list"], + description: "List shell aliases", + options: [ + { + name: "--no-header", + description: "Don't show table header", + isRepeatable: false, + }, + ], + }, + { + name: ["set", "add", "create"], + description: "Add/update a shell alias", + args: [ + { + name: "shell_alias", + description: "The alias name", + generators: shellAliasGenerator, + debounce: true, + }, + { + name: "command", + description: "The command to run", + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Removes a shell alias", + args: { + name: "shell_alias", + description: "The alias to remove", + generators: shellAliasGenerator, + debounce: true, + }, + }, + ], + options: [ + { + name: "--no-header", + description: "Don't show table header", + isRepeatable: false, + }, + ], + }, { name: "sync", description: "Synchronize tools from other version managers with mise", @@ -2604,6 +2678,8 @@ const completionSpec: Fig.Spec = { "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", isOptional: true, isVariadic: true, + generators: simpleTaskGenerator, + debounce: true, }, }, { @@ -2856,6 +2932,8 @@ const completionSpec: Fig.Spec = { "Tasks to validate\nIf not specified, validates all tasks", isOptional: true, isVariadic: true, + generators: simpleTaskGenerator, + debounce: true, }, }, ],