diff --git a/.idea/mise.iml b/.idea/mise.iml index 7290650cf..47c629d52 100644 --- a/.idea/mise.iml +++ b/.idea/mise.iml @@ -10,6 +10,7 @@ + diff --git a/.mise.toml b/.mise.toml index cbd8f1b00..535c87c05 100644 --- a/.mise.toml +++ b/.mise.toml @@ -3,6 +3,7 @@ min_version = "2024.1.1" [env] _.file = [".env"] +_.path = ["./target/debug"] FOO = "bar" FOO_NUM = 1 THIS_PROJECT = "{{config_root}}-{{cwd}}" @@ -30,8 +31,8 @@ run = "cargo clean" [tasks.build] alias = "b" run = "cargo build --color always --all-features" -sources = ["Cargo.*", "src/**/*.rs"] -outputs = ["target/debug/mise"] +#sources = ["Cargo.*", "src/**/*.rs"] +#outputs = ["target/debug/mise"] [tasks.ci] depends = [ @@ -40,30 +41,35 @@ depends = [ "test" ] -[tasks."render:completions"] +[tasks."render:usage"] depends = ["build"] +env = { CLICOLOR_FORCE = "0" } +run = "mise usage > mise.usage.kdl" + +[tasks."render:completions"] +depends = ["build", "render:usage"] env = { NO_COLOR = "1" } run = ''' #!/usr/bin/env bash set -xeuo pipefail -target/debug/mise render-completion bash > completions/mise.bash -target/debug/mise render-completion zsh > completions/_mise -target/debug/mise render-completion fish > completions/mise.fish +mise render-completion bash > completions/mise.bash +mise render-completion zsh > completions/_mise +mise render-completion fish > completions/mise.fish ''' [tasks."render:mangen"] depends = ["build"] env = { NO_COLOR = "1" } -run = "target/debug/mise render-mangen" +run = "mise render-mangen" [tasks."render:help"] depends = ["build"] env = { NO_COLOR = "1" } run = [ - "target/debug/mise render-help", + "mise render-help", "mise x node@latest -- npx markdown-magic", ] -sources = ["target/debug/mise"] +sources = ["mise"] outputs = ["README.md"] [tasks.render] diff --git a/Cargo.lock b/Cargo.lock index 5bfcb5901..009a73257 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1221,6 +1221,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kdl" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "062c875482ccb676fd40c804a40e3824d4464c18c364547456d1c8e8e951ae47" +dependencies = [ + "miette", + "nom", + "thiserror", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -1281,6 +1292,29 @@ version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +[[package]] +name = "miette" +version = "5.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" +dependencies = [ + "miette-derive", + "once_cell", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "5.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "mime" version = "0.3.17" @@ -1381,6 +1415,7 @@ dependencies = [ "toml", "toml_edit", "url", + "usage-lib", "versions", "walkdir", "which", @@ -2777,6 +2812,25 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "usage-lib" +version = "0.1.0" +dependencies = [ + "clap", + "heck 0.4.1", + "indexmap", + "itertools", + "kdl", + "log", + "miette", + "once_cell", + "serde", + "shell-escape", + "strum", + "thiserror", + "xx", +] + [[package]] name = "utf8parse" version = "0.2.1" @@ -3155,6 +3209,16 @@ dependencies = [ "rustix", ] +[[package]] +name = "xx" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "846a62538e6f30c0b450a936b9c711a11579803d41e6b4f959318693a7041bdc" +dependencies = [ + "miette", + "thiserror", +] + [[package]] name = "yaml-rust" version = "0.4.5" diff --git a/Cargo.toml b/Cargo.toml index b6e1f10a1..2f462eee1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ categories = ["command-line-utilities"] include = [ "src/**/*.rs", "src/plugins/core/assets/**", + "src/assets/**", "/completions/*", "/Cargo.lock", "/LICENSE", @@ -106,6 +107,8 @@ walkdir = "2.4.0" which = "6.0.0" zip = { version = "0.6.6", default-features = false, features = ["deflate"] } +usage-lib = { path = './usage', features = ["clap"] } + [target.'cfg(unix)'.dependencies] exec = "0.3.1" diff --git a/completions/_mise b/completions/_mise index ddc0b4dc6..546f9b79f 100644 --- a/completions/_mise +++ b/completions/_mise @@ -54,6 +54,7 @@ _mise() { (remove|rm|uninstall) __mise_uninstall_cmd && ret=0 ;; (unset) __mise_unset_cmd && ret=0 ;; (up|upgrade) __mise_upgrade_cmd && ret=0 ;; + (usage) __mise_usage_cmd && ret=0 ;; (u|use) __mise_use_cmd && ret=0 ;; (v|version) __mise_version_cmd && ret=0 ;; (w|watch) __mise_watch_cmd && ret=0 ;; @@ -614,6 +615,7 @@ __mise_set_cmd() { (( $+functions[__mise_settings_cmd] )) || __mise_settings_cmd() { _arguments -s -S \ + '--keys[Only display key names for each setting]' \ '(-C --cd)'{-C,--cd}'=[Change directory before running command]:cd:_directories' \ '(-q --quiet)'{-q,--quiet}'[Suppress non-error messages]' \ '*'{-v,--verbose}'[Show extra output (use -vv for even more)]' \ @@ -647,6 +649,7 @@ __mise_settings_get_cmd() { (( $+functions[__mise_settings_ls_cmd] )) || __mise_settings_ls_cmd() { _arguments -s -S \ + '--keys[Only display key names for each setting]' \ '(-C --cd)'{-C,--cd}'=[Change directory before running command]:cd:_directories' \ '(-q --quiet)'{-q,--quiet}'[Suppress non-error messages]' \ '*'{-v,--verbose}'[Show extra output (use -vv for even more)]' \ @@ -845,6 +848,14 @@ __mise_upgrade_cmd() { '*'{-v,--verbose}'[Show extra output (use -vv for even more)]' \ '(-y --yes)'{-y,--yes}'[Answer yes to all confirmation prompts]' } +(( $+functions[__mise_usage_cmd] )) || +__mise_usage_cmd() { + _arguments -s -S \ + '(-C --cd)'{-C,--cd}'=[Change directory before running command]:cd:_directories' \ + '(-q --quiet)'{-q,--quiet}'[Suppress non-error messages]' \ + '*'{-v,--verbose}'[Show extra output (use -vv for even more)]' \ + '(-y --yes)'{-y,--yes}'[Answer yes to all confirmation prompts]' +} (( $+functions[__mise_use_cmd] )) || __mise_use_cmd() { _arguments -s -S \ @@ -939,6 +950,7 @@ __mise_cmds() { {remove,rm,uninstall}':Removes runtime versions' 'unset:Remove environment variable(s) from the config file' {up,upgrade}':Upgrades outdated tool versions' + 'usage:Generate usage spec' {u,use}':Install tool version and add it to config' 'version:Show mise version' {w,watch}':\[experimental\] Run a tasks watching for changes' diff --git a/completions/mise.bash b/completions/mise.bash index 3e86b6483..f0fc65bc2 100644 --- a/completions/mise.bash +++ b/completions/mise.bash @@ -183,6 +183,9 @@ _mise() { mise,upgrade) cmd="mise__upgrade" ;; + mise,usage) + cmd="mise__usage" + ;; mise,use) cmd="mise__use" ;; @@ -441,6 +444,9 @@ _mise() { mise__help,upgrade) cmd="mise__help__upgrade" ;; + mise__help,usage) + cmd="mise__help__usage" + ;; mise__help,use) cmd="mise__help__use" ;; @@ -718,7 +724,7 @@ _mise() { case "${cmd}" in mise) - opts="-C -q -v -y -h -V --cd --debug --log-level --quiet --trace --verbose --yes --help --version activate alias asdf bin-paths cache completion config current deactivate direnv doctor env exec global hook-env hook-not-found implode install latest link local ls ls-remote outdated plugins prune reshim run self-update set settings shell sync tasks trust uninstall upgrade unset use version watch where which render-completion render-help render-mangen help" + opts="-C -q -v -y -h -V --cd --debug --log-level --quiet --trace --verbose --yes --help --version activate alias asdf bin-paths cache completion config current deactivate direnv doctor env exec global hook-env hook-not-found implode install latest link local ls ls-remote outdated plugins prune reshim run self-update set settings shell sync tasks trust uninstall unset upgrade usage use version watch where which render-completion render-help render-mangen help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -1852,7 +1858,7 @@ _mise() { return 0 ;; mise__help) - opts="activate alias asdf bin-paths cache completion config current deactivate direnv doctor env exec global hook-env hook-not-found implode install latest link local ls ls-remote outdated plugins prune reshim run self-update set settings shell sync tasks trust uninstall upgrade unset use version watch where which render-completion render-help render-mangen help" + opts="activate alias asdf bin-paths cache completion config current deactivate direnv doctor env exec global hook-env hook-not-found implode install latest link local ls ls-remote outdated plugins prune reshim run self-update set settings shell sync tasks trust uninstall unset upgrade usage use version watch where which render-completion render-help render-mangen help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -2817,6 +2823,20 @@ _mise() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + mise__help__usage) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; mise__help__use) opts="" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then @@ -3624,7 +3644,7 @@ _mise() { return 0 ;; mise__render__completion) - opts="-s -C -q -v -y -h --shell --cd --debug --log-level --quiet --trace --verbose --yes --help bash elvish fish powershell zsh" + opts="-s -C -q -v -y -h --shell --usage --cd --debug --log-level --quiet --trace --verbose --yes --help bash elvish fish powershell zsh" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -3891,7 +3911,7 @@ _mise() { return 0 ;; mise__settings) - opts="-C -q -v -y -h --cd --debug --log-level --quiet --trace --verbose --yes --help get ls set unset help" + opts="-C -q -v -y -h --keys --cd --debug --log-level --quiet --trace --verbose --yes --help get ls set unset help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -4039,7 +4059,7 @@ _mise() { return 0 ;; mise__settings__ls) - opts="-C -q -v -y -h --cd --debug --log-level --quiet --trace --verbose --yes --help" + opts="-C -q -v -y -h --keys --cd --debug --log-level --quiet --trace --verbose --yes --help" if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 @@ -4752,6 +4772,38 @@ _mise() { COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) return 0 ;; + mise__usage) + opts="-C -q -v -y -h --cd --debug --log-level --quiet --trace --verbose --yes --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + --cd) + COMPREPLY=() + if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then + compopt -o plusdirs + fi + return 0 + ;; + -C) + COMPREPLY=() + if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then + compopt -o plusdirs + fi + return 0 + ;; + --log-level) + COMPREPLY=($(compgen -W "error warn info debug trace" -- "${cur}")) + return 0 + ;; + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; mise__use) opts="-f -g -e -j -p -C -q -v -y -h --force --fuzzy --global --env --jobs --raw --remove --path --pin --cd --debug --log-level --quiet --trace --verbose --yes --help [TOOL@VERSION]..." if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then diff --git a/completions/mise.fish b/completions/mise.fish index aeb19d966..ef1fb5e79 100644 --- a/completions/mise.fish +++ b/completions/mise.fish @@ -5,7 +5,7 @@ complete -kxc mise -s C -l cd -a "(__fish_complete_directories)" -d 'Change dire complete -kxc mise -s q -l quiet -d 'Suppress non-error messages' complete -kxc mise -s v -l verbose -d 'Show extra output (use -vv for even more)' complete -kxc mise -s y -l yes -d 'Answer yes to all confirmation prompts' -set -l others activate alias bin-paths cache completion config current deactivate direnv doctor env exec implode install latest link ls ls-remote outdated plugins prune reshim run self-update set settings shell sync tasks trust uninstall unset upgrade use version watch where which +set -l others activate alias bin-paths cache completion config current deactivate direnv doctor env exec implode install latest link ls ls-remote outdated plugins prune reshim run self-update set settings shell sync tasks trust uninstall unset upgrade usage use version watch where which complete -xc mise -n "not $fssf $others" -a activate -d 'Initializes mise in the current shell session' complete -xc mise -n "not $fssf $others" -a alias -d 'Manage aliases' complete -xc mise -n "not $fssf $others" -a bin-paths -d 'List all the active runtime bin paths' @@ -39,6 +39,7 @@ complete -xc mise -n "not $fssf $others" -a trust -d 'Marks a config file as tru complete -xc mise -n "not $fssf $others" -a uninstall -d 'Removes runtime versions' complete -xc mise -n "not $fssf $others" -a unset -d 'Remove environment variable(s) from the config file' complete -xc mise -n "not $fssf $others" -a upgrade -d 'Upgrades outdated tool versions' +complete -xc mise -n "not $fssf $others" -a usage -d 'Generate usage spec' complete -xc mise -n "not $fssf $others" -a use -d 'Install tool version and add it to config' complete -xc mise -n "not $fssf $others" -a version -d 'Show mise version' complete -xc mise -n "not $fssf $others" -a watch -d '[experimental] Run a tasks watching for changes' @@ -241,6 +242,7 @@ complete -kxc mise -n "$fssf set" -l file -a "(__fish_complete_path)" -d 'The TO complete -kxc mise -n "$fssf set" -s g -l global -d 'Set the environment variable in the global config file' # settings +complete -kxc mise -n "$fssf settings" -l keys -d 'Only display key names for each setting' set -l others get ls set unset complete -xc mise -n "$fssf settings; and not $fssf $others" -a get -d 'Show a current setting' complete -xc mise -n "$fssf settings; and not $fssf $others" -a ls -d 'Show current settings' @@ -251,6 +253,7 @@ complete -xc mise -n "$fssf settings; and not $fssf $others" -a unset -d 'Clears complete -kxc mise -n "$fssf settings; and $fssf get" -a "(__mise_settings)" -d 'The setting to show' # settings ls +complete -kxc mise -n "$fssf settings; and $fssf ls" -l keys -d 'Only display key names for each setting' # settings set complete -kxc mise -n "$fssf settings; and $fssf set" -a "(__mise_settings)" -d 'The setting to set' @@ -337,6 +340,8 @@ complete -kxc mise -n "$fssf upgrade" -s j -l jobs -d 'Number of jobs to run in complete -kxc mise -n "$fssf upgrade" -l raw -d 'Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1' complete -kxc mise -n "$fssf upgrade" -a "(__mise_tool_versions)" -d 'Tool(s) to upgrade' +# usage + # use complete -kxc mise -n "$fssf use" -s e -l env -d 'Modify an environment-specific config file like .mise..toml' complete -kxc mise -n "$fssf use" -s f -l force -d 'Force reinstall even if already installed' diff --git a/docs/cli-reference.md b/docs/cli-reference.md index 4bf5c384a..222e68615 100644 --- a/docs/cli-reference.md +++ b/docs/cli-reference.md @@ -44,10 +44,11 @@ Options: Suppress non-error messages Examples: - $ eval "$(mise activate bash)" - $ eval "$(mise activate zsh)" - $ mise activate fish | source - $ execx($(mise activate xonsh)) + + $ eval "$(mise activate bash)" + $ eval "$(mise activate zsh)" + $ mise activate fish | source + $ execx($(mise activate xonsh)) ``` ## `mise alias get ` @@ -67,8 +68,8 @@ Arguments: The alias to show Examples: - $ mise alias get node lts-hydrogen - 20.0.0 + $ mise alias get node lts-hydrogen + 20.0.0 ``` ## `mise alias ls [OPTIONS] [PLUGIN]` @@ -96,8 +97,9 @@ Options: Don't show table header Examples: - $ mise aliases - node lts-hydrogen 20.0.0 + + $ mise aliases + node lts-hydrogen 20.0.0 ``` ## `mise alias set ` @@ -122,7 +124,8 @@ Arguments: The value to set the alias to Examples: - $ mise alias set node lts-hydrogen 18.0.0 + + $ mise alias set node lts-hydrogen 18.0.0 ``` ## `mise alias unset ` @@ -144,7 +147,8 @@ Arguments: The alias to remove Examples: - $ mise alias unset node lts-hydrogen + + $ mise alias unset node lts-hydrogen ``` ## `mise bin-paths` @@ -183,9 +187,10 @@ Arguments: [possible values: bash, fish, zsh] Examples: - $ mise completion bash > /etc/bash_completion.d/mise - $ mise completion zsh > /usr/local/share/zsh/site-functions/_mise - $ mise completion fish > ~/.config/fish/completions/mise.fish + + $ mise completion bash > /etc/bash_completion.d/mise + $ mise completion zsh > /usr/local/share/zsh/site-functions/_mise + $ mise completion fish > ~/.config/fish/completions/mise.fish ``` ## `mise config ls [OPTIONS]` @@ -200,7 +205,8 @@ Options: Do not print table header Examples: - $ mise config ls + + $ mise config ls ``` ## `mise config generate [OPTIONS]` @@ -217,8 +223,9 @@ Options: Output to file instead of stdout Examples: - $ mise cf generate > .mise.toml - $ mise cf generate --output=.mise.toml + + $ mise cf generate > .mise.toml + $ mise cf generate --output=.mise.toml ``` ## `mise current [PLUGIN]` @@ -236,19 +243,19 @@ Arguments: Plugin to show versions of e.g.: ruby, node, cargo:eza, npm:prettier, etc Examples: - # outputs `.tool-versions` compatible format - $ mise current - python 3.11.0 3.10.0 - shfmt 3.6.0 - shellcheck 0.9.0 - node 20.0.0 - - $ mise current node - 20.0.0 - - # can output multiple versions - $ mise current python - 3.11.0 3.10.0 + # outputs `.tool-versions` compatible format + $ mise current + python 3.11.0 3.10.0 + shfmt 3.6.0 + shellcheck 0.9.0 + node 20.0.0 + + $ mise current node + 20.0.0 + + # can output multiple versions + $ mise current python + 3.11.0 3.10.0 ``` ## `mise deactivate` @@ -261,10 +268,11 @@ This can be used to temporarily disable mise in a shell session. Usage: deactivate Examples: - $ mise deactivate bash - $ mise deactivate zsh - $ mise deactivate fish - $ execx($(mise deactivate xonsh)) + + $ mise deactivate bash + $ mise deactivate zsh + $ mise deactivate fish + $ execx($(mise deactivate xonsh)) ``` ## `mise direnv activate` @@ -281,9 +289,10 @@ direnv may not know to update environment variables when legacy file versions ch Usage: direnv activate Examples: - $ mise direnv activate > ~/.config/direnv/lib/use_mise.sh - $ echo 'use mise' > .envrc - $ direnv allow + + $ mise direnv activate > ~/.config/direnv/lib/use_mise.sh + $ echo 'use mise' > .envrc + $ direnv allow ``` ## `mise doctor` @@ -296,8 +305,9 @@ Check mise installation for possible problems Usage: doctor Examples: - $ mise doctor - [WARN] plugin node is not installed + + $ mise doctor + [WARN] plugin node is not installed ``` ## `mise env [OPTIONS] [TOOL@VERSION]...` @@ -326,10 +336,11 @@ Options: [possible values: bash, fish, nu, xonsh, zsh] Examples: - $ eval "$(mise env -s bash)" - $ eval "$(mise env -s zsh)" - $ mise env -s fish | source - $ execx($(mise env -s xonsh)) + + $ eval "$(mise env -s bash)" + $ eval "$(mise env -s zsh)" + $ mise env -s fish | source + $ execx($(mise env -s xonsh)) ``` ## `mise exec [OPTIONS] [TOOL@VERSION]... [-- ...]` @@ -370,14 +381,15 @@ Options: Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1 Examples: - $ mise exec node@20 -- node ./app.js # launch app.js using node-20.x - $ mise x node@20 -- node ./app.js # shorter alias - # Specify command as a string: - $ mise exec node@20 python@3.11 --command "node -v && python -V" + $ mise exec node@20 -- node ./app.js # launch app.js using node-20.x + $ mise x node@20 -- node ./app.js # shorter alias + + # Specify command as a string: + $ mise exec node@20 python@3.11 --command "node -v && python -V" - # Run a command in a different directory: - $ mise x -C /path/to/project node@20 -- node ./app.js + # Run a command in a different directory: + $ mise x -C /path/to/project node@20 -- node ./app.js ``` ## `mise implode [OPTIONS]` @@ -434,10 +446,11 @@ Options: Show installation output Examples: - $ mise install node@20.0.0 # install specific node version - $ mise install node@20 # install fuzzy node version - $ mise install node # install version specified in .tool-versions or .mise.toml - $ mise install # installs everything specified in .tool-versions or .mise.toml + + $ mise install node@20.0.0 # install specific node version + $ mise install node@20 # install fuzzy node version + $ mise install node # install version specified in .tool-versions or .mise.toml + $ mise install # installs everything specified in .tool-versions or .mise.toml ``` ## `mise latest [OPTIONS] ` @@ -456,11 +469,12 @@ Options: Show latest installed instead of available version Examples: - $ mise latest node@20 # get the latest version of node 20 - 20.0.0 - $ mise latest node # get the latest stable version of node - 20.0.0 + $ mise latest node@20 # get the latest version of node 20 + 20.0.0 + + $ mise latest node # get the latest stable version of node + 20.0.0 ``` ## `mise link [OPTIONS] ` @@ -488,14 +502,14 @@ Options: Overwrite an existing tool version if it exists Examples: - # build node-20.0.0 with node-build and link it into mise - $ node-build 20.0.0 ~/.nodes/20.0.0 - $ mise link node@20.0.0 ~/.nodes/20.0.0 - - # have mise use the python version provided by Homebrew - $ brew install node - $ mise link node@brew $(brew --prefix node) - $ mise use node@brew + # build node-20.0.0 with node-build and link it into mise + $ node-build 20.0.0 ~/.nodes/20.0.0 + $ mise link node@20.0.0 ~/.nodes/20.0.0 + + # have mise use the python version provided by Homebrew + $ brew install node + $ mise link node@brew $(brew --prefix node) + $ mise use node@brew ``` ## `mise ls [OPTIONS] [PLUGIN]...` @@ -540,29 +554,30 @@ Options: Don't display headers Examples: - $ mise ls - node 20.0.0 ~/src/myapp/.tool-versions latest - python 3.11.0 ~/.tool-versions 3.10 - python 3.10.0 - - $ mise ls --current - node 20.0.0 ~/src/myapp/.tool-versions 20 - python 3.11.0 ~/.tool-versions 3.11.0 - - $ mise ls --json - { - "node": [ - { - "version": "20.0.0", - "install_path": "/Users/jdx/.mise/installs/node/20.0.0", - "source": { - "type": ".mise.toml", - "path": "/Users/jdx/.mise.toml" + + $ mise ls + node 20.0.0 ~/src/myapp/.tool-versions latest + python 3.11.0 ~/.tool-versions 3.10 + python 3.10.0 + + $ mise ls --current + node 20.0.0 ~/src/myapp/.tool-versions 20 + python 3.11.0 ~/.tool-versions 3.11.0 + + $ mise ls --json + { + "node": [ + { + "version": "20.0.0", + "install_path": "/Users/jdx/.mise/installs/node/20.0.0", + "source": { + "type": ".mise.toml", + "path": "/Users/jdx/.mise.toml" + } } - } - ], - "python": [...] - } + ], + "python": [...] + } ``` ## `mise ls-remote [OPTIONS] [TOOL@VERSION] [PREFIX]` @@ -588,17 +603,18 @@ Options: Show all installed plugins and versions Examples: - $ mise ls-remote node - 18.0.0 - 20.0.0 - $ mise ls-remote node@20 - 20.0.0 - 20.1.0 + $ mise ls-remote node + 18.0.0 + 20.0.0 - $ mise ls-remote node 20 - 20.0.0 - 20.1.0 + $ mise ls-remote node@20 + 20.0.0 + 20.1.0 + + $ mise ls-remote node 20 + 20.0.0 + 20.1.0 ``` ## `mise outdated [TOOL@VERSION]...` @@ -615,14 +631,15 @@ Arguments: If not specified, all tools in global and local configs will be shown Examples: - $ mise outdated - Plugin Requested Current Latest - python 3.11 3.11.0 3.11.1 - node 20 20.0.0 20.1.0 - - $ mise outdated node - Plugin Requested Current Latest - node 20 20.0.0 20.1.0 + + $ mise outdated + Plugin Requested Current Latest + python 3.11 3.11.0 3.11.1 + node 20 20.0.0 20.1.0 + + $ mise outdated node + Plugin Requested Current Latest + node 20 20.0.0 20.1.0 ``` ## `mise plugins install [OPTIONS] [NEW_PLUGIN] [GIT_URL]` @@ -661,18 +678,18 @@ Options: Show installation output Examples: - # install the node via shorthand - $ mise plugins install node + # install the node via shorthand + $ mise plugins install node - # install the node plugin using a specific git url - $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git + # install the node plugin using a specific git url + $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git - # install the node plugin using the git url only - # (node is inferred from the url) - $ mise plugins install https://github.com/mise-plugins/rtx-nodejs.git + # install the node plugin using the git url only + # (node is inferred from the url) + $ mise plugins install https://github.com/mise-plugins/rtx-nodejs.git - # install the node plugin using a specific ref - $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git#v1.0.0 + # install the node plugin using a specific ref + $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git#v1.0.0 ``` ## `mise plugins link [OPTIONS] [PATH]` @@ -700,11 +717,11 @@ Options: Overwrite existing plugin Examples: - # essentially just `ln -s ./mise-node ~/.local/share/mise/plugins/node` - $ mise plugins link node ./mise-node + # essentially just `ln -s ./mise-node ~/.local/share/mise/plugins/node` + $ mise plugins link node ./mise-node - # infer plugin name as "node" - $ mise plugins link ./mise-node + # infer plugin name as "node" + $ mise plugins link ./mise-node ``` ## `mise plugins ls [OPTIONS]` @@ -734,13 +751,14 @@ Options: e.g.: https://github.com/asdf-vm/asdf-nodejs.git Examples: - $ mise plugins ls - node - ruby - $ mise plugins ls --urls - node https://github.com/asdf-vm/asdf-nodejs.git - ruby https://github.com/asdf-vm/asdf-ruby.git + $ mise plugins ls + node + ruby + + $ mise plugins ls --urls + node https://github.com/asdf-vm/asdf-nodejs.git + ruby https://github.com/asdf-vm/asdf-ruby.git ``` ## `mise plugins ls-remote [OPTIONS]` @@ -787,7 +805,8 @@ Options: Remove all plugins Examples: - $ mise uninstall node + + $ mise uninstall node ``` ## `mise plugins update [OPTIONS] [PLUGIN]...` @@ -811,9 +830,10 @@ Options: Default: 4 Examples: - $ mise plugins update # update all plugins - $ mise plugins update node # update only node - $ mise plugins update node#beta # specify a ref + + $ mise plugins update # update all plugins + $ mise plugins update node # update only node + $ mise plugins update node#beta # specify a ref ``` ## `mise prune [OPTIONS] [PLUGIN]...` @@ -837,9 +857,10 @@ Options: Do not actually delete anything Examples: - $ mise prune --dry-run - rm -rf ~/.local/share/mise/versions/node/20.0.0 - rm -rf ~/.local/share/mise/versions/node/20.0.1 + + $ mise prune --dry-run + rm -rf ~/.local/share/mise/versions/node/20.0.0 + rm -rf ~/.local/share/mise/versions/node/20.0.1 ``` ## `mise reshim` @@ -864,9 +885,10 @@ npm() { Usage: reshim Examples: - $ mise reshim - $ ~/.local/share/mise/shims/node -v - v20.0.0 + + $ mise reshim + $ ~/.local/share/mise/shims/node -v + v20.0.0 ``` ## `mise run [OPTIONS] [TASK] [ARGS]...` @@ -950,22 +972,23 @@ Options: Shows elapsed time after each tasks Examples: - $ mise run lint - Runs the "lint" tasks. This needs to either be defined in .mise.toml - or as a standalone script. See the project README for more information. - $ mise run build --force - Forces the "build" tasks to run even if its sources are up-to-date. + # Runs the "lint" tasks. This needs to either be defined in .mise.toml + # or as a standalone script. See the project README for more information. + $ mise run lint - $ mise run test --raw - Runs "test" with stdin/stdout/stderr all connected to the current terminal. - This forces `--jobs=1` to prevent interleaving of output. + # Forces the "build" tasks to run even if its sources are up-to-date. + $ mise run build --force - $ mise run lint ::: test ::: check - Runs the "lint", "test", and "check" tasks in parallel. + # Run "test" with stdin/stdout/stderr all connected to the current terminal. + # This forces `--jobs=1` to prevent interleaving of output. + $ mise run test --raw - $ mise tasks cmd1 arg1 arg2 ::: cmd2 arg1 arg2 - Execute multiple tasks each with their own arguments. + # Runs the "lint", "test", and "check" tasks in parallel. + $ mise run lint ::: test ::: check + + # Execute multiple tasks each with their own arguments. + $ mise tasks cmd1 arg1 arg2 ::: cmd2 arg1 arg2 ``` ## `mise self-update [OPTIONS] [VERSION]` @@ -1017,14 +1040,15 @@ Options: Set the environment variable in the global config file Examples: - $ mise set NODE_ENV=production - $ mise set NODE_ENV - production + $ mise set NODE_ENV=production + + $ mise set NODE_ENV + production - $ mise set - key value source - NODE_ENV production ~/.config/mise/config.toml + $ mise set + key value source + NODE_ENV production ~/.config/mise/config.toml ``` ## `mise settings get ` @@ -1044,11 +1068,12 @@ Arguments: The setting to show Examples: - $ mise settings get legacy_version_file - true + + $ mise settings get legacy_version_file + true ``` -## `mise settings ls` +## `mise settings ls [OPTIONS]` **Aliases:** `list` @@ -1060,11 +1085,16 @@ This is the contents of ~/.config/mise/config.toml Note that aliases are also stored in this file but managed separately with `mise aliases` -Usage: settings ls +Usage: settings ls [OPTIONS] + +Options: + --keys + Only display key names for each setting Examples: - $ mise settings - legacy_version_file = false + + $ mise settings + legacy_version_file = false ``` ## `mise settings set ` @@ -1086,7 +1116,8 @@ Arguments: The value to set Examples: - $ mise settings set legacy_version_file true + + $ mise settings set legacy_version_file true ``` ## `mise settings unset ` @@ -1105,7 +1136,8 @@ Arguments: The setting to remove Examples: - $ mise settings unset legacy_version_file + + $ mise settings unset legacy_version_file ``` ## `mise shell [OPTIONS] [TOOL@VERSION]...` @@ -1141,9 +1173,10 @@ Options: Removes a previously set version Examples: - $ mise shell node@20 - $ node -v - v20.0.0 + + $ mise shell node@20 + $ node -v + v20.0.0 ``` ## `mise sync node <--brew|--nvm|--nodenv>` @@ -1166,9 +1199,10 @@ Options: Get tool versions from nodenv Examples: - $ brew install node@18 node@20 - $ mise sync node --brew - $ mise use -g node@18 - uses Homebrew-provided node + + $ brew install node@18 node@20 + $ mise sync node --brew + $ mise use -g node@18 - uses Homebrew-provided node ``` ## `mise sync python --pyenv` @@ -1185,9 +1219,10 @@ Options: Get tool versions from pyenv Examples: - $ pyenv install 3.11.0 - $ mise sync python --pyenv - $ mise use -g python@3.11.0 - uses pyenv-provided python + + $ pyenv install 3.11.0 + $ mise sync python --pyenv + $ mise use -g python@3.11.0 - uses pyenv-provided python ``` ## `mise tasks deps [OPTIONS] [TASKS]...` @@ -1208,14 +1243,15 @@ Options: Display dependencies in DOT format Examples: - $ mise tasks deps - Shows dependencies for all tasks - $ mise tasks deps lint test check - Shows dependencies for the "lint", "test" and "check" tasks + # Show dependencies for all tasks + $ mise tasks deps + + # Show dependencies for the "lint", "test" and "check" tasks + $ mise tasks deps lint test check - $ mise tasks deps --dot - Shows dependencies in DOT format + # Show dependencies in DOT format + $ mise tasks deps --dot ``` ## `mise tasks edit [OPTIONS] ` @@ -1236,8 +1272,9 @@ Options: Display the path to the tasks instead of editing it Examples: - $ mise tasks edit build - $ mise tasks edit test + + $ mise tasks edit build + $ mise tasks edit test ``` ## `mise tasks ls [OPTIONS]` @@ -1261,7 +1298,8 @@ Options: Show hidden tasks Examples: - $ mise tasks ls + + $ mise tasks ls ``` ## `mise tasks run [OPTIONS] [TASK] [ARGS]...` @@ -1345,22 +1383,23 @@ Options: Shows elapsed time after each tasks Examples: - $ mise run lint - Runs the "lint" tasks. This needs to either be defined in .mise.toml - or as a standalone script. See the project README for more information. - $ mise run build --force - Forces the "build" tasks to run even if its sources are up-to-date. + # Runs the "lint" tasks. This needs to either be defined in .mise.toml + # or as a standalone script. See the project README for more information. + $ mise run lint + + # Forces the "build" tasks to run even if its sources are up-to-date. + $ mise run build --force - $ mise run test --raw - Runs "test" with stdin/stdout/stderr all connected to the current terminal. - This forces `--jobs=1` to prevent interleaving of output. + # Run "test" with stdin/stdout/stderr all connected to the current terminal. + # This forces `--jobs=1` to prevent interleaving of output. + $ mise run test --raw - $ mise run lint ::: test ::: check - Runs the "lint", "test", and "check" tasks in parallel. + # Runs the "lint", "test", and "check" tasks in parallel. + $ mise run lint ::: test ::: check - $ mise tasks cmd1 arg1 arg2 ::: cmd2 arg1 arg2 - Execute multiple tasks each with their own arguments. + # Execute multiple tasks each with their own arguments. + $ mise tasks cmd1 arg1 arg2 ::: cmd2 arg1 arg2 ``` ## `mise trust [OPTIONS] [CONFIG_FILE]` @@ -1390,11 +1429,11 @@ Options: No longer trust this config Examples: - # trusts ~/some_dir/.mise.toml - $ mise trust ~/some_dir/.mise.toml + # trusts ~/some_dir/.mise.toml + $ mise trust ~/some_dir/.mise.toml - # trusts .mise.toml in the current or parent directory - $ mise trust + # trusts .mise.toml in the current or parent directory + $ mise trust ``` ## `mise uninstall [OPTIONS] [TOOL@VERSION]...` @@ -1418,9 +1457,10 @@ Options: Do not actually delete anything Examples: - $ mise uninstall node@18.0.0 # will uninstall specific version - $ mise uninstall node # will uninstall current node version - $ mise uninstall --all node@18.0.0 # will uninstall all node versions + + $ mise uninstall node@18.0.0 # will uninstall specific version + $ mise uninstall node # will uninstall current node version + $ mise uninstall --all node@18.0.0 # will uninstall all node versions ``` ## `mise unset [OPTIONS] [KEYS]...` @@ -1477,6 +1517,14 @@ Options: Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1 ``` +## `mise usage` + +```text +Generate usage spec + +Usage: usage +``` + ## `mise use [OPTIONS] [TOOL@VERSION]...` **Aliases:** `u` @@ -1533,19 +1581,20 @@ Options: Set MISE_ASDF_COMPAT=1 to make this the default behavior Examples: - # set the current version of node to 20.x in .mise.toml of current directory - # will write the fuzzy version (e.g.: 20) - $ mise use node@20 - # set the current version of node to 20.x in ~/.config/mise/config.toml - # will write the precise version (e.g.: 20.0.0) - $ mise use -g --pin node@20 + # set the current version of node to 20.x in .mise.toml of current directory + # will write the fuzzy version (e.g.: 20) + $ mise use node@20 - # sets .mise.local.toml (which is intended not to be committed to a project) - $ mise use --env local node@20 + # set the current version of node to 20.x in ~/.config/mise/config.toml + # will write the precise version (e.g.: 20.0.0) + $ mise use -g --pin node@20 - # sets .mise.staging.toml (which is used if MISE_ENV=staging) - $ mise use --env staging node@20 + # sets .mise.local.toml (which is intended not to be committed to a project) + $ mise use --env local node@20 + + # sets .mise.staging.toml (which is used if MISE_ENV=staging) + $ mise use --env staging node@20 ``` ## `mise version` @@ -1580,16 +1629,16 @@ Options: Defaults to sources from the tasks(s) Examples: - $ mise watch -t build - Runs the "build" tasks. Will re-run the tasks when any of its sources change. - Uses "sources" from the tasks definition to determine which files to watch. + $ mise watch -t build + Runs the "build" tasks. Will re-run the tasks when any of its sources change. + Uses "sources" from the tasks definition to determine which files to watch. - $ mise watch -t build --glob src/**/*.rs - Runs the "build" tasks but specify the files to watch with a glob pattern. - This overrides the "sources" from the tasks definition. + $ mise watch -t build --glob src/**/*.rs + Runs the "build" tasks but specify the files to watch with a glob pattern. + This overrides the "sources" from the tasks definition. - $ mise run -t build --clear - Extra arguments are passed to watchexec. See `watchexec --help` for details. + $ mise run -t build --clear + Extra arguments are passed to watchexec. See `watchexec --help` for details. ``` ## `mise where ` @@ -1610,15 +1659,15 @@ Arguments: otherwise, it will show the current, active installed version Examples: - # Show the latest installed version of node - # If it is is not installed, errors - $ mise where node@20 - /home/jdx/.local/share/mise/installs/node/20.0.0 - - # Show the current, active install directory of node - # Errors if node is not referenced in any .tool-version file - $ mise where node - /home/jdx/.local/share/mise/installs/node/20.0.0 + # Show the latest installed version of node + # If it is is not installed, errors + $ mise where node@20 + /home/jdx/.local/share/mise/installs/node/20.0.0 + + # Show the current, active install directory of node + # Errors if node is not referenced in any .tool-version file + $ mise where node + /home/jdx/.local/share/mise/installs/node/20.0.0 ``` ## `mise which [OPTIONS] ` @@ -1644,12 +1693,13 @@ Options: e.g.: `mise which npm --tool=node@20` Examples: - $ mise which node - /home/username/.local/share/mise/installs/node/20.0.0/bin/node - $ mise which node --plugin - node - $ mise which node --version - 20.0.0 + + $ mise which node + /home/username/.local/share/mise/installs/node/20.0.0/bin/node + $ mise which node --plugin + node + $ mise which node --version + 20.0.0 ``` diff --git a/man/man1/mise.1 b/man/man1/mise.1 index 5173df04c..0df3cb033 100644 --- a/man/man1/mise.1 +++ b/man/man1/mise.1 @@ -128,11 +128,14 @@ Marks a config file as trusted mise\-uninstall(1) Removes runtime versions .TP +mise\-unset(1) +Remove environment variable(s) from the config file +.TP mise\-upgrade(1) Upgrades outdated tool versions .TP -mise\-unset(1) -Remove environment variable(s) from the config file +mise\-usage(1) +Generate usage spec .TP mise\-use(1) Install tool version and add it to config @@ -153,31 +156,32 @@ mise\-help(1) Print this message or the help of the given subcommand(s) .SH EXTRA Examples: - $ mise install node@20.0.0 Install a specific node version - $ mise install node@20 Install a version matching a prefix - $ mise install node Install the node version defined in config - $ mise install Install all plugins/tools defined in config + + $ mise install node@20.0.0 Install a specific node version + $ mise install node@20 Install a version matching a prefix + $ mise install node Install the node version defined in config + $ mise install Install all plugins/tools defined in config - $ mise install cargo:ripgrep Install something via cargo - $ mise install npm:prettier Install something via npm + $ mise install cargo:ripgrep Install something via cargo + $ mise install npm:prettier Install something via npm - $ mise use node@20 Use node\-20.x in current project - $ mise use \-g node@20 Use node\-20.x as default - $ mise use node@latest Use latest node in current directory - $ mise use \-g node@system Use system node everywhere unless overridden + $ mise use node@20 Use node\-20.x in current project + $ mise use \-g node@20 Use node\-20.x as default + $ mise use node@latest Use latest node in current directory + $ mise use \-g node@system Use system node everywhere unless overridden - $ mise up \-\-interactive Show a menu to upgrade tools + $ mise up \-\-interactive Show a menu to upgrade tools - $ mise x \-\- npm install `npm install` w/ config loaded into PATH - $ mise x node@20 \-\- node app.js `node app.js` w/ config + node\-20.x on PATH + $ mise x \-\- npm install `npm install` w/ config loaded into PATH + $ mise x node@20 \-\- node app.js `node app.js` w/ config + node\-20.x on PATH - $ mise set NODE_ENV=production Set NODE_ENV=production in config + $ mise set NODE_ENV=production Set NODE_ENV=production in config - $ mise run build Run `build` tasks - $ mise watch build Run `build` tasks repeatedly when files change + $ mise run build Run `build` tasks + $ mise watch build Run `build` tasks repeatedly when files change - $ mise settings Show settings in use - $ mise settings set color 0 Disable color by modifying global config file + $ mise settings Show settings in use + $ mise settings set color 0 Disable color by modifying global config file .SH VERSION v2024.2.9 .SH AUTHORS diff --git a/mise.usage.kdl b/mise.usage.kdl new file mode 100644 index 000000000..650d6b94d --- /dev/null +++ b/mise.usage.kdl @@ -0,0 +1,1203 @@ +name "mise" +bin "mise" +about "The front-end to your dev env" +long_about r"mise is a tool for managing runtime versions. https://github.com/jdx/mise + +It's a replacement for tools like nvm, nodenv, rbenv, rvm, chruby, pyenv, etc. +that works for any language. It's also great for managing linters/tools like +jq and shellcheck. + +It is inspired by asdf and uses asdf's plugin ecosystem under the hood: +https://asdf-vm.com/" +usage "Usage: mise [OPTIONS] " +flag "-C --cd" help="Change directory before running command" global=true { + arg "" +} +flag "--debug" help="Sets log level to debug" hide=true global=true +flag "--log-level" help="Set the log output verbosity" hide=true global=true { + arg "" +} +flag "-q --quiet" help="Suppress non-error messages" global=true +flag "--trace" help="Sets log level to trace" hide=true global=true +flag "-v --verbose" help="Show extra output (use -vv for even more)" var=true global=true count=true +flag "-y --yes" help="Answer yes to all confirmation prompts" global=true +cmd "activate" help="Initializes mise in the current shell session" { + long_help r#"Initializes mise in the current shell session + +This should go into your shell's rc file. +Otherwise, it will only take effect in the current session. +(e.g. ~/.zshrc, ~/.bashrc) + +This is only intended to be used in interactive sessions, not scripts. +mise is only capable of updating PATH when the prompt is displayed to the user. +For non-interactive use-cases, use shims instead. + +Typically this can be added with something like the following: + + echo 'eval "$(mise activate)"' >> ~/.zshrc + +However, this requires that "mise" is in your PATH. If it is not, you need to +specify the full path like this: + + echo 'eval "$(/path/to/mise activate)"' >> ~/.zshrc + +Customize status output with `status` settings."# + after_long_help r#"Examples: + + $ eval "$(mise activate bash)" + $ eval "$(mise activate zsh)" + $ mise activate fish | source + $ execx($(mise activate xonsh)) +"# + flag "-s --shell" help="Shell type to generate the script for" hide=true { + arg "" + } + flag "--status" help="Show \"mise: @\" message when changing directories" hide=true + flag "--shims" help="Use shims instead of modifying PATH\nEffectively the same as:\n PATH=\"$HOME/.local/share/mise/shims:$PATH\"" + flag "-q --quiet" help="Suppress non-error messages" + arg "[SHELL_TYPE]" help="Shell type to generate the script for" +} +cmd "alias" help="Manage aliases" { + alias "a" + 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 r"Show an alias for a plugin + +This is the contents of an alias. entry in ~/.config/mise/config.toml" + after_long_help r"Examples: + $ mise alias get node lts-hydrogen + 20.0.0 +" + 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`." { + alias "list" + long_help r#"List 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] + lts = "20.0.0""# + after_long_help r"Examples: + + $ mise aliases + node lts-hydrogen 20.0.0 +" + flag "--no-header" help="Don't show table header" + arg "[PLUGIN]" help="Show aliases for " + } + cmd "set" help="Add/update an alias for a plugin" { + alias "add" "create" + long_help r"Add/update an alias for a plugin + +This modifies the contents of ~/.config/mise/config.toml" + after_long_help r"Examples: + + $ mise alias set node lts-hydrogen 18.0.0 +" + arg "" help="The plugin to set the alias for" + arg "" help="The alias to set" + arg "" help="The value to set the alias to" + } + cmd "unset" help="Clears an alias for a plugin" { + alias "rm" "remove" "delete" "del" + long_help r"Clears an alias for a plugin + +This modifies the contents of ~/.config/mise/config.toml" + after_long_help r"Examples: + + $ mise alias unset node lts-hydrogen +" + arg "" help="The plugin to remove the alias from" + arg "" help="The alias to remove" + } +} +cmd "asdf" hide=true help="[internal] simulates asdf for plugins that call \"asdf\" internally" { + arg "[ARGS]..." help="all arguments" var=true +} +cmd "bin-paths" help="List all the active runtime bin paths" +cmd "cache" help="Manage the mise cache" { + long_help r"Manage the mise cache + +Run `mise cache` with no args to view the current cache directory." + cmd "clear" help="Deletes all cache files in mise" { + alias "c" + alias "clean" hide=true + arg "[PLUGIN]..." help="Plugin(s) to clear cache for e.g.: node, python" var=true + } +} +cmd "completion" help="Generate shell completions" { + alias "complete" "completions" hide=true + after_long_help r"Examples: + + $ mise completion bash > /etc/bash_completion.d/mise + $ mise completion zsh > /usr/local/share/zsh/site-functions/_mise + $ mise completion fish > ~/.config/fish/completions/mise.fish +" + flag "-s --shell" help="Shell type to generate completions for" hide=true { + arg "" + } + arg "[SHELL]" help="Shell type to generate completions for" +} +cmd "config" help="[experimental] Manage config files" { + alias "cfg" + flag "--no-header" help="Do not print table header" + cmd "ls" help="[experimental] List config files currently in use" { + after_long_help r"Examples: + + $ mise config ls +" + flag "--no-header" help="Do not print table header" + } + cmd "generate" help="[experimental] Generate an .mise.toml file" { + alias "g" + after_long_help r"Examples: + + $ mise cf generate > .mise.toml + $ mise cf generate --output=.mise.toml +" + flag "-o --output" help="Output to file instead of stdout" { + arg "" + } + } +} +cmd "current" help="Shows current active and installed runtime versions" { + long_help r"Shows current active and installed runtime versions + +This is similar to `mise ls --current`, but this only shows the runtime +and/or version. It's designed to fit into scripts more easily." + after_long_help r"Examples: + # outputs `.tool-versions` compatible format + $ mise current + python 3.11.0 3.10.0 + shfmt 3.6.0 + shellcheck 0.9.0 + node 20.0.0 + + $ mise current node + 20.0.0 + + # can output multiple versions + $ mise current python + 3.11.0 3.10.0 +" + arg "[PLUGIN]" help="Plugin to show versions of e.g.: ruby, node, cargo:eza, npm:prettier, etc" +} +cmd "deactivate" help="Disable mise for current shell session" { + long_help r"Disable mise for current shell session + +This can be used to temporarily disable mise in a shell session." + after_long_help r"Examples: + + $ mise deactivate bash + $ mise deactivate zsh + $ mise deactivate fish + $ execx($(mise deactivate xonsh)) +" +} +cmd "direnv" help="Output direnv function to use mise inside direnv" { + long_help r"Output direnv function to use mise inside direnv + +See https://mise.jdx.dev/direnv.html for more information + +Because this generates the legacy files based on currently installed plugins, +you should run this command after installing new plugins. Otherwise +direnv may not know to update environment variables when legacy file versions change." + cmd "envrc" hide=true help="[internal] This is an internal command that writes an envrc file\nfor direnv to consume." + cmd "exec" hide=true help="[internal] This is an internal command that writes an envrc file\nfor direnv to consume." + cmd "activate" help="Output direnv function to use mise inside direnv" { + long_help r"Output direnv function to use mise inside direnv + +See https://mise.jdx.dev/direnv.html for more information + +Because this generates the legacy files based on currently installed plugins, +you should run this command after installing new plugins. Otherwise +direnv may not know to update environment variables when legacy file versions change." + after_long_help r"Examples: + + $ mise direnv activate > ~/.config/direnv/lib/use_mise.sh + $ echo 'use mise' > .envrc + $ direnv allow +" + } +} +cmd "doctor" help="Check mise installation for possible problems" { + alias "dr" + after_long_help r"Examples: + + $ mise doctor + [WARN] plugin node is not installed +" +} +cmd "env" help="Exports env vars to activate mise a single time" { + alias "e" + long_help r"Exports env vars to activate mise a single time + +Use this if you don't want to permanently install mise. It's not necessary to +use this if you have `mise activate` in your shell rc file." + after_long_help r#"Examples: + + $ eval "$(mise env -s bash)" + $ eval "$(mise env -s zsh)" + $ mise env -s fish | source + $ execx($(mise env -s xonsh)) +"# + flag "-J --json" help="Output in JSON format" + flag "-s --shell" help="Shell type to generate environment variables for" { + arg "" + } + arg "[TOOL@VERSION]..." help="Tool(s) to use" var=true +} +cmd "exec" help="Execute a command with tool(s) set" { + alias "x" + long_help r#"Execute a command with tool(s) set + +use this to avoid modifying the shell session or running ad-hoc commands with mise tools set. + +Tools will be loaded from .mise.toml/.tool-versions, though they can be overridden with args +Note that only the plugin specified will be overridden, so if a `.tool-versions` file +includes "node 20" but you run `mise exec python@3.11`; it will still load node@20. + +The "--" separates runtimes from the commands to pass along to the subprocess."# + after_long_help r#"Examples: + + $ mise exec node@20 -- node ./app.js # launch app.js using node-20.x + $ mise x node@20 -- node ./app.js # shorter alias + + # Specify command as a string: + $ mise exec node@20 python@3.11 --command "node -v && python -V" + + # Run a command in a different directory: + $ mise x -C /path/to/project node@20 -- node ./app.js +"# + flag "-c --command" help="Command string to execute" { + arg "" + } + flag "-j --jobs" help="Number of jobs to run in parallel\n[default: 4]" { + arg "" + } + flag "--raw" help="Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1" + arg "[TOOL@VERSION]..." help="Tool(s) to start e.g.: node@20 python@3.10" var=true + arg "[COMMAND]..." help="Command string to execute (same as --command)" var=true +} +cmd "global" hide=true help="Sets/gets the global tool version(s)" { + alias "g" hide=true + long_help r"Sets/gets the global tool version(s) + +Displays the contents of global config after writing. +The file is `$HOME/.config/mise/config.toml` by default. It can be changed with `$MISE_GLOBAL_CONFIG_FILE`. +If `$MISE_GLOBAL_CONFIG_FILE` is set to anything that ends in `.toml`, it will be parsed as `.mise.toml`. +Otherwise, it will be parsed as a `.tool-versions` file. + +Use MISE_ASDF_COMPAT=1 to default the global config to ~/.tool-versions + +Use `mise local` to set a tool version locally in the current directory." + after_long_help r"Examples: + # set the current version of node to 20.x + # will use a fuzzy version (e.g.: 20) in .tool-versions file + $ mise global --fuzzy node@20 + + # set the current version of node to 20.x + # will use a precise version (e.g.: 20.0.0) in .tool-versions file + $ mise global --pin node@20 + + # show the current version of node in ~/.tool-versions + $ mise global node + 20.0.0 +" + flag "--pin" help="Save exact version to `~/.tool-versions`\ne.g.: `mise global --pin node@20` will save `node 20.0.0` to ~/.tool-versions" + flag "--fuzzy" help="Save fuzzy version to `~/.tool-versions`\ne.g.: `mise global --fuzzy node@20` will save `node 20` to ~/.tool-versions\nthis is the default behavior unless MISE_ASDF_COMPAT=1" + flag "--remove" help="Remove the plugin(s) from ~/.tool-versions" var=true { + arg "" + } + flag "--path" help="Get the path of the global config file" + arg "[TOOL@VERSION]..." help="Tool(s) to add to .tool-versions\ne.g.: node@20\nIf this is a single tool with no version, the current value of the global\n.tool-versions will be displayed" var=true +} +cmd "hook-env" hide=true help="[internal] called by activate hook to update env vars directory change" { + flag "-s --shell" help="Shell type to generate script for" { + arg "" + } + flag "--status" help="Show \"mise: @\" message when changing directories" hide=true + flag "-q --quiet" help="Hide warnings such as when a tool is not installed" +} +cmd "hook-not-found" hide=true help="[internal] called by shell when a command is not found" { + flag "-s --shell" help="Shell type to generate script for" { + arg "" + } + arg "" help="Attempted bin to run" +} +cmd "implode" help="Removes mise CLI and all related data" { + long_help r"Removes mise CLI and all related data + +Skips config directory by default." + flag "--config" help="Also remove config directory" + flag "-n --dry-run" help="List directories that would be removed without actually removing them" +} +cmd "install" help="Install a tool version" { + alias "i" + long_help r"Install a tool version + +This will install a tool version to `~/.local/share/mise/installs//` +It won't be used simply by being installed, however. +For that, you must set up a `.mise.toml`/`.tool-version` file manually or with `mise use`. +Or you can call a tool version explicitly with `mise exec @ -- `. + +Tools will be installed in parallel. To disable, set `--jobs=1` or `MISE_JOBS=1`" + after_long_help r"Examples: + + $ mise install node@20.0.0 # install specific node version + $ mise install node@20 # install fuzzy node version + $ mise install node # install version specified in .tool-versions or .mise.toml + $ mise install # installs everything specified in .tool-versions or .mise.toml +" + flag "-f --force" help="Force reinstall even if already installed" + flag "-j --jobs" help="Number of jobs to run in parallel\n[default: 4]" { + arg "" + } + flag "--raw" help="Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1" + flag "-v --verbose" help="Show installation output" var=true count=true + arg "[TOOL@VERSION]..." help="Tool(s) to install e.g.: node@20" var=true +} +cmd "latest" help="Gets the latest available version for a plugin" { + after_long_help r"Examples: + + $ mise latest node@20 # get the latest version of node 20 + 20.0.0 + + $ mise latest node # get the latest stable version of node + 20.0.0 +" + flag "-i --installed" help="Show latest installed instead of available version" + arg "" help="Tool to get the latest version of" + arg "[ASDF_VERSION]" help="The version prefix to use when querying the latest version same as the first argument after the \"@\" used for asdf compatibility" hide=true +} +cmd "link" help="Symlinks a tool version into mise" { + alias "ln" + long_help r"Symlinks a tool version into mise + +Use this for adding installs either custom compiled outside +mise or built with a different tool." + after_long_help r"Examples: + # build node-20.0.0 with node-build and link it into mise + $ node-build 20.0.0 ~/.nodes/20.0.0 + $ mise link node@20.0.0 ~/.nodes/20.0.0 + + # have mise use the python version provided by Homebrew + $ brew install node + $ mise link node@brew $(brew --prefix node) + $ mise use node@brew +" + flag "-f --force" help="Overwrite an existing tool version if it exists" + arg "" help="Tool name and version to create a symlink for" + arg "" help="The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0" +} +cmd "local" hide=true help="Sets/gets tool version in local .tool-versions or .mise.toml" { + alias "l" hide=true + long_help r"Sets/gets tool version in local .tool-versions or .mise.toml + +Use this to set a tool's version when within a directory +Use `mise global` to set a tool version globally +This uses `.tool-version` by default unless there is a `.mise.toml` file or if `MISE_USE_TOML` +is set. A future v2 release of mise will default to using `.mise.toml`." + after_long_help r"Examples: + # set the current version of node to 20.x for the current directory + # will use a precise version (e.g.: 20.0.0) in .tool-versions file + $ mise local node@20 + + # set node to 20.x for the current project (recurses up to find .tool-versions) + $ mise local -p node@20 + + # set the current version of node to 20.x for the current directory + # will use a fuzzy version (e.g.: 20) in .tool-versions file + $ mise local --fuzzy node@20 + + # removes node from .tool-versions + $ mise local --remove=node + + # show the current version of node in .tool-versions + $ mise local node + 20.0.0 +" + flag "-p --parent" help="Recurse up to find a .tool-versions file rather than using the current directory only\nby default this command will only set the tool in the current directory (\"$PWD/.tool-versions\")" + flag "--pin" help="Save exact version to `.tool-versions`\ne.g.: `mise local --pin node@20` will save `node 20.0.0` to .tool-versions" + flag "--fuzzy" help="Save fuzzy version to `.tool-versions` e.g.: `mise local --fuzzy node@20` will save `node 20` to .tool-versions This is the default behavior unless MISE_ASDF_COMPAT=1" + flag "--remove" help="Remove the plugin(s) from .tool-versions" var=true { + arg "" + } + flag "--path" help="Get the path of the config file" + arg "[TOOL@VERSION]..." help="Tool(s) to add to .tool-versions/.mise.toml\ne.g.: node@20\nif this is a single tool with no version,\nthe current value of .tool-versions/.mise.toml will be displayed" var=true +} +cmd "ls" help="List installed and active tool versions" { + alias "list" + long_help r#"List installed and active tool versions + +This command lists tools that mise "knows about". +These may be tools that are currently installed, or those +that are in a config file (active) but may or may not be installed. + +It's a useful command to get the current state of your tools."# + after_long_help r#"Examples: + + $ mise ls + node 20.0.0 ~/src/myapp/.tool-versions latest + python 3.11.0 ~/.tool-versions 3.10 + python 3.10.0 + + $ mise ls --current + node 20.0.0 ~/src/myapp/.tool-versions 20 + python 3.11.0 ~/.tool-versions 3.11.0 + + $ mise ls --json + { + "node": [ + { + "version": "20.0.0", + "install_path": "/Users/jdx/.mise/installs/node/20.0.0", + "source": { + "type": ".mise.toml", + "path": "/Users/jdx/.mise.toml" + } + } + ], + "python": [...] + } +"# + flag "-p --plugin" hide=true { + arg "" + } + flag "-c --current" help="Only show tool versions currently specified in a .tool-versions/.mise.toml" + flag "-g --global" help="Only show tool versions currently specified in a the global .tool-versions/.mise.toml" + flag "-i --installed" help="Only show tool versions that are installed (Hides tools defined in .tool-versions/.mise.toml but not installed)" + flag "--parseable" help="Output in an easily parseable format" hide=true + flag "-J --json" help="Output in json format" + flag "-m --missing" help="Display missing tool versions" + flag "--prefix" help="Display versions matching this prefix" { + arg "" + } + flag "--no-header" help="Don't display headers" + arg "[PLUGIN]..." help="Only show tool versions from [PLUGIN]" var=true +} +cmd "ls-remote" help="List runtime versions available for install" { + alias "list-all" "list-remote" hide=true + long_help r"List runtime versions available for install + +note that the results are cached for 24 hours +run `mise cache clean` to clear the cache and get fresh results" + after_long_help r"Examples: + + $ mise ls-remote node + 18.0.0 + 20.0.0 + + $ mise ls-remote node@20 + 20.0.0 + 20.1.0 + + $ mise ls-remote node 20 + 20.0.0 + 20.1.0 +" + flag "--all" help="Show all installed plugins and versions" + arg "[TOOL@VERSION]" help="Plugin to get versions for" + arg "[PREFIX]" help="The version prefix to use when querying the latest version\nsame as the first argument after the \"@\"" +} +cmd "outdated" help="Shows outdated tool versions" { + after_long_help r"Examples: + + $ mise outdated + Plugin Requested Current Latest + python 3.11 3.11.0 3.11.1 + node 20 20.0.0 20.1.0 + + $ mise outdated node + Plugin Requested Current Latest + node 20 20.0.0 20.1.0 +" + arg "[TOOL@VERSION]..." help="Tool(s) to show outdated versions for\ne.g.: node@20 python@3.10\nIf not specified, all tools in global and local configs will be shown" var=true +} +cmd "plugins" help="Manage plugins" { + alias "p" + alias "plugin" "plugin-list" hide=true + flag "-a --all" help="list all available remote plugins" hide=true { + long_help "list all available remote plugins\n\nsame as `mise plugins ls-remote`" + } + flag "-c --core" help="The built-in plugins only\nNormally these are not shown" + flag "--user" help="List installed plugins" { + long_help "List installed plugins\n\nThis is the default behavior but can be used with --core\nto show core and user plugins" + } + flag "-u --urls" help="Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git" + flag "--refs" help="Show the git refs for each plugin\ne.g.: main 1234abc" hide=true + cmd "install" help="Install a plugin" { + alias "i" "a" "add" + long_help r"Install a plugin + +note that mise automatically can install plugins when you install a tool +e.g.: `mise install node@20` will autoinstall the node plugin + +This behavior can be modified in ~/.config/mise/config.toml" + after_long_help r"Examples: + # install the node via shorthand + $ mise plugins install node + + # install the node plugin using a specific git url + $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git + + # install the node plugin using the git url only + # (node is inferred from the url) + $ mise plugins install https://github.com/mise-plugins/rtx-nodejs.git + + # install the node plugin using a specific ref + $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git#v1.0.0 +" + flag "-f --force" help="Reinstall even if plugin exists" + flag "-a --all" help="Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url" + flag "-v --verbose" help="Show installation output" var=true count=true + arg "[NEW_PLUGIN]" help="The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`" + arg "[GIT_URL]" help="The git url of the plugin" + arg "[REST]..." var=true hide=true + } + cmd "link" help="Symlinks a plugin into mise" { + alias "ln" + long_help r"Symlinks a plugin into mise + +This is used for developing a plugin." + after_long_help r#"Examples: + # essentially just `ln -s ./mise-node ~/.local/share/mise/plugins/node` + $ mise plugins link node ./mise-node + + # infer plugin name as "node" + $ mise plugins link ./mise-node +"# + flag "-f --force" help="Overwrite existing plugin" + arg "" help="The name of the plugin\ne.g.: node, ruby" + arg "[PATH]" help="The local path to the plugin\ne.g.: ./mise-node" + } + cmd "ls" help="List installed plugins" { + alias "list" + long_help r"List installed plugins + +Can also show remotely available plugins to install." + after_long_help r"Examples: + + $ mise plugins ls + node + ruby + + $ mise plugins ls --urls + node https://github.com/asdf-vm/asdf-nodejs.git + ruby https://github.com/asdf-vm/asdf-ruby.git +" + flag "-a --all" help="List all available remote plugins\nSame as `mise plugins ls-remote`" hide=true + flag "-c --core" help="The built-in plugins only\nNormally these are not shown" + flag "--user" help="List installed plugins" { + long_help "List installed plugins\n\nThis is the default behavior but can be used with --core\nto show core and user plugins" + } + flag "-u --urls" help="Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git" + flag "--refs" help="Show the git refs for each plugin\ne.g.: main 1234abc" hide=true + } + cmd "ls-remote" help="List all available remote plugins" { + alias "list-remote" "list-all" + long_help r" +List all available remote plugins + +The full list is here: https://github.com/jdx/mise/blob/main/src/default_shorthands.rs + +Examples: + $ mise plugins ls-remote +" + flag "-u --urls" help="Show the git url for each plugin e.g.: https://github.com/mise-plugins/rtx-nodejs.git" + flag "--only-names" help="Only show the name of each plugin by default it will show a \"*\" next to installed plugins" + } + cmd "uninstall" help="Removes a plugin" { + alias "remove" "rm" + after_long_help r"Examples: + + $ mise uninstall node +" + flag "-p --purge" help="Also remove the plugin's installs, downloads, and cache" + flag "-a --all" help="Remove all plugins" + arg "[PLUGIN]..." help="Plugin(s) to remove" var=true + } + cmd "update" help="Updates a plugin to the latest version" { + alias "up" "upgrade" + long_help r"Updates a plugin to the latest version + +note: this updates the plugin itself, not the runtime versions" + after_long_help r"Examples: + + $ mise plugins update # update all plugins + $ mise plugins update node # update only node + $ mise plugins update node#beta # specify a ref +" + flag "-j --jobs" help="Number of jobs to run in parallel\nDefault: 4" { + arg "" + } + arg "[PLUGIN]..." help="Plugin(s) to update" var=true + } +} +cmd "prune" help="Delete unused versions of tools" { + long_help r"Delete unused versions of tools + +mise tracks which config files have been used in ~/.local/share/mise/tracked_config_files +Versions which are no longer the latest specified in any of those configs are deleted. +Versions installed only with environment variables (`MISE__VERSION`) will be deleted, +as will versions only referenced on the command line (`mise exec @`)." + after_long_help r"Examples: + + $ mise prune --dry-run + rm -rf ~/.local/share/mise/versions/node/20.0.0 + rm -rf ~/.local/share/mise/versions/node/20.0.1 +" + flag "-n --dry-run" help="Do not actually delete anything" + arg "[PLUGIN]..." help="Prune only versions from this plugin(s)" var=true +} +cmd "reshim" help="rebuilds the shim farm" { + long_help r#"rebuilds the shim farm + +This creates new shims in ~/.local/share/mise/shims for CLIs that have been added. +mise will try to do this automatically for commands like `npm i -g` but there are +other ways to install things (like using yarn or pnpm for node) that mise does +not know about and so it will be necessary to call this explicitly. + +If you think mise should automatically call this for a particular command, please +open an issue on the mise repo. You can also setup a shell function to reshim +automatically (it's really fast so you don't need to worry about overhead): + +npm() { + command npm "$@" + mise reshim +}"# + after_long_help r"Examples: + + $ mise reshim + $ ~/.local/share/mise/shims/node -v + v20.0.0 +" + arg "[PLUGIN]" hide=true + arg "[VERSION]" hide=true +} +cmd "run" help="[experimental] Run a tasks" { + alias "r" + long_help r#"[experimental] Run a tasks + +This command will run a tasks, or multiple tasks in parallel. +Tasks may have dependencies on other tasks or on source files. +If source is configured on a tasks, it will only run if the source +files have changed. + +Tasks can be defined in .mise.toml or as standalone scripts. +In .mise.toml, tasks take this form: + + [tasks.build] + run = "npm run build" + sources = ["src/**/*.ts"] + outputs = ["dist/**/*.js"] + +Alternatively, tasks can be defined as standalone scripts. +These must be located in the `.mise/tasks` directory. +The name of the script will be the name of the tasks. + + $ cat .mise/tasks/build<" + } + flag "-n --dry-run" help="Don't actually run the tasks(s), just print them in order of execution" + flag "-f --force" help="Force the tasks to run even if outputs are up to date" + flag "-p --prefix" help="Print stdout/stderr by line, prefixed with the tasks's label\nDefaults to true if --jobs > 1\nConfigure with `task_output` config or `MISE_TASK_OUTPUT` env var" + flag "-i --interleave" help="Print directly to stdout/stderr instead of by line\nDefaults to true if --jobs == 1\nConfigure with `task_output` config or `MISE_TASK_OUTPUT` env var" + flag "-t --tool" help="Tool(s) to also add e.g.: node@20 python@3.10" var=true { + arg "" + } + flag "-j --jobs" help="Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var" { + arg "" + } + flag "-r --raw" help="Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var" + flag "--timings" help="Shows elapsed time after each tasks" + arg "[TASK]" help="Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2" default="default" + arg "[ARGS]..." help="Arguments to pass to the tasks. Use \":::\" to separate tasks" var=true +} +cmd "self-update" help="Updates mise itself" { + long_help r"Updates mise itself + +Uses the GitHub Releases API to find the latest release and binary +By default, this will also update any installed plugins" + flag "-f --force" help="Update even if already up to date" + flag "--no-plugins" help="Disable auto-updating plugins" + flag "-y --yes" help="Skip confirmation prompt" + arg "[VERSION]" help="Update to a specific version" +} +cmd "set" help="Manage environment variables" { + alias "ev" "env-vars" hide=true + long_help r#"Manage environment variables + +By default this command modifies ".mise.toml" in the current directory."# + after_long_help r"Examples: + + $ mise set NODE_ENV=production + + $ mise set NODE_ENV + production + + $ mise set + key value source + NODE_ENV production ~/.config/mise/config.toml +" + flag "--file" help="The TOML file to update" { + long_help "The TOML file to update\n\nDefaults to MISE_DEFAULT_CONFIG_FILENAME environment variable, or \".mise.toml\"." + arg "" + } + flag "-g --global" help="Set the environment variable in the global config file" + flag "--remove" help="Remove the environment variable from config file" var=true hide=true { + long_help "Remove the environment variable from config file\n\nCan be used multiple times." + arg "" + } + arg "[ENV_VARS]..." help="Environment variable(s) to set\ne.g.: NODE_ENV=production" var=true +} +cmd "settings" help="Manage settings" { + flag "--keys" help="Only display key names for each setting" + cmd "get" help="Show a current setting" { + long_help r"Show a current setting + +This is the contents of a single entry in ~/.config/mise/config.toml + +Note that aliases are also stored in this file +but managed separately with `mise aliases get`" + after_long_help r"Examples: + + $ mise settings get legacy_version_file + true +" + arg "" help="The setting to show" + } + cmd "ls" help="Show current settings" { + alias "list" + long_help r"Show current settings + +This is the contents of ~/.config/mise/config.toml + +Note that aliases are also stored in this file +but managed separately with `mise aliases`" + after_long_help r"Examples: + + $ mise settings + legacy_version_file = false +" + flag "--keys" help="Only display key names for each setting" + } + cmd "set" help="Add/update a setting" { + alias "add" "create" + long_help r"Add/update a setting + +This modifies the contents of ~/.config/mise/config.toml" + after_long_help r"Examples: + + $ mise settings set legacy_version_file true +" + arg "" help="The setting to set" + arg "" help="The value to set" + } + cmd "unset" help="Clears a setting" { + alias "rm" "remove" "delete" "del" + long_help r"Clears a setting + +This modifies the contents of ~/.config/mise/config.toml" + after_long_help r"Examples: + + $ mise settings unset legacy_version_file +" + arg "" help="The setting to remove" + } +} +cmd "shell" help="Sets a tool version for the current session" { + alias "sh" + long_help r#"Sets a tool version for the current session + +Only works in a session where mise is already activated. + +This works by setting environment variables for the current shell session +such as `MISE_NODE_VERSION=20` which is "eval"ed as a shell function created +by `mise activate`."# + after_long_help r"Examples: + + $ mise shell node@20 + $ node -v + v20.0.0 +" + flag "-j --jobs" help="Number of jobs to run in parallel\n[default: 4]" { + arg "" + } + flag "--raw" help="Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1" + flag "-u --unset" help="Removes a previously set version" + arg "[TOOL@VERSION]..." help="Tool(s) to use" var=true +} +cmd "sync" subcommand_required=true help="Add tool versions from external tools to mise" { + cmd "node" help="Symlinks all tool versions from an external tool into mise" { + long_help r"Symlinks all tool versions from an external tool into mise + +For example, use this to import all Homebrew node installs into mise" + after_long_help r"Examples: + + $ brew install node@18 node@20 + $ mise sync node --brew + $ mise use -g node@18 - uses Homebrew-provided node +" + flag "--brew" help="Get tool versions from Homebrew" + flag "--nvm" help="Get tool versions from nvm" + flag "--nodenv" help="Get tool versions from nodenv" + } + cmd "python" help="Symlinks all tool versions from an external tool into mise" { + long_help r"Symlinks all tool versions from an external tool into mise + +For example, use this to import all pyenv installs into mise" + after_long_help r"Examples: + + $ pyenv install 3.11.0 + $ mise sync python --pyenv + $ mise use -g python@3.11.0 - uses pyenv-provided python +" + flag "--pyenv" help="Get tool versions from pyenv" required=true + } +} +cmd "tasks" help="[experimental] Manage tasks" { + alias "t" + alias "task" hide=true + after_long_help r"Examples: + + $ mise tasks ls +" + flag "--no-header" help="Do not print table header" + flag "--hidden" help="Show hidden tasks" + cmd "deps" help="[experimental] Display a tree visualization of a dependency graph" { + after_long_help r#"Examples: + + # Show dependencies for all tasks + $ mise tasks deps + + # Show dependencies for the "lint", "test" and "check" tasks + $ mise tasks deps lint test check + + # Show dependencies in DOT format + $ mise tasks deps --dot +"# + flag "--dot" help="Display dependencies in DOT format" + arg "[TASKS]..." help="Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check" var=true + } + cmd "edit" help="[experimental] Edit a tasks with $EDITOR" { + long_help r"[experimental] Edit a tasks with $EDITOR + +The tasks will be created as a standalone script if it does not already exist." + after_long_help r"Examples: + + $ mise tasks edit build + $ mise tasks edit test +" + flag "-p --path" help="Display the path to the tasks instead of editing it" + arg "" help="Tasks to edit" + } + cmd "ls" help="[experimental] List available tasks to execute\nThese may be included from the config file or from the project's .mise/tasks directory\nmise will merge all tasks from all parent directories into this list." { + long_help r"[experimental] List available tasks to execute +These may be included from the config file or from the project's .mise/tasks directory +mise will merge all tasks from all parent directories into this list. + +So if you have global tasks in ~/.config/mise/tasks/* and project-specific tasks in +~/myproject/.mise/tasks/*, then they'll both be available but the project-specific +tasks will override the global ones if they have the same name." + after_long_help r"Examples: + + $ mise tasks ls +" + flag "--no-header" help="Do not print table header" + flag "--hidden" help="Show hidden tasks" + } + cmd "run" help="[experimental] Run a tasks" { + alias "r" + long_help r#"[experimental] Run a tasks + +This command will run a tasks, or multiple tasks in parallel. +Tasks may have dependencies on other tasks or on source files. +If source is configured on a tasks, it will only run if the source +files have changed. + +Tasks can be defined in .mise.toml or as standalone scripts. +In .mise.toml, tasks take this form: + + [tasks.build] + run = "npm run build" + sources = ["src/**/*.ts"] + outputs = ["dist/**/*.js"] + +Alternatively, tasks can be defined as standalone scripts. +These must be located in the `.mise/tasks` directory. +The name of the script will be the name of the tasks. + + $ cat .mise/tasks/build<" + } + flag "-n --dry-run" help="Don't actually run the tasks(s), just print them in order of execution" + flag "-f --force" help="Force the tasks to run even if outputs are up to date" + flag "-p --prefix" help="Print stdout/stderr by line, prefixed with the tasks's label\nDefaults to true if --jobs > 1\nConfigure with `task_output` config or `MISE_TASK_OUTPUT` env var" + flag "-i --interleave" help="Print directly to stdout/stderr instead of by line\nDefaults to true if --jobs == 1\nConfigure with `task_output` config or `MISE_TASK_OUTPUT` env var" + flag "-t --tool" help="Tool(s) to also add e.g.: node@20 python@3.10" var=true { + arg "" + } + flag "-j --jobs" help="Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var" { + arg "" + } + flag "-r --raw" help="Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var" + flag "--timings" help="Shows elapsed time after each tasks" + arg "[TASK]" help="Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2" default="default" + arg "[ARGS]..." help="Arguments to pass to the tasks. Use \":::\" to separate tasks" var=true + } +} +cmd "trust" help="Marks a config file as trusted" { + long_help r"Marks a config file as trusted + +This means mise will parse the file with potentially dangerous +features enabled. + +This includes: +- environment variables +- templates +- `path:` plugin versions" + after_long_help r"Examples: + # trusts ~/some_dir/.mise.toml + $ mise trust ~/some_dir/.mise.toml + + # trusts .mise.toml in the current or parent directory + $ mise trust +" + flag "-a --all" help="Trust all config files in the current directory and its parents" + flag "--untrust" help="No longer trust this config" + arg "[CONFIG_FILE]" help="The config file to trust" +} +cmd "uninstall" help="Removes runtime versions" { + alias "remove" "rm" + after_long_help r"Examples: + + $ mise uninstall node@18.0.0 # will uninstall specific version + $ mise uninstall node # will uninstall current node version + $ mise uninstall --all node@18.0.0 # will uninstall all node versions +" + flag "-a --all" help="Delete all installed versions" + flag "-n --dry-run" help="Do not actually delete anything" + arg "[TOOL@VERSION]..." help="Tool(s) to remove" var=true +} +cmd "unset" help="Remove environment variable(s) from the config file" { + long_help r#"Remove environment variable(s) from the config file + +By default this command modifies ".mise.toml" in the current directory."# + flag "-f --file" help="Specify a file to use instead of \".mise.toml\"" { + arg "" + } + flag "-g --global" help="Use the global config file" + arg "[KEYS]..." help="Environment variable(s) to remove\ne.g.: NODE_ENV" var=true +} +cmd "upgrade" help="Upgrades outdated tool versions" { + alias "up" + flag "-n --dry-run" help="Just print what would be done, don't actually do it" + flag "-j --jobs" help="Number of jobs to run in parallel\n[default: 4]" { + arg "" + } + flag "-i --interactive" help="Display multiselect menu to choose which tools to upgrade" + 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" var=true +} +cmd "usage" help="Generate usage spec" +cmd "use" help="Install tool version and add it to config" { + alias "u" + long_help r"Install tool version and add it to config + +This will install the tool if it is not already installed. +By default, this will use an `.mise.toml` file in the current directory. +Use the --global flag to use the global config file instead. +This replaces asdf's `local` and `global` commands, however those are still available in mise." + after_long_help r"Examples: + + # set the current version of node to 20.x in .mise.toml of current directory + # will write the fuzzy version (e.g.: 20) + $ mise use node@20 + + # set the current version of node to 20.x in ~/.config/mise/config.toml + # will write the precise version (e.g.: 20.0.0) + $ mise use -g --pin node@20 + + # sets .mise.local.toml (which is intended not to be committed to a project) + $ mise use --env local node@20 + + # sets .mise.staging.toml (which is used if MISE_ENV=staging) + $ mise use --env staging node@20 +" + flag "-f --force" help="Force reinstall even if already installed" + flag "--fuzzy" help="Save fuzzy version to config file\ne.g.: `mise use --fuzzy node@20` will save 20 as the version\nthis is the default behavior unless MISE_ASDF_COMPAT=1" + flag "-g --global" help="Use the global config file (~/.config/mise/config.toml) instead of the local one" + flag "-e --env" help="Modify an environment-specific config file like .mise..toml" { + arg "" + } + flag "-j --jobs" help="Number of jobs to run in parallel\n[default: 4]" { + arg "" + } + flag "--raw" help="Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1" + flag "--remove" help="Remove the plugin(s) from config file" var=true { + arg "" + } + flag "-p --path" help="Specify a path to a config file or directory If a directory is specified, it will look for .mise.toml (default) or .tool-versions" { + arg "" + } + flag "--pin" help="Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet MISE_ASDF_COMPAT=1 to make this the default behavior" + arg "[TOOL@VERSION]..." help="Tool(s) to add to config file\ne.g.: node@20, cargo:ripgrep@latest npm:prettier@3\nIf no version is specified, it will default to @latest" var=true +} +cmd "version" help="Show mise version" { + alias "v" hide=true +} +cmd "watch" help="[experimental] Run a tasks watching for changes" { + alias "w" + after_long_help r#"Examples: + $ mise watch -t build + Runs the "build" tasks. Will re-run the tasks when any of its sources change. + Uses "sources" from the tasks definition to determine which files to watch. + + $ mise watch -t build --glob src/**/*.rs + Runs the "build" tasks but specify the files to watch with a glob pattern. + This overrides the "sources" from the tasks definition. + + $ mise run -t build --clear + Extra arguments are passed to watchexec. See `watchexec --help` for details. +"# + flag "-t --task" help="Tasks to run" var=true { + arg "" + } + flag "-g --glob" help="Files to watch\nDefaults to sources from the tasks(s)" var=true { + arg "" + } + arg "[ARGS]..." help="Extra arguments" var=true +} +cmd "where" help="Display the installation path for a runtime" { + long_help r"Display the installation path for a runtime + +Must be installed." + after_long_help r"Examples: + # Show the latest installed version of node + # If it is is not installed, errors + $ mise where node@20 + /home/jdx/.local/share/mise/installs/node/20.0.0 + + # Show the current, active install directory of node + # Errors if node is not referenced in any .tool-version file + $ mise where node + /home/jdx/.local/share/mise/installs/node/20.0.0 +" + arg "" help="Tool(s) to look up\ne.g.: ruby@3\nif \"@\" is specified, it will show the latest installed version\nthat matches the prefix\notherwise, it will show the current, active installed version" + arg "[ASDF_VERSION]" help="the version prefix to use when querying the latest version\nsame as the first argument after the \"@\"\nused for asdf compatibility" hide=true +} +cmd "which" help="Shows the path that a bin name points to" { + after_long_help r"Examples: + + $ mise which node + /home/username/.local/share/mise/installs/node/20.0.0/bin/node + $ mise which node --plugin + node + $ mise which node --version + 20.0.0 +" + flag "--plugin" help="Show the plugin name instead of the path" + flag "--version" help="Show the version instead of the path" + flag "-t --tool" help="Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`" { + arg "" + } + arg "" help="The bin name to look up" +} +cmd "render-completion" hide=true help="Generate shell completions" { + flag "-s --shell" help="Shell type to generate completions for" hide=true { + arg "" + } + flag "--usage" help="Use usage for completions" + arg "[SHELL]" help="Shell type to generate completions for" +} +cmd "render-help" hide=true help="internal command to generate markdown from help" +cmd "render-mangen" hide=true help="internal command to generate markdown from help" + +complete "alias" run="mise alias ls {{words[PREV]}} | awk '{print $2}'" +complete "config_file" type="file" +complete "new_plugin" run="mise plugins --all" +complete "plugin" run="mise plugins --core --user" +complete "prefix" run="mise ls-remote {{words[PREV]}}" +complete "setting" run="mise settings --keys" +complete "task" run="mise tasks | awk '{print $1}'" + +complete "tool@version" run=r#" +cur="{{words[CURRENT]}}" +case $cur in + *@*) + IFS='@' read -r -a parts <<< "$cur" + tool="${parts[0]}" + prefix="${parts[1]}" + + versions=$(mise ls-remote $tool $prefix | tail -r) + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +"# + diff --git a/src/assets/mise-extra.usage.kdl b/src/assets/mise-extra.usage.kdl new file mode 100644 index 000000000..41b4f2536 --- /dev/null +++ b/src/assets/mise-extra.usage.kdl @@ -0,0 +1,30 @@ +complete "alias" run="mise alias ls {{words[PREV]}} | awk '{print $2}'" +complete "config_file" type="file" +complete "new_plugin" run="mise plugins --all" +complete "plugin" run="mise plugins --core --user" +complete "prefix" run="mise ls-remote {{words[PREV]}}" +complete "setting" run="mise settings --keys" +complete "task" run="mise tasks | awk '{print $1}'" + +complete "tool@version" run=r#" +cur="{{words[CURRENT]}}" +case $cur in + *@*) + IFS='@' read -r -a parts <<< "$cur" + tool="${parts[0]}" + prefix="${parts[1]}" + + versions=$(mise ls-remote $tool $prefix | tail -r) + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +"# diff --git a/src/cli/activate.rs b/src/cli/activate.rs index 62bab6a4b..5a5608a74 100644 --- a/src/cli/activate.rs +++ b/src/cli/activate.rs @@ -120,9 +120,10 @@ fn is_dir_not_in_nix(dir: &Path) -> bool { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ eval "$(mise activate bash)" - $ eval "$(mise activate zsh)" - $ mise activate fish | source - $ execx($(mise activate xonsh)) + + $ eval "$(mise activate bash)" + $ eval "$(mise activate zsh)" + $ mise activate fish | source + $ execx($(mise activate xonsh)) "# ); diff --git a/src/cli/alias/get.rs b/src/cli/alias/get.rs index 8ba60364a..9cac3227e 100644 --- a/src/cli/alias/get.rs +++ b/src/cli/alias/get.rs @@ -31,8 +31,8 @@ impl AliasGet { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise alias get node lts-hydrogen - 20.0.0 + $ mise alias get node lts-hydrogen + 20.0.0 "# ); diff --git a/src/cli/alias/ls.rs b/src/cli/alias/ls.rs index 1e4678cab..1623e85b2 100644 --- a/src/cli/alias/ls.rs +++ b/src/cli/alias/ls.rs @@ -62,8 +62,9 @@ struct Row { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise aliases - node lts-hydrogen 20.0.0 + + $ mise aliases + node lts-hydrogen 20.0.0 "# ); diff --git a/src/cli/alias/set.rs b/src/cli/alias/set.rs index 31445cee6..b45b8de7d 100644 --- a/src/cli/alias/set.rs +++ b/src/cli/alias/set.rs @@ -28,7 +28,8 @@ impl AliasSet { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise alias set node lts-hydrogen 18.0.0 + + $ mise alias set node lts-hydrogen 18.0.0 "# ); diff --git a/src/cli/alias/unset.rs b/src/cli/alias/unset.rs index 1e5adfda6..6c385eb36 100644 --- a/src/cli/alias/unset.rs +++ b/src/cli/alias/unset.rs @@ -26,7 +26,8 @@ impl AliasUnset { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise alias unset node lts-hydrogen + + $ mise alias unset node lts-hydrogen "# ); diff --git a/src/cli/completion.rs b/src/cli/completion.rs index 549c1e631..03ddfb4b3 100644 --- a/src/cli/completion.rs +++ b/src/cli/completion.rs @@ -32,9 +32,10 @@ impl Completion { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise completion bash > /etc/bash_completion.d/mise - $ mise completion zsh > /usr/local/share/zsh/site-functions/_mise - $ mise completion fish > ~/.config/fish/completions/mise.fish + + $ mise completion bash > /etc/bash_completion.d/mise + $ mise completion zsh > /usr/local/share/zsh/site-functions/_mise + $ mise completion fish > ~/.config/fish/completions/mise.fish "# ); diff --git a/src/cli/config/generate.rs b/src/cli/config/generate.rs index fc880b533..d10c752a6 100644 --- a/src/cli/config/generate.rs +++ b/src/cli/config/generate.rs @@ -86,8 +86,9 @@ impl ConfigGenerate { // TODO: fill this out static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise cf generate > .mise.toml - $ mise cf generate --output=.mise.toml + + $ mise cf generate > .mise.toml + $ mise cf generate --output=.mise.toml "# ); diff --git a/src/cli/config/ls.rs b/src/cli/config/ls.rs index f7e85f2cb..e73889490 100644 --- a/src/cli/config/ls.rs +++ b/src/cli/config/ls.rs @@ -65,7 +65,8 @@ impl From<&dyn ConfigFile> for Row { // TODO: fill this out static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise config ls + + $ mise config ls "# ); diff --git a/src/cli/current.rs b/src/cli/current.rs index 0064a39ba..8fedc77e6 100644 --- a/src/cli/current.rs +++ b/src/cli/current.rs @@ -96,19 +96,19 @@ impl Current { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - # outputs `.tool-versions` compatible format - $ mise current - python 3.11.0 3.10.0 - shfmt 3.6.0 - shellcheck 0.9.0 - node 20.0.0 - - $ mise current node - 20.0.0 - - # can output multiple versions - $ mise current python - 3.11.0 3.10.0 + # outputs `.tool-versions` compatible format + $ mise current + python 3.11.0 3.10.0 + shfmt 3.6.0 + shellcheck 0.9.0 + node 20.0.0 + + $ mise current node + 20.0.0 + + # can output multiple versions + $ mise current python + 3.11.0 3.10.0 "# ); diff --git a/src/cli/deactivate.rs b/src/cli/deactivate.rs index 3f5d29bee..048b97c87 100644 --- a/src/cli/deactivate.rs +++ b/src/cli/deactivate.rs @@ -41,10 +41,11 @@ fn err_inactive() -> Result<()> { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise deactivate bash - $ mise deactivate zsh - $ mise deactivate fish - $ execx($(mise deactivate xonsh)) + + $ mise deactivate bash + $ mise deactivate zsh + $ mise deactivate fish + $ execx($(mise deactivate xonsh)) "# ); diff --git a/src/cli/direnv/activate.rs b/src/cli/direnv/activate.rs index 17ca2f201..7160cf876 100644 --- a/src/cli/direnv/activate.rs +++ b/src/cli/direnv/activate.rs @@ -29,8 +29,9 @@ impl DirenvActivate { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise direnv activate > ~/.config/direnv/lib/use_mise.sh - $ echo 'use mise' > .envrc - $ direnv allow + + $ mise direnv activate > ~/.config/direnv/lib/use_mise.sh + $ echo 'use mise' > .envrc + $ direnv allow "# ); diff --git a/src/cli/direnv/mod.rs b/src/cli/direnv/mod.rs index 627781e07..3db7c66f2 100644 --- a/src/cli/direnv/mod.rs +++ b/src/cli/direnv/mod.rs @@ -9,7 +9,7 @@ mod exec; /// Output direnv function to use mise inside direnv /// -/// See https://mise.rtx.dev/direnv.html for more information +/// See https://mise.jdx.dev/direnv.html for more information /// /// Because this generates the legacy files based on currently installed plugins, /// you should run this command after installing new plugins. Otherwise diff --git a/src/cli/doctor.rs b/src/cli/doctor.rs index d1c02feaf..39acf0d3b 100644 --- a/src/cli/doctor.rs +++ b/src/cli/doctor.rs @@ -258,7 +258,8 @@ fn indent(s: String) -> String { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise doctor - [WARN] plugin node is not installed + + $ mise doctor + [WARN] plugin node is not installed "# ); diff --git a/src/cli/env.rs b/src/cli/env.rs index f070fbedb..4b9df3135 100644 --- a/src/cli/env.rs +++ b/src/cli/env.rs @@ -59,10 +59,11 @@ impl Env { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ eval "$(mise env -s bash)" - $ eval "$(mise env -s zsh)" - $ mise env -s fish | source - $ execx($(mise env -s xonsh)) + + $ eval "$(mise env -s bash)" + $ eval "$(mise env -s zsh)" + $ mise env -s fish | source + $ execx($(mise env -s xonsh)) "# ); diff --git a/src/cli/exec.rs b/src/cli/exec.rs index 1e3cdef1d..d5fd3ca52 100644 --- a/src/cli/exec.rs +++ b/src/cli/exec.rs @@ -122,14 +122,15 @@ fn parse_command( static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise exec node@20 -- node ./app.js # launch app.js using node-20.x - $ mise x node@20 -- node ./app.js # shorter alias - # Specify command as a string: - $ mise exec node@20 python@3.11 --command "node -v && python -V" + $ mise exec node@20 -- node ./app.js # launch app.js using node-20.x + $ mise x node@20 -- node ./app.js # shorter alias - # Run a command in a different directory: - $ mise x -C /path/to/project node@20 -- node ./app.js + # Specify command as a string: + $ mise exec node@20 python@3.11 --command "node -v && python -V" + + # Run a command in a different directory: + $ mise x -C /path/to/project node@20 -- node ./app.js "# ); diff --git a/src/cli/global.rs b/src/cli/global.rs index bb23ea03b..5c274cd31 100644 --- a/src/cli/global.rs +++ b/src/cli/global.rs @@ -60,17 +60,17 @@ impl Global { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - # set the current version of node to 20.x - # will use a fuzzy version (e.g.: 20) in .tool-versions file - $ mise global --fuzzy node@20 + # set the current version of node to 20.x + # will use a fuzzy version (e.g.: 20) in .tool-versions file + $ mise global --fuzzy node@20 - # set the current version of node to 20.x - # will use a precise version (e.g.: 20.0.0) in .tool-versions file - $ mise global --pin node@20 + # set the current version of node to 20.x + # will use a precise version (e.g.: 20.0.0) in .tool-versions file + $ mise global --pin node@20 - # show the current version of node in ~/.tool-versions - $ mise global node - 20.0.0 + # show the current version of node in ~/.tool-versions + $ mise global node + 20.0.0 "# ); diff --git a/src/cli/install.rs b/src/cli/install.rs index 736b1d32b..ce7dc2d7e 100644 --- a/src/cli/install.rs +++ b/src/cli/install.rs @@ -128,10 +128,11 @@ impl Install { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise install node@20.0.0 # install specific node version - $ mise install node@20 # install fuzzy node version - $ mise install node # install version specified in .tool-versions or .mise.toml - $ mise install # installs everything specified in .tool-versions or .mise.toml + + $ mise install node@20.0.0 # install specific node version + $ mise install node@20 # install fuzzy node version + $ mise install node # install version specified in .tool-versions or .mise.toml + $ mise install # installs everything specified in .tool-versions or .mise.toml "# ); diff --git a/src/cli/latest.rs b/src/cli/latest.rs index 86dc8bf24..9afc117a1 100644 --- a/src/cli/latest.rs +++ b/src/cli/latest.rs @@ -55,11 +55,12 @@ impl Latest { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise latest node@20 # get the latest version of node 20 - 20.0.0 - $ mise latest node # get the latest stable version of node - 20.0.0 + $ mise latest node@20 # get the latest version of node 20 + 20.0.0 + + $ mise latest node # get the latest stable version of node + 20.0.0 "# ); diff --git a/src/cli/link.rs b/src/cli/link.rs index b26a208d2..7f2b7a8d8 100644 --- a/src/cli/link.rs +++ b/src/cli/link.rs @@ -66,14 +66,14 @@ impl Link { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - # build node-20.0.0 with node-build and link it into mise - $ node-build 20.0.0 ~/.nodes/20.0.0 - $ mise link node@20.0.0 ~/.nodes/20.0.0 + # build node-20.0.0 with node-build and link it into mise + $ node-build 20.0.0 ~/.nodes/20.0.0 + $ mise link node@20.0.0 ~/.nodes/20.0.0 - # have mise use the python version provided by Homebrew - $ brew install node - $ mise link node@brew $(brew --prefix node) - $ mise use node@brew + # have mise use the python version provided by Homebrew + $ brew install node + $ mise link node@brew $(brew --prefix node) + $ mise use node@brew "# ); diff --git a/src/cli/local.rs b/src/cli/local.rs index 39a86635b..b659abe28 100644 --- a/src/cli/local.rs +++ b/src/cli/local.rs @@ -136,23 +136,23 @@ pub fn local( static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - # set the current version of node to 20.x for the current directory - # will use a precise version (e.g.: 20.0.0) in .tool-versions file - $ mise local node@20 + # set the current version of node to 20.x for the current directory + # will use a precise version (e.g.: 20.0.0) in .tool-versions file + $ mise local node@20 - # set node to 20.x for the current project (recurses up to find .tool-versions) - $ mise local -p node@20 + # set node to 20.x for the current project (recurses up to find .tool-versions) + $ mise local -p node@20 - # set the current version of node to 20.x for the current directory - # will use a fuzzy version (e.g.: 20) in .tool-versions file - $ mise local --fuzzy node@20 + # set the current version of node to 20.x for the current directory + # will use a fuzzy version (e.g.: 20) in .tool-versions file + $ mise local --fuzzy node@20 - # removes node from .tool-versions - $ mise local --remove=node + # removes node from .tool-versions + $ mise local --remove=node - # show the current version of node in .tool-versions - $ mise local node - 20.0.0 + # show the current version of node in .tool-versions + $ mise local node + 20.0.0 "# ); diff --git a/src/cli/ls.rs b/src/cli/ls.rs index 3acb8657b..e7ffb9080 100644 --- a/src/cli/ls.rs +++ b/src/cli/ls.rs @@ -352,29 +352,30 @@ impl Display for VersionStatus { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise ls - node 20.0.0 ~/src/myapp/.tool-versions latest - python 3.11.0 ~/.tool-versions 3.10 - python 3.10.0 - - $ mise ls --current - node 20.0.0 ~/src/myapp/.tool-versions 20 - python 3.11.0 ~/.tool-versions 3.11.0 - - $ mise ls --json - { - "node": [ - { - "version": "20.0.0", - "install_path": "/Users/jdx/.mise/installs/node/20.0.0", - "source": { - "type": ".mise.toml", - "path": "/Users/jdx/.mise.toml" + + $ mise ls + node 20.0.0 ~/src/myapp/.tool-versions latest + python 3.11.0 ~/.tool-versions 3.10 + python 3.10.0 + + $ mise ls --current + node 20.0.0 ~/src/myapp/.tool-versions 20 + python 3.11.0 ~/.tool-versions 3.11.0 + + $ mise ls --json + { + "node": [ + { + "version": "20.0.0", + "install_path": "/Users/jdx/.mise/installs/node/20.0.0", + "source": { + "type": ".mise.toml", + "path": "/Users/jdx/.mise.toml" + } } - } - ], - "python": [...] - } + ], + "python": [...] + } "# ); diff --git a/src/cli/ls_remote.rs b/src/cli/ls_remote.rs index bd19ee7eb..abb9be740 100644 --- a/src/cli/ls_remote.rs +++ b/src/cli/ls_remote.rs @@ -99,17 +99,18 @@ impl LsRemote { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise ls-remote node - 18.0.0 - 20.0.0 - $ mise ls-remote node@20 - 20.0.0 - 20.1.0 + $ mise ls-remote node + 18.0.0 + 20.0.0 - $ mise ls-remote node 20 - 20.0.0 - 20.1.0 + $ mise ls-remote node@20 + 20.0.0 + 20.1.0 + + $ mise ls-remote node 20 + 20.0.0 + 20.1.0 "# ); diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 28b180692..b4591558b 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -50,6 +50,7 @@ mod trust; mod uninstall; mod unset; mod upgrade; +mod usage; mod r#use; pub mod version; mod watch; @@ -96,8 +97,9 @@ pub enum Commands { Tasks(tasks::Tasks), Trust(trust::Trust), Uninstall(uninstall::Uninstall), - Upgrade(upgrade::Upgrade), Unset(unset::Unset), + Upgrade(upgrade::Upgrade), + Usage(usage::Usage), Use(r#use::Use), Version(version::Version), Watch(watch::Watch), @@ -155,6 +157,7 @@ impl Commands { Self::Uninstall(cmd) => cmd.run(), Self::Unset(cmd) => cmd.run(), Self::Upgrade(cmd) => cmd.run(), + Self::Usage(cmd) => cmd.run(), Self::Use(cmd) => cmd.run(), Self::Version(cmd) => cmd.run(), Self::Watch(cmd) => cmd.run(), @@ -232,31 +235,32 @@ https://asdf-vm.com/"}; static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise install node@20.0.0 Install a specific node version - $ mise install node@20 Install a version matching a prefix - $ mise install node Install the node version defined in config - $ mise install Install all plugins/tools defined in config + + $ mise install node@20.0.0 Install a specific node version + $ mise install node@20 Install a version matching a prefix + $ mise install node Install the node version defined in config + $ mise install Install all plugins/tools defined in config - $ mise install cargo:ripgrep Install something via cargo - $ mise install npm:prettier Install something via npm + $ mise install cargo:ripgrep Install something via cargo + $ mise install npm:prettier Install something via npm - $ mise use node@20 Use node-20.x in current project - $ mise use -g node@20 Use node-20.x as default - $ mise use node@latest Use latest node in current directory - $ mise use -g node@system Use system node everywhere unless overridden + $ mise use node@20 Use node-20.x in current project + $ mise use -g node@20 Use node-20.x as default + $ mise use node@latest Use latest node in current directory + $ mise use -g node@system Use system node everywhere unless overridden - $ mise up --interactive Show a menu to upgrade tools + $ mise up --interactive Show a menu to upgrade tools - $ mise x -- npm install `npm install` w/ config loaded into PATH - $ mise x node@20 -- node app.js `node app.js` w/ config + node-20.x on PATH + $ mise x -- npm install `npm install` w/ config loaded into PATH + $ mise x node@20 -- node app.js `node app.js` w/ config + node-20.x on PATH - $ mise set NODE_ENV=production Set NODE_ENV=production in config + $ mise set NODE_ENV=production Set NODE_ENV=production in config - $ mise run build Run `build` tasks - $ mise watch build Run `build` tasks repeatedly when files change + $ mise run build Run `build` tasks + $ mise watch build Run `build` tasks repeatedly when files change - $ mise settings Show settings in use - $ mise settings set color 0 Disable color by modifying global config file + $ mise settings Show settings in use + $ mise settings set color 0 Disable color by modifying global config file "# ); diff --git a/src/cli/outdated.rs b/src/cli/outdated.rs index 0c5b4c143..ba6cb6acc 100644 --- a/src/cli/outdated.rs +++ b/src/cli/outdated.rs @@ -110,14 +110,15 @@ type OutputVec = Vec<(Arc, ToolVersion, String)>; static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise outdated - Plugin Requested Current Latest - python 3.11 3.11.0 3.11.1 - node 20 20.0.0 20.1.0 - $ mise outdated node - Plugin Requested Current Latest - node 20 20.0.0 20.1.0 + $ mise outdated + Plugin Requested Current Latest + python 3.11 3.11.0 3.11.1 + node 20 20.0.0 20.1.0 + + $ mise outdated node + Plugin Requested Current Latest + node 20 20.0.0 20.1.0 "# ); diff --git a/src/cli/plugins/install.rs b/src/cli/plugins/install.rs index 97a2a2844..474ffcab0 100644 --- a/src/cli/plugins/install.rs +++ b/src/cli/plugins/install.rs @@ -150,18 +150,18 @@ fn get_name_from_url(url: &str) -> Result { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - # install the node via shorthand - $ mise plugins install node + # install the node via shorthand + $ mise plugins install node - # install the node plugin using a specific git url - $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git + # install the node plugin using a specific git url + $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git - # install the node plugin using the git url only - # (node is inferred from the url) - $ mise plugins install https://github.com/mise-plugins/rtx-nodejs.git + # install the node plugin using the git url only + # (node is inferred from the url) + $ mise plugins install https://github.com/mise-plugins/rtx-nodejs.git - # install the node plugin using a specific ref - $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git#v1.0.0 + # install the node plugin using a specific ref + $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git#v1.0.0 "# ); diff --git a/src/cli/plugins/link.rs b/src/cli/plugins/link.rs index 1defdfceb..984899f42 100644 --- a/src/cli/plugins/link.rs +++ b/src/cli/plugins/link.rs @@ -69,11 +69,11 @@ fn get_name_from_path(path: &Path) -> String { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - # essentially just `ln -s ./mise-node ~/.local/share/mise/plugins/node` - $ mise plugins link node ./mise-node + # essentially just `ln -s ./mise-node ~/.local/share/mise/plugins/node` + $ mise plugins link node ./mise-node - # infer plugin name as "node" - $ mise plugins link ./mise-node + # infer plugin name as "node" + $ mise plugins link ./mise-node "# ); diff --git a/src/cli/plugins/ls.rs b/src/cli/plugins/ls.rs index ca5ccb3ba..e731489b4 100644 --- a/src/cli/plugins/ls.rs +++ b/src/cli/plugins/ls.rs @@ -106,13 +106,14 @@ struct Row { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise plugins ls - node - ruby - $ mise plugins ls --urls - node https://github.com/asdf-vm/asdf-nodejs.git - ruby https://github.com/asdf-vm/asdf-ruby.git + $ mise plugins ls + node + ruby + + $ mise plugins ls --urls + node https://github.com/asdf-vm/asdf-nodejs.git + ruby https://github.com/asdf-vm/asdf-ruby.git "# ); diff --git a/src/cli/plugins/uninstall.rs b/src/cli/plugins/uninstall.rs index f3f3bf1d7..1989c4fce 100644 --- a/src/cli/plugins/uninstall.rs +++ b/src/cli/plugins/uninstall.rs @@ -60,6 +60,7 @@ impl PluginsUninstall { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise uninstall node + + $ mise uninstall node "# ); diff --git a/src/cli/plugins/update.rs b/src/cli/plugins/update.rs index d68c47266..59cb8fe2d 100644 --- a/src/cli/plugins/update.rs +++ b/src/cli/plugins/update.rs @@ -61,9 +61,10 @@ impl Update { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise plugins update # update all plugins - $ mise plugins update node # update only node - $ mise plugins update node#beta # specify a ref + + $ mise plugins update # update all plugins + $ mise plugins update node # update only node + $ mise plugins update node#beta # specify a ref "# ); diff --git a/src/cli/prune.rs b/src/cli/prune.rs index ae3b3e6c2..b89d0e073 100644 --- a/src/cli/prune.rs +++ b/src/cli/prune.rs @@ -74,9 +74,10 @@ impl Prune { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise prune --dry-run - rm -rf ~/.local/share/mise/versions/node/20.0.0 - rm -rf ~/.local/share/mise/versions/node/20.0.1 + + $ mise prune --dry-run + rm -rf ~/.local/share/mise/versions/node/20.0.0 + rm -rf ~/.local/share/mise/versions/node/20.0.1 "# ); diff --git a/src/cli/render_completion.rs b/src/cli/render_completion.rs index 1c9f984e0..58f51fc25 100644 --- a/src/cli/render_completion.rs +++ b/src/cli/render_completion.rs @@ -18,6 +18,10 @@ pub struct RenderCompletion { /// Shell type to generate completions for #[clap(long = "shell", short = 's', hide = true)] shell_type: Option, + + /// Use usage for completions + #[clap(long, verbatim_doc_comment)] + usage: bool, } impl RenderCompletion { @@ -26,6 +30,21 @@ impl RenderCompletion { let mut cmd = crate::cli::Cli::command(); + if self.usage { + let shell = shell.to_string(); + cmd!( + "usage", + "generate", + "completion", + &shell, + "mise", + "--usage-cmd", + "mise usage" + ) + .run()?; + return Ok(()); + } + let script = match shell { clap_complete::Shell::Zsh => completions::zsh_complete(&cmd)?, clap_complete::Shell::Fish => completions::fish_complete(&cmd)?, diff --git a/src/cli/reshim.rs b/src/cli/reshim.rs index 4151ee039..a778a63ad 100644 --- a/src/cli/reshim.rs +++ b/src/cli/reshim.rs @@ -39,8 +39,9 @@ impl Reshim { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise reshim - $ ~/.local/share/mise/shims/node -v - v20.0.0 + + $ mise reshim + $ ~/.local/share/mise/shims/node -v + v20.0.0 "# ); diff --git a/src/cli/run.rs b/src/cli/run.rs index f52cafad4..e221800ea 100644 --- a/src/cli/run.rs +++ b/src/cli/run.rs @@ -534,22 +534,23 @@ fn last_modified_file(files: impl IntoIterator) -> Result - $ mise run lint - Runs the "lint" tasks. This needs to either be defined in .mise.toml - or as a standalone script. See the project README for more information. - $ mise run build --force - Forces the "build" tasks to run even if its sources are up-to-date. + # Runs the "lint" tasks. This needs to either be defined in .mise.toml + # or as a standalone script. See the project README for more information. + $ mise run lint - $ mise run test --raw - Runs "test" with stdin/stdout/stderr all connected to the current terminal. - This forces `--jobs=1` to prevent interleaving of output. + # Forces the "build" tasks to run even if its sources are up-to-date. + $ mise run build --force - $ mise run lint ::: test ::: check - Runs the "lint", "test", and "check" tasks in parallel. + # Run "test" with stdin/stdout/stderr all connected to the current terminal. + # This forces `--jobs=1` to prevent interleaving of output. + $ mise run test --raw - $ mise tasks cmd1 arg1 arg2 ::: cmd2 arg1 arg2 - Execute multiple tasks each with their own arguments. + # Runs the "lint", "test", and "check" tasks in parallel. + $ mise run lint ::: test ::: check + + # Execute multiple tasks each with their own arguments. + $ mise tasks cmd1 arg1 arg2 ::: cmd2 arg1 arg2 "# ); diff --git a/src/cli/set.rs b/src/cli/set.rs index 3afb3a13c..959039231 100644 --- a/src/cli/set.rs +++ b/src/cli/set.rs @@ -112,14 +112,15 @@ struct Row { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise set NODE_ENV=production - $ mise set NODE_ENV - production + $ mise set NODE_ENV=production - $ mise set - key value source - NODE_ENV production ~/.config/mise/config.toml + $ mise set NODE_ENV + production + + $ mise set + key value source + NODE_ENV production ~/.config/mise/config.toml "# ); diff --git a/src/cli/settings/get.rs b/src/cli/settings/get.rs index 8660c95a2..3de3b7e8f 100644 --- a/src/cli/settings/get.rs +++ b/src/cli/settings/get.rs @@ -38,8 +38,9 @@ impl SettingsGet { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise settings get legacy_version_file - true + + $ mise settings get legacy_version_file + true "# ); diff --git a/src/cli/settings/ls.rs b/src/cli/settings/ls.rs index e386b2e71..70619bd27 100644 --- a/src/cli/settings/ls.rs +++ b/src/cli/settings/ls.rs @@ -10,7 +10,11 @@ use crate::config::Settings; /// but managed separately with `mise aliases` #[derive(Debug, clap::Args)] #[clap(visible_alias = "list", after_long_help = AFTER_LONG_HELP, verbatim_doc_comment)] -pub struct SettingsLs {} +pub struct SettingsLs { + /// Only display key names for each setting + #[clap(long, verbatim_doc_comment)] + pub keys: bool, +} impl SettingsLs { pub fn run(self) -> Result<()> { @@ -19,15 +23,31 @@ impl SettingsLs { for k in Settings::hidden_configs() { settings.remove(*k); } + if self.keys { + return self.print_keys(&settings); + } miseprintln!("{}", settings)?; Ok(()) } + + fn print_keys(&self, settings: &toml::Table) -> Result<()> { + for (k, v) in settings { + miseprintln!("{k}")?; + if let toml::Value::Table(t) = v { + for (subkey, _) in t { + miseprintln!("{k}.{subkey}")?; + } + } + } + Ok(()) + } } static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise settings - legacy_version_file = false + + $ mise settings + legacy_version_file = false "# ); @@ -78,4 +98,47 @@ mod tests { show_tools = false "###); } + + #[test] + fn test_settings_ls_keys() { + reset_config(); + assert_cli_snapshot!("settings", "--keys", @r###" + activate_aggressive + all_compile + always_keep_download + always_keep_install + asdf_compat + cargo_binstall + color + disable_default_shorthands + disable_tools + experimental + go_default_packages_file + go_download_mirror + go_repo + go_set_gopath + go_set_goroot + go_skip_checksum + jobs + legacy_version_file + legacy_version_file_disable_tools + node_compile + not_found_auto_install + paranoid + plugin_autoupdate_last_check_duration + python_compile + python_default_packages_file + python_pyenv_repo + python_venv_auto_create + quiet + raw + status + status.missing_tools + status.show_env + status.show_tools + trusted_config_paths + verbose + yes + "###); + } } diff --git a/src/cli/settings/mod.rs b/src/cli/settings/mod.rs index 129fbc6cf..0f7d0ae6e 100644 --- a/src/cli/settings/mod.rs +++ b/src/cli/settings/mod.rs @@ -11,6 +11,10 @@ mod unset; pub struct Settings { #[clap(subcommand)] command: Option, + + /// Only display key names for each setting + #[clap(long, verbatim_doc_comment)] + keys: bool, } #[derive(Debug, Subcommand)] @@ -34,7 +38,9 @@ impl Commands { impl Settings { pub fn run(self) -> Result<()> { - let cmd = self.command.unwrap_or(Commands::Ls(ls::SettingsLs {})); + let cmd = self + .command + .unwrap_or(Commands::Ls(ls::SettingsLs { keys: self.keys })); cmd.run() } diff --git a/src/cli/settings/set.rs b/src/cli/settings/set.rs index eabe748ea..b6a22d564 100644 --- a/src/cli/settings/set.rs +++ b/src/cli/settings/set.rs @@ -101,7 +101,8 @@ fn parse_i64(value: &str) -> Result { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise settings set legacy_version_file true + + $ mise settings set legacy_version_file true "# ); diff --git a/src/cli/settings/unset.rs b/src/cli/settings/unset.rs index fd139aea3..116d916a2 100644 --- a/src/cli/settings/unset.rs +++ b/src/cli/settings/unset.rs @@ -25,7 +25,8 @@ impl SettingsUnset { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise settings unset legacy_version_file + + $ mise settings unset legacy_version_file "# ); diff --git a/src/cli/shell.rs b/src/cli/shell.rs index 828943695..85c11cc96 100644 --- a/src/cli/shell.rs +++ b/src/cli/shell.rs @@ -83,9 +83,10 @@ fn err_inactive() -> Result<()> { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise shell node@20 - $ node -v - v20.0.0 + + $ mise shell node@20 + $ node -v + v20.0.0 "# ); diff --git a/src/cli/sync/node.rs b/src/cli/sync/node.rs index ed315c05f..9457bb9f7 100644 --- a/src/cli/sync/node.rs +++ b/src/cli/sync/node.rs @@ -106,8 +106,9 @@ impl SyncNode { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ brew install node@18 node@20 - $ mise sync node --brew - $ mise use -g node@18 - uses Homebrew-provided node + + $ brew install node@18 node@20 + $ mise sync node --brew + $ mise use -g node@18 - uses Homebrew-provided node "# ); diff --git a/src/cli/sync/python.rs b/src/cli/sync/python.rs index c2884addb..6431c7e94 100644 --- a/src/cli/sync/python.rs +++ b/src/cli/sync/python.rs @@ -42,9 +42,10 @@ impl SyncPython { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ pyenv install 3.11.0 - $ mise sync python --pyenv - $ mise use -g python@3.11.0 - uses pyenv-provided python + + $ pyenv install 3.11.0 + $ mise sync python --pyenv + $ mise use -g python@3.11.0 - uses pyenv-provided python "# ); diff --git a/src/cli/tasks/deps.rs b/src/cli/tasks/deps.rs index ed494f6a8..5cabdf7a3 100644 --- a/src/cli/tasks/deps.rs +++ b/src/cli/tasks/deps.rs @@ -144,14 +144,15 @@ impl TasksDeps { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise tasks deps - Shows dependencies for all tasks - $ mise tasks deps lint test check - Shows dependencies for the "lint", "test" and "check" tasks + # Show dependencies for all tasks + $ mise tasks deps - $ mise tasks deps --dot - Shows dependencies in DOT format + # Show dependencies for the "lint", "test" and "check" tasks + $ mise tasks deps lint test check + + # Show dependencies in DOT format + $ mise tasks deps --dot "# ); diff --git a/src/cli/tasks/edit.rs b/src/cli/tasks/edit.rs index af8ee6cd3..1ac98a581 100644 --- a/src/cli/tasks/edit.rs +++ b/src/cli/tasks/edit.rs @@ -59,7 +59,8 @@ impl TasksEdit { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise tasks edit build - $ mise tasks edit test + + $ mise tasks edit build + $ mise tasks edit test "# ); diff --git a/src/cli/tasks/ls.rs b/src/cli/tasks/ls.rs index de8e86d7b..f8d689ea5 100644 --- a/src/cli/tasks/ls.rs +++ b/src/cli/tasks/ls.rs @@ -77,7 +77,8 @@ fn truncate(s: &str, len: usize) -> String { // TODO: fill this out static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise tasks ls + + $ mise tasks ls "# ); diff --git a/src/cli/trust.rs b/src/cli/trust.rs index 01065c440..48795ae17 100644 --- a/src/cli/trust.rs +++ b/src/cli/trust.rs @@ -85,11 +85,11 @@ impl Trust { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - # trusts ~/some_dir/.mise.toml - $ mise trust ~/some_dir/.mise.toml + # trusts ~/some_dir/.mise.toml + $ mise trust ~/some_dir/.mise.toml - # trusts .mise.toml in the current or parent directory - $ mise trust + # trusts .mise.toml in the current or parent directory + $ mise trust "# ); diff --git a/src/cli/uninstall.rs b/src/cli/uninstall.rs index 3f77cb068..bc0af27ce 100644 --- a/src/cli/uninstall.rs +++ b/src/cli/uninstall.rs @@ -125,8 +125,9 @@ impl Uninstall { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise uninstall node@18.0.0 # will uninstall specific version - $ mise uninstall node # will uninstall current node version - $ mise uninstall --all node@18.0.0 # will uninstall all node versions + + $ mise uninstall node@18.0.0 # will uninstall specific version + $ mise uninstall node # will uninstall current node version + $ mise uninstall --all node@18.0.0 # will uninstall all node versions "# ); diff --git a/src/cli/usage.rs b/src/cli/usage.rs new file mode 100644 index 000000000..614594a2f --- /dev/null +++ b/src/cli/usage.rs @@ -0,0 +1,18 @@ +use crate::cli; +use clap::builder::Resettable; +use eyre::Result; + +/// Generate usage spec +#[derive(Debug, clap::Args)] +#[clap(verbatim_doc_comment)] +pub struct Usage {} + +impl Usage { + pub fn run(self) -> Result<()> { + let cli = cli::Cli::command().version(Resettable::Reset); + let spec: usage::Spec = cli.into(); + let extra = include_str!("../assets/mise-extra.usage.kdl"); + println!("{spec}\n{extra}"); + Ok(()) + } +} diff --git a/src/cli/use.rs b/src/cli/use.rs index 60ec197c8..0c523c06c 100644 --- a/src/cli/use.rs +++ b/src/cli/use.rs @@ -200,19 +200,20 @@ fn config_file_from_dir(p: &Path) -> PathBuf { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - # set the current version of node to 20.x in .mise.toml of current directory - # will write the fuzzy version (e.g.: 20) - $ mise use node@20 - # set the current version of node to 20.x in ~/.config/mise/config.toml - # will write the precise version (e.g.: 20.0.0) - $ mise use -g --pin node@20 + # set the current version of node to 20.x in .mise.toml of current directory + # will write the fuzzy version (e.g.: 20) + $ mise use node@20 - # sets .mise.local.toml (which is intended not to be committed to a project) - $ mise use --env local node@20 + # set the current version of node to 20.x in ~/.config/mise/config.toml + # will write the precise version (e.g.: 20.0.0) + $ mise use -g --pin node@20 - # sets .mise.staging.toml (which is used if MISE_ENV=staging) - $ mise use --env staging node@20 + # sets .mise.local.toml (which is intended not to be committed to a project) + $ mise use --env local node@20 + + # sets .mise.staging.toml (which is used if MISE_ENV=staging) + $ mise use --env staging node@20 "# ); diff --git a/src/cli/watch.rs b/src/cli/watch.rs index 4e694c44c..9479e55f6 100644 --- a/src/cli/watch.rs +++ b/src/cli/watch.rs @@ -124,15 +124,15 @@ impl Watch { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise watch -t build - Runs the "build" tasks. Will re-run the tasks when any of its sources change. - Uses "sources" from the tasks definition to determine which files to watch. + $ mise watch -t build + Runs the "build" tasks. Will re-run the tasks when any of its sources change. + Uses "sources" from the tasks definition to determine which files to watch. - $ mise watch -t build --glob src/**/*.rs - Runs the "build" tasks but specify the files to watch with a glob pattern. - This overrides the "sources" from the tasks definition. + $ mise watch -t build --glob src/**/*.rs + Runs the "build" tasks but specify the files to watch with a glob pattern. + This overrides the "sources" from the tasks definition. - $ mise run -t build --clear - Extra arguments are passed to watchexec. See `watchexec --help` for details. + $ mise run -t build --clear + Extra arguments are passed to watchexec. See `watchexec --help` for details. "# ); diff --git a/src/cli/where.rs b/src/cli/where.rs index d55194479..272d36edf 100644 --- a/src/cli/where.rs +++ b/src/cli/where.rs @@ -69,15 +69,15 @@ impl Where { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - # Show the latest installed version of node - # If it is is not installed, errors - $ mise where node@20 - /home/jdx/.local/share/mise/installs/node/20.0.0 + # Show the latest installed version of node + # If it is is not installed, errors + $ mise where node@20 + /home/jdx/.local/share/mise/installs/node/20.0.0 - # Show the current, active install directory of node - # Errors if node is not referenced in any .tool-version file - $ mise where node - /home/jdx/.local/share/mise/installs/node/20.0.0 + # Show the current, active install directory of node + # Errors if node is not referenced in any .tool-version file + $ mise where node + /home/jdx/.local/share/mise/installs/node/20.0.0 "# ); diff --git a/src/cli/which.rs b/src/cli/which.rs index b597426b0..ce2986b1e 100644 --- a/src/cli/which.rs +++ b/src/cli/which.rs @@ -71,12 +71,13 @@ impl Which { static AFTER_LONG_HELP: &str = color_print::cstr!( r#"Examples: - $ mise which node - /home/username/.local/share/mise/installs/node/20.0.0/bin/node - $ mise which node --plugin - node - $ mise which node --version - 20.0.0 + + $ mise which node + /home/username/.local/share/mise/installs/node/20.0.0/bin/node + $ mise which node --plugin + node + $ mise which node --version + 20.0.0 "# );