### Quick Start: Generate Usage Spec Source: https://github.com/jdx/usage/blob/main/docs/spec/integrations/clap.md A basic example demonstrating how to create a clap Command and generate its usage specification to a buffer. ```rust use clap::Command; let mut cmd = Command::new("mycli") .version("1.0") .arg(clap::Arg::new("input")); let mut buf = Vec::new(); clap_usage::generate(&mut cmd, "mycli", &mut buf); println!("{}", String::from_utf8(buf).unwrap()); ``` -------------------------------- ### Example CLI Usage Source: https://github.com/jdx/usage/blob/main/integrations/cobra/README.md Navigate to the example directory and run the example CLI with the --usage-spec flag to see the generated output. ```bash cd example go run . --usage-spec ``` -------------------------------- ### Run Example CLI Source: https://github.com/jdx/usage/blob/main/docs/spec/integrations/cobra.md Navigate to the example directory and run the example CLI with the --usage-spec flag to generate its usage specification. ```bash cd integrations/cobra/example go run . --usage-spec ``` -------------------------------- ### Define Command Examples Source: https://github.com/jdx/usage/blob/main/docs/spec/reference/cmd.md Provide examples for a command to illustrate its usage. Examples can be simple or show specific output formats like JSON. ```kdl cmd "list" { example "Basic usage" r#"$ $ mycli list FRUIT COLOR apple red banana yellow "# example "JSON output" r#"$ $ mycli list --json [ {"FRUIT": "apple", "COLOR": "red"}, {"FRUIT": "banana", "COLOR": "yellow"} ] "# } ``` -------------------------------- ### Install Cobra Integration Source: https://github.com/jdx/usage/blob/main/docs/spec/integrations/cobra.md Install the Cobra integration package using go get. ```bash go get github.com/jdx/usage/integrations/cobra ``` -------------------------------- ### Install with cargo-binstall Source: https://github.com/jdx/usage/blob/main/docs/cli/index.md Use cargo-binstall for a potentially quicker installation of the usage CLI. Ensure cargo-binstall is installed first. ```sh cargo binstall usage-cli ``` -------------------------------- ### Install All Configured Tools Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/install.md Installs all tool versions that are defined in your `.tool-versions` or `.mise.toml` configuration files. ```bash $ mise install # installs everything specified in .tool-versions or .mise.toml ``` -------------------------------- ### Install All Versions from Config Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Installs all tool versions defined in the `mise.toml` configuration file for the current directory. ```bash $ mise install # installs everything specified in mise.toml ``` -------------------------------- ### Install with Homebrew Source: https://github.com/jdx/usage/blob/main/docs/cli/index.md Install the usage CLI using the Homebrew package manager on macOS and Linux. Ensure Homebrew is installed. ```sh brew install usage ``` -------------------------------- ### Command-Level Examples Source: https://github.com/jdx/usage/blob/main/docs/spec/reference/index.md Adds usage examples specific to a particular command within the CLI. These examples can include command-specific flags and options. ```kdl cmd "deploy" { flag "-e --environment " help="Target environment" example "demo deploy -e prod" header="Basic deployment" help="Deploy to production environment" example "demo deploy -e staging --force" header="Force deployment" } ``` -------------------------------- ### Install Node Version from Configuration Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/install.md Installs the version of a tool that is specified in your `.tool-versions` or `.mise.toml` configuration file. ```bash $ mise install node # install version specified in .tool-versions or .mise.toml ``` -------------------------------- ### Install with mise-en-place Source: https://github.com/jdx/usage/blob/main/docs/cli/index.md Use mise to manage global tool versions. Ensure mise is installed and configured before running. ```sh mise use -g usage ``` -------------------------------- ### Install Plugin by Git URL with Specific Ref Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/plugins/install.md Installs a plugin using its Git URL and specifies a particular version or tag (ref) to install. ```bash $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git#v1.0.0 ``` -------------------------------- ### Install Specific Node Version Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/install.md Use this to install a precise version of a tool. For example, to install Node.js version 20.0.0. ```bash $ mise install node@20.0.0 # install specific node version ``` -------------------------------- ### Install Fuzzy Node Version Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/install.md Use this to install a version that matches a pattern, such as any version starting with '20'. ```bash $ mise install node@20 # install fuzzy node version ``` -------------------------------- ### Install Bash Completion File with CMakeLists.txt Source: https://github.com/jdx/usage/blob/main/lib/bash-completion/README.md Configure CMake to install completion files to the appropriate directory. This is an alternative to using Makefiles for managing installation. ```cmake install(FILES your-completion-file DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/bash-completion/completions") ``` -------------------------------- ### Install Plugin by Shorthand Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/plugins/install.md Installs a plugin using its shorthand name. Mise will automatically resolve the Git URL for common plugins. ```bash $ mise plugins install node ``` -------------------------------- ### Install Plugin by Git URL Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/plugins/install.md Installs a plugin by providing its full Git repository URL. The plugin name is inferred from the URL. ```bash $ mise plugins install https://github.com/mise-plugins/rtx-nodejs.git ``` -------------------------------- ### Install Bash-Completion using Autotools Source: https://github.com/jdx/usage/blob/main/lib/bash-completion/README.md Standard commands for installing bash-completion from source using GNU autotools. Ensure GNU make is used. Installation requires root privileges. ```shell autoreconf -i # if not installing from prepared release tarball ./configure make # GNU make required make check # optional make install # as root make installcheck # optional, requires python3 with pytest >= 3.6, pexpect ``` -------------------------------- ### mise install Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Installs a specified tool version. Tools are installed in parallel by default. ```APIDOC ## `mise install` ### Description Install a tool version. Tools will be installed in parallel. To disable, set `--jobs=1` or `MISE_JOBS=1`. ### Usage `mise install [FLAGS] [TOOL@VERSION]…` ### Aliases `i` ### Arguments #### `[TOOL@VERSION]…` Tool(s) to install, e.g.: `node@20`. ### Flags #### `-f --force` Force reinstall even if already installed. #### `-j --jobs ` Number of jobs to run in parallel. [default: 4] #### `--raw` Directly pipe stdin/stdout/stderr from plugin to user. Sets `--jobs=1`. #### `-v --verbose…` Show installation output, including download, configuration, and compilation. ### Examples ```bash $ 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 mise.toml $ mise install # installs everything specified in mise.toml ``` ``` -------------------------------- ### List Installed Plugins Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/plugins/ls.md Use this command to see a list of plugins that are currently installed. This is the default behavior. ```bash mise plugins ls ``` -------------------------------- ### Install Manpage to System Source: https://github.com/jdx/usage/blob/main/docs/cli/manpages.md Generates a manpage, pipes it to the system man directory, and updates the man database. ```bash $ usage generate manpage -f ./mycli.usage.kdl | sudo tee /usr/share/man/man1/mycli.1 $ sudo mandb # Update the man database $ man mycli ``` -------------------------------- ### Install Plugin by Name and Git URL Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/plugins/install.md Installs a plugin by specifying both its name and its Git repository URL. This is useful for plugins that might have ambiguous names or when you want to be explicit. ```bash $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git ``` -------------------------------- ### Install Mise Plugin Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Installs a new plugin for mise, either by shorthand name or by providing a git URL. Can force reinstallation and install all missing plugins. ```bash # install the node via shorthand $ mise plugins install node ``` ```bash # install the node plugin using a specific git url $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git ``` ```bash # 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 ``` ```bash # install the node plugin using a specific ref $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git#v1.0.0 ``` -------------------------------- ### Show Latest Installed Version of Node Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/where.md Use this command to display the installation path of the latest installed version of Node that matches the specified prefix (e.g., `node@20`). Errors if the tool is not installed. ```bash $ mise where node@20 /home/jdx/.local/share/mise/installs/node/20.0.0 ``` -------------------------------- ### Install with Cargo Source: https://github.com/jdx/usage/blob/main/docs/cli/index.md Install the usage CLI using Cargo, Rust's package manager. Requires Rust and Cargo to be installed. ```sh cargo install usage-cli ``` -------------------------------- ### mise where Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Displays the installation path for a specified tool. The tool must be installed for this command to work. ```APIDOC ## `mise where` ### Description Display the installation path for a tool. The tool must be installed for this to work. ### Arguments #### `` Tool(s) to look up e.g.: ruby@3 if "@" is specified, it will show the latest installed version that matches the prefix 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 ``` -------------------------------- ### Install and Add Tool Version to Local Config Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Installs a specified tool version if it's not already installed and adds it to the local `mise.toml` file. If no version is specified, it defaults to `@latest`. ```bash mise use ubi:BurntSushi/ripgrep[exe=rg] ``` ```bash mise use --fuzzy node@20 ``` -------------------------------- ### Start New Shell with mise en Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Starts a new shell with the mise environment built from the current configuration. This is an alternative to `mise activate` for explicitly starting a mise session. ```bash $ mise en . $ node -v v20.0.0 ``` ```bash Skip loading bashrc: $ mise en -s "bash --norc" ``` ```bash Skip loading zshrc: $ mise en -s "zsh -f" ``` -------------------------------- ### Install with Pacman (Arch Linux) Source: https://github.com/jdx/usage/blob/main/docs/cli/index.md Install the usage CLI on Arch Linux using Pacman. The package is available in the 'extra' repository. ```sh pacman -S usage ``` -------------------------------- ### Install Node.js into Specific Path Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Installs a specific version of Node.js into a designated directory, useful for custom builds or isolated environments. It also shows how to immediately execute the installed binary. ```bash # install node@20.0.0 into ./mynode $ mise install-into node@20.0.0 ./mynode && ./mynode/bin/node -v 20.0.0 ``` -------------------------------- ### Install Node Version from Config Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Installs the Node.js version specified in the `mise.toml` configuration file for the current directory. ```bash $ mise install node # install version specified in mise.toml ``` -------------------------------- ### Find Tool Installation Path with Mise Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Display the installation path for a specific tool version or the currently active version. The tool must be installed for this command to succeed. ```bash # 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 ``` ```bash # 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 ``` -------------------------------- ### KDL Spec Format Example Source: https://github.com/jdx/usage/blob/main/CLAUDE.md An example demonstrating the KDL syntax for defining a CLI specification, including name, binary, flags, arguments, subcommands, and completion rules. ```kdl name "mycli" bin "mycli" flag "-v --verbose" help="Enable verbose output" arg "" help="Input file" cmd "subcommand" { flag "--force" arg "[optional]" } complete "input" run="find . -name '*.txt'" ``` -------------------------------- ### List Installed and Active Tool Versions with Mise Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Use `mise ls` to list installed and active tool versions. Flags like `--current`, `--installed`, and `--json` allow filtering and formatting the output. ```bash $ mise ls node 20.0.0 ~/src/myapp/.tool-versions latest python 3.11.0 ~/.tool-versions 3.10 python 3.10.0 ``` ```bash $ mise ls --current node 20.0.0 ~/src/myapp/.tool-versions 20 python 3.11.0 ~/.tool-versions 3.11.0 ``` ```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": [...] ``` -------------------------------- ### mise where Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Displays the installation path for a specified tool. The tool must be installed for this command to work. It supports looking up specific versions or the latest matching a prefix. ```APIDOC ## `mise where` ### Description Display the installation path for a tool The tool must be installed for this to work. ### Arguments #### `` Tool(s) to look up e.g.: ruby@3 if "@" is specified, it will show the latest installed version that matches the prefix 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 ``` -------------------------------- ### mise install-into Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Installs a tool version into a specific directory, useful for building tools for external use. ```APIDOC ## `mise install-into` ### Description Install a tool version to a specific path. Used for building a tool to a directory for use outside of mise. ### Usage `mise install-into ` ### Arguments #### `` Tool to install, e.g.: `node@20`. #### `` Path to install the tool into. ### Examples ```bash # install node@20.0.0 into ./mynode $ mise install-into node@20.0.0 ./mynode && ./mynode/bin/node -v 20.0.0 ``` ``` -------------------------------- ### Spec-Level Examples Source: https://github.com/jdx/usage/blob/main/docs/spec/reference/index.md Defines general usage examples for a CLI at the top level of the specification. These are displayed in markdown and manpage documentation. ```kdl name "demo" bin "demo" example "demo --help" header="Getting help" help="Display help information for the demo command" example "demo --version" header="Check version" help="Show the installed version of demo" ``` -------------------------------- ### Quick Start Cobra Integration Source: https://github.com/jdx/usage/blob/main/docs/spec/integrations/cobra.md Generate and print the usage spec in KDL format for a Cobra command tree. ```go import cobra_usage "github.com/jdx/usage/integrations/cobra" // Print usage spec as KDL fmt.Print(cobra_usage.Generate(rootCmd)) ``` -------------------------------- ### Show Current Active Install Directory of Node Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/where.md Use this command to display the installation path of the currently active version of Node. Errors if the tool is not referenced in any `.tool-version` file. ```bash $ mise where node /home/jdx/.local/share/mise/installs/node/20.0.0 ``` -------------------------------- ### Install Bash Completion File with Makefile.am Source: https://github.com/jdx/usage/blob/main/lib/bash-completion/README.md Specify the installation directory for bash completion files in a Makefile.am. This ensures completion scripts are placed where bash-completion can find them. ```makefile bashcompdir = $(datarootdir)/bash-completion/completions dist_bashcomp_DATA = your-completion-file ``` -------------------------------- ### Install and Add Tool Version to Config Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Use `mise use` to install a tool version if it's not already installed and add it to `mise.toml`. It respects various configuration file settings and environment variables for determining which config file to use. The `--global` flag targets the global config file. ```bash mise use ubi:BurntSushi/ripgrep[exe=rg] ``` ```bash # Save fuzzy version to config file $ mise use --fuzzy node@20 ``` ```bash # Use the global config file (~/.config/mise/config.toml) instead of the local one $ mise use -g ``` ```bash # Create/modify an environment-specific config file like .mise..toml $ mise use -e production ``` ```bash # Remove the plugin(s) from config file $ mise use --remove node ``` -------------------------------- ### List Installed and Active Tool Versions with Mise Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Use `mise ls` to list installed and active tool versions. Flags like `--current`, `--global`, `--installed`, and `--json` filter the output. Use `--outdated` to check for newer versions. ```bash mise ls ``` ```bash mise ls --current ``` ```bash mise ls --json ``` -------------------------------- ### Start New Shell with Mise Environment Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Starts a new shell with the mise environment configured from the current directory's settings. This is an experimental feature and an alternative to `mise activate`. ```bash $ mise en . $ node -v v20.0.0 ``` ```bash $ mise en -s "bash --norc" ``` ```bash $ mise en -s "zsh -f" ``` -------------------------------- ### List Installed Plugins with Git URLs Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/plugins/ls.md To display the Git URL for each installed plugin, use the `--urls` flag. This is useful for quickly accessing the plugin's repository. ```bash mise plugins ls --urls ``` -------------------------------- ### Sync Node Versions from Homebrew Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/sync/node.md Installs Node.js versions using Homebrew and then syncs them into mise. Use this to manage Node.js installations provided by Homebrew. ```bash $ brew install node@18 node@20 $ mise sync node --brew $ mise use -g node@18 - uses Homebrew-provided node ``` -------------------------------- ### Conventional Commit Examples Source: https://github.com/jdx/usage/blob/main/CLAUDE.md Examples of commit messages following the conventional commit format, including type, scope, and description. ```text fix(zsh): handle spaces in completion values ``` ```text feat(powershell): add completion support ``` ```text feat(spec): add mount node for nested specs ``` ```text docs: update KDL spec format examples ``` ```text chore: release 2.0.0 ``` -------------------------------- ### Install Completion File in Makefile.am Source: https://github.com/jdx/usage/blob/main/lib/bash-completion/README.md This Makefile.am snippet demonstrates how to install a completion file into the directory specified by the bashcompdir variable, which is typically set by autotools. ```makefile bashcompdir = @bashcompdir@ dist_bashcomp_DATA = your-completion-file # completion files go here ``` -------------------------------- ### Basic Example Usage Spec in KDL Source: https://github.com/jdx/usage/blob/main/docs/spec/index.md Defines a basic CLI with metadata, standard flags, a flag that takes a value, and positional arguments. ```kdl // optional metadata name "My CLI" // a friendly name for the CLI bin "mycli" // the name of the binary about "some help" // a short description of the CLI version "1.0.0" // the version of the CLI author "nobody" // the author of the CLI license "MIT" // license the CLI is released under // a standard flag flag "-f --force" help="Always do the thing" flag "-v --version" help="Print the CLI version" flag "-h --help" help="Print the CLI help" // a flag that takes a value flag "-u --user " help="User to run as" arg "" help="The directory to use" // required positional argument arg "[file]" help="The file to read" // optional positional argument ``` -------------------------------- ### Manage Mise Plugins Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Commands for managing mise plugins, including listing and installing. ```bash # install the node via shorthand $ mise plugins install node ``` ```bash # install the node plugin using a specific git url $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git ``` ```bash # 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 ``` ```bash # install the node plugin using a specific ref $ mise plugins install node https://github.com/mise-plugins/rtx-nodejs.git#v1.0.0 ``` ```bash # essentially just `ln -s ./mise-node ~/.local/share/mise/plugins/node` $ mise plugins link node ./mise-node ``` ```bash # infer plugin name as "node" $ mise plugins link ./mise-node ``` ```bash $ mise plugins ls node ruby ``` ```bash $ mise plugins ls --urls node https://github.com/asdf-vm/asdf-nodejs.git ruby https://github.com/asdf-vm/asdf-ruby.git ``` -------------------------------- ### Test Mise Tool Installation Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Tests if a tool can be installed and executed. The `--include-non-defined` flag allows testing tools not explicitly listed in `registry.toml`. The `--jobs` flag controls parallel execution. ```bash $ mise test-tool ripgrep ``` -------------------------------- ### Get Bash Completion Compat Directory Source: https://github.com/jdx/usage/blob/main/lib/bash-completion/README.md This command retrieves the path to the compatdir for the current system, which is used for installing completions that are loaded eagerly. ```bash pkg-config bash-completion --variable compatdir ``` -------------------------------- ### Get Mise Tool Information Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Retrieves information about a specific tool. Use flags like `--json`, `--installed`, `--active`, `--requested`, `--config-source`, and `--tool-options` to filter the output. ```bash $ mise tool node ``` -------------------------------- ### List All Known Tool Versions Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/ls.md Use this command to see all tool versions that mise is aware of, including installed versions and those defined in configuration files. ```bash $ mise ls node 20.0.0 ~/src/myapp/.tool-versions latest python 3.11.0 ~/.tool-versions 3.10 python 3.10.0 ``` -------------------------------- ### Quick Start: Generate Usage Spec Source: https://github.com/jdx/usage/blob/main/integrations/cobra/README.md Generate the usage spec from a Cobra root command in Go. This spec can then be printed or processed further. ```go import ( cobra_usage "github.com/jdx/usage/integrations/cobra" ) func main() { root := &cobra.Command{ Use: "mycli", Short: "My CLI tool", Version: "1.0.0", } // ... add subcommands, flags, args ... // Print usage spec as KDL fmt.Print(cobra_usage.Generate(root)) } ``` -------------------------------- ### List All Mise Settings Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Use this command to list all available settings. It displays settings from the configuration file. ```bash $ mise settings ``` -------------------------------- ### Go: Generate CLI tools from Usage spec Source: https://context7.com/jdx/usage/llms.txt Examples of generating shell completions and JSON/KDL specs using the `usage` CLI and output from a Go application. ```bash # Generate completions mycli --usage-spec | usage generate completion zsh mycli -f - > ~/.zsh/completions/_mycli # Generate JSON spec mycli --usage-spec | usage generate json -f - # Write KDL spec to file # cobra_usage.GenerateToFile(rootCmd, "mycli.usage.kdl") ``` -------------------------------- ### Running Executed Scripts Source: https://context7.com/jdx/usage/llms.txt Demonstrates how to run scripts executed by `usage exec` and view their help output or execute them with arguments. ```bash # Running the bash script: ./greet.sh --help # Usage: greet.sh [flags] # -f, --force Overwrite existing file # -u, --user User to greet (default: world) ./greet.sh --user=alice output.txt ./greet.sh -f -u bob output.txt ``` -------------------------------- ### List Available Tools in Registry Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Lists tools available for installation from the registry. By default, it shows shorthand names and their full registry paths. Use a tool name to see its specific full name, or use `--backend` to filter by a specific backend. ```bash mise registry node core:node poetry asdf:mise-plugins/mise-poetry ubi cargo:ubi-cli ``` ```bash mise registry poetry asdf:mise-plugins/mise-poetry ``` -------------------------------- ### Use a Homebrew-provided Node.js version Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/link.md Install Node.js using Homebrew, then link it into mise using the output of `brew --prefix node`. Finally, use `mise use` to make this version the active one. ```bash brew install node mise link node@brew $(brew --prefix node) mise use node@brew ``` -------------------------------- ### Rust: Generate CLI tools from Usage spec Source: https://context7.com/jdx/usage/llms.txt Examples of generating shell completions, markdown documentation, and man pages using the `usage` CLI and output from a Rust application. ```bash # Generate completions directly from the binary mycli --usage-spec | usage generate completion bash mycli -f - > /etc/bash_completion.d/mycli # Generate markdown docs mycli --usage-spec | usage generate markdown -f - --out-file docs/cli.md # Generate man page mycli --usage-spec | usage generate manpage -f - -o mycli.1 ``` -------------------------------- ### Check Mise Installation for Problems Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Run `mise doctor` to diagnose potential issues with your mise installation. It checks for common problems, such as missing plugin installations. Use the `--json` flag for structured output. ```bash mise doctor ``` ```bash mise doctor --json ``` -------------------------------- ### List All Settings Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/settings/ls.md Displays all current settings for mise. This includes boolean flags and other configuration values. ```bash mise settings ``` -------------------------------- ### Show All Current Runtime Versions Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/current.md Outputs all currently active and installed runtimes in a format compatible with `.tool-versions` files. This is useful for understanding the current environment state. ```bash $ mise current python 3.11.0 3.10.0 shfmt 3.6.0 shellcheck 0.9.0 node 20.0.0 ``` -------------------------------- ### Define Configuration Files and Defaults Source: https://github.com/jdx/usage/blob/main/docs/spec/reference/config.md Specify system, global, and local configuration file paths, including dynamic environment-based files. Also sets default values for configuration keys and defines aliases. ```kdl config { // system file "/etc/mycli.toml" file "/etc/mycli.json" // global file "~/.config/mycli.toml" file "~/.config/mycli.json" // local file ".config/mycli.toml" findup=#true file ".config/mycli.json" findup=#true file ".mycli.dist.toml" findup=#true file ".mycli.dist.json" findup=#true file ".mycli.toml" findup=#true file ".mycli.json" findup=#true file ".myclirc" findup=#true format="ini" // e.g.: .mycli.dev.toml, .mycli.prod.toml file ".mycli.$MYCLI_ENV.toml" findup=#true default "user" "admin" default "work_dir" "/tmp" default "yes" false alias "user" "username" } ``` -------------------------------- ### List Configuration Files Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Use `mise config ls` to display the configuration files currently in use by mise. The output includes the path to each configuration file and the tools defined within it. Use the `--json` flag for machine-readable output. ```bash mise config ls ``` ```bash mise config ls --json ``` -------------------------------- ### List Mise Settings with Options Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md List settings, with options to filter by a specific setting name, output in JSON format, or include source information. ```bash $ mise settings ls idiomatic_version_file = false ... ``` ```bash $ mise settings ls python default_packages_file = "~/.default-python-packages" ... ``` -------------------------------- ### Reshim Executables Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Creates shims for CLIs of installed tools. This is useful when tools are installed outside of mise's automatic detection (e.g., via yarn or pnpm). Use `--force` to remove all existing shims before reshimming. This command creates shims for all installed tools, not just active ones. ```bash mise reshim ``` ```bash ~/.local/share/mise/shims/node -v v20.0.0 ``` -------------------------------- ### Execute Command with Zsh and Options Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Provide a shell with specific options by including them in the '--shell' argument. This example uses 'zsh' with '-x' and '-o shwordsplit' flags. ```bash watchexec --shell='zsh -x -o shwordsplit' -- scr ``` -------------------------------- ### Usage Spec with Config File, Environment Variable, and Default Value Source: https://github.com/jdx/usage/blob/main/docs/spec/index.md Demonstrates how flags can be backed by config files, environment variables, or defaults, specifying their priority. ```kdl config_file ".mycli.toml" findup=#true flag "-u --user " help="User to run as" env="MYCLI_USER" config="settings.user" default="admin" ``` -------------------------------- ### List Node.js versions using a version prefix argument Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/ls-remote.md Alternatively, specify the version prefix as a separate argument after the tool name. This command also lists Node.js versions starting with '20'. ```bash mise ls-remote node 20 ``` -------------------------------- ### Force Reinstall and Add Tool Version Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Forces the reinstallation of a tool version, even if it is already installed, and adds it to the `mise.toml` file. This is useful for ensuring a clean installation. ```bash mise use -f node@20 ``` -------------------------------- ### Uninstall Plugin Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Removes specified plugins. Use the `--purge` flag to also remove associated installs, downloads, and cache, or `--all` to remove all installed plugins. ```bash mise uninstall node ``` -------------------------------- ### List All Aliases Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/alias/ls.md Shows all available aliases, including those from user configuration and plugins. The output displays the alias name, its target, and the version. ```bash $ mise aliases node lts-hydrogen 20.0.0 ``` -------------------------------- ### Pipe Output to Usage Tool Source: https://github.com/jdx/usage/blob/main/docs/spec/integrations/clap.md Examples of piping the generated usage specification to the 'usage' tool for different output formats like bash completion, markdown documentation, or man pages. ```bash mycli --usage-spec | usage generate completion bash ``` ```bash mycli --usage-spec | usage generate md --out-file docs.md ``` ```bash mycli --usage-spec | usage generate manpage --out-file mycli.1 ``` -------------------------------- ### Sync Python Versions from Pyenv Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/sync/python.md Use this command to import all Python versions installed via pyenv into mise. Ensure you have installed the desired Python version with pyenv first. ```bash $ pyenv install 3.11.0 $ mise sync python --pyenv $ mise use -g python@3.11.0 - uses pyenv-provided python ``` -------------------------------- ### Show Dependencies for All Tasks Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/tasks/deps.md Use this command to display a tree visualization of dependencies for all tasks defined in your project. ```bash $ mise tasks deps ``` -------------------------------- ### Basic Custom Completion Command Source: https://github.com/jdx/usage/blob/main/docs/spec/reference/complete.md Use a custom command to provide completions for all arguments named 'plugin'. The `run` attribute specifies the command to execute. ```kdl complete "plugin" run="mycli plugins list" ``` -------------------------------- ### Sync Ruby versions from Homebrew Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Synchronize Ruby tool versions installed via Homebrew into mise. This command imports versions without overwriting existing installs but may overwrite existing symlinks. ```bash $ brew install ruby $ mise sync ruby --brew $ mise use -g ruby - Use the latest version of Ruby installed by Homebrew ``` -------------------------------- ### Define Command Aliases and Help Text Source: https://github.com/jdx/usage/blob/main/docs/spec/reference/cmd.md Use `cmd` to define commands, their aliases, and various help text options. Aliases can be hidden from documentation and completions. ```kdl cmd "config" help="Manage the CLI config" { alias "cfg" "cf" "cg" // aliases for the command alias "conf" hide=#true // hide alias from docs and completions } cmd "config" hide=#true // hide command from docs and completions cmd "config" subcommand_required=#true // subcommand is not optional // these are shown under -h cmd "config" before_help="shown before the command" cmd "config" help="short description" cmd "config" after_help="shown after the command" // these are shown under --help // all help fields can be either inline params or separate nodes like // below for the *_long_help fields. Typically when a lot of space is needed // it's cleaner to use separate nodes. cmd "config" { before_long_help "shown before the command" long_help "longer description" after_long_help "shown after the command" } ``` -------------------------------- ### Reshim Binaries with Mise Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Creates new shims for CLIs from installed tools. This is useful when tools are installed outside of mise's direct management. Use `-f` to force removal of all existing shims before regenerating. ```bash mise reshim ``` ```bash mise reshim -f ``` -------------------------------- ### Remove Installed Tool Version Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Use `mise remove` (or `unuse`) to uninstall a specific tool version. By default, it will also prune the installed version if no other configurations are using it. Use the `--no-prune` flag to prevent pruning. ```bash # will uninstall specific version $ mise remove node@18.0.0 ``` -------------------------------- ### Update All Plugins Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/plugins/update.md Run this command to update all installed plugins to their latest versions. ```bash $ mise plugins update # update all plugins ``` -------------------------------- ### Get Environment Variable Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/set.md Retrieves the value of the `NODE_ENV` environment variable from the configuration. ```bash $ mise set NODE_ENV production ``` -------------------------------- ### Preview Generated Manpage Source: https://github.com/jdx/usage/blob/main/docs/cli/manpages.md Pipes the generated manpage to the `man` command for previewing without installation. ```bash $ usage g man -f ./mycli.usage.kdl | man -l - ``` -------------------------------- ### mise alias get Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Show an alias for a plugin. This is the contents of an alias. entry in ~/.config/mise/config.toml ```APIDOC ## `mise alias get` ### Description Show an alias for a plugin This is the contents of an alias. entry in ~/.config/mise/config.toml ### Arguments #### `` The plugin to show the alias for #### `` The alias to show Examples: $ mise alias get node lts-hydrogen 20.0.0 ``` -------------------------------- ### Get Latest Stable Node Version Source: https://github.com/jdx/usage/blob/main/examples/docs/cli-reference/latest.md This command retrieves the latest stable release of Node.js. ```bash $ mise latest node # get the latest stable version of node 20.0.0 ``` -------------------------------- ### Manpage Output Format Example Source: https://github.com/jdx/usage/blob/main/docs/cli/manpages.md Illustrates the standard roff format of a generated Unix man page. ```roff mycli(1) General Commands Manual mycli(1) NAME mycli - description of your CLI tool SYNOPSIS mycli [OPTIONS] DESCRIPTION Detailed description of your CLI tool... OPTIONS -h, --help Print help information -v, --verbose Enable verbose output COMMANDS install Install a plugin list List installed plugins EXAMPLES Install a plugin: mycli install my-plugin AUTHOR Your Name ``` -------------------------------- ### Add a new task with dependencies Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_MULTI.md Create a new task named 'pre-commit' that depends on 'test' and 'render'. The task will execute 'echo pre-commit'. ```bash $ mise task add pre-commit --depends "test" --depends "render" -- echo pre-commit ``` -------------------------------- ### Get a Specific Mise Setting Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Retrieve the value of a specific setting. This command reads directly from the configuration file. ```bash $ mise settings always_keep_download ``` ```bash $ mise settings get idiomatic_version_file true ``` -------------------------------- ### mise alias get Source: https://github.com/jdx/usage/blob/main/examples/docs/MISE_INLINE.md Shows an alias for a specific plugin. This retrieves the content of an alias. entry from ~/.config/mise/config.toml. ```APIDOC ## `mise alias get` ### Description Show an alias for a plugin This is the contents of an alias. entry in ~/.config/mise/config.toml ### Arguments #### `` The plugin to show the alias for #### `` The alias to show ### Examples: $ mise alias get node lts-hydrogen 20.0.0 ```