From 642da259567872d6087a67c2b3fb3509a4e7bdb0 Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Sun, 10 Nov 2024 19:51:39 +0000 Subject: [PATCH 01/14] Code for Fig completions and publishing --- .github/workflows/release-fig.yml | 37 +++++ .mise.toml | 7 + package.json | 3 + tasks/fig/.gitignore | 1 + tasks/fig/addCustomGenerators.ts | 126 +++++++++++++++ tasks/fig/generators.ts | 247 ++++++++++++++++++++++++++++++ tasks/fig/src/.gitignore | 0 tsconfig.json | 9 ++ 8 files changed, 430 insertions(+) create mode 100644 .github/workflows/release-fig.yml create mode 100644 tasks/fig/.gitignore create mode 100644 tasks/fig/addCustomGenerators.ts create mode 100644 tasks/fig/generators.ts create mode 100644 tasks/fig/src/.gitignore create mode 100644 tsconfig.json diff --git a/.github/workflows/release-fig.yml b/.github/workflows/release-fig.yml new file mode 100644 index 0000000000..d7fbf78b5f --- /dev/null +++ b/.github/workflows/release-fig.yml @@ -0,0 +1,37 @@ +name: 'Publish mise completions version' +on: + push: + tags: + - 'v*' ## Only run the action on new versions, this prevents useless runs of the action + +jobs: + push-to-fig-autocomplete: + ## if github.repository == 'jdx/mise' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: { toolchain: nightly, components: rustfmt } + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - run: mkdir -p "$HOME/bin" && echo "$HOME/bin" >> "$GITHUB_PATH" + - run: npm i + - run: cargo build --all-features && cp target/debug/mise "$HOME"/bin + - uses: actions/cache/restore@v4 + with: + path: | + ~/.local/share/mise/installs + ~/.local/share/mise/plugins + key: mise-tools-ubuntu-latest-${{ hashFiles('.mise.lock') }} + restore-keys: mise-tools-ubuntu-latest + - run: mise install + - run: mise run render:fig + - name: Create Autocomplete PR ## Create the autocomplete PR using this action + uses: withfig/push-to-fig-autocomplete-action@v2 + with: + token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} + autocomplete-spec-name: mise + spec-path: tasks/fig/src/mise.ts + pr-body: "Automated PR for latest mise release by https://github.com/jdx/mise" \ No newline at end of file diff --git a/.mise.toml b/.mise.toml index ff81514d63..73d1441451 100644 --- a/.mise.toml +++ b/.mise.toml @@ -82,6 +82,13 @@ depends = ["build"] env = { NO_COLOR = "1" } run = "mise render-mangen" +[tasks."render:fig"] +depends = ["build", "render:usage"] +run = [ + "usage generate fig --file mise.usage.kdl --out-file tasks/fig/src/mise.ts", + "tsx tasks/fig/addCustomGenerators.ts tasks/fig/src/mise.ts tasks/fig/src/mise.ts" +] + [tasks."render:help"] depends = ["build"] env = { NO_COLOR = "1" } diff --git a/package.json b/package.json index 57dae6d22e..7163190ad4 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,9 @@ "author": "", "license": "ISC", "devDependencies": { + "@tsconfig/node18": "^18.2.4", + "@withfig/autocomplete-tools": "^2.10.0", + "@withfig/autocomplete-types": "^1.31.0", "handlebars": "^4.7.8", "toml": "^3.0.0", "ts-pattern": "^5.4.0", diff --git a/tasks/fig/.gitignore b/tasks/fig/.gitignore new file mode 100644 index 0000000000..d16386367f --- /dev/null +++ b/tasks/fig/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/tasks/fig/addCustomGenerators.ts b/tasks/fig/addCustomGenerators.ts new file mode 100644 index 0000000000..82932122b6 --- /dev/null +++ b/tasks/fig/addCustomGenerators.ts @@ -0,0 +1,126 @@ +import fsAsync = require('node:fs/promises'); +import * as ts from "typescript"; + +type GeneratorIdentifier = { + identifier: string + generator_name: string +} + +const customGenerators: GeneratorIdentifier[] = [ + { + identifier: 'alias', + generator_name: 'aliasGenerator' + }, + { + identifier: 'plugin', + generator_name: 'pluginGenerator' + }, + { + identifier: 'all_plugins', + generator_name: 'allPluginsGenerator' + }, + { + identifier: 'task', + generator_name: 'simpleTaskGenerator' + }, + { + identifier: 'tasks', + generator_name: 'simpleTaskGenerator' + }, + { + identifier: 'setting', + generator_name: 'settingsGenerator' + }, + { + identifier: 'tool@version', + generator_name: 'toolVersionGenerator' + }, + { + identifier: 'installed_tool@version', + generator_name: 'installedToolVersionGenerator' + }, + { + identifier: 'config_file', + generator_name: 'configPathGenerator' + }, + { + identifier: 'env_vars', + generator_name: 'envVarGenerator' + } + +] + +const get_identifier = (node: ts.Node): ts.Identifier | undefined => { + let name = ""; + + const objectLiteralExpr = node as ts.ObjectLiteralExpression; + const properties = objectLiteralExpr.properties; + properties.forEach((p) => { + if (ts.isPropertyAssignment(p) && p.name.getText() == '"name"') { + const value = p.getChildAt(2) + name = value.getText().replaceAll('"', ''); + } + }) + + const custom = customGenerators.filter((g) => { + if (name === g.identifier) { + return true; + // + } + }).map(g => ts.factory.createIdentifier(g.generator_name)) + + if (custom.length > 0) return custom[0] + return; +} + +function transformer(context: ts.TransformationContext) { + return (rootNode: T) => { + function visit(node: ts.Node): ts.Node { + if (ts.isPropertyAssignment(node) + && node.name.getText() === '"generators"') { + const id = get_identifier(node.parent) + if (id) { + return ts.factory.updatePropertyAssignment( + node, + node.name, + id + ) + } + } + return ts.visitEachChild(node, visit, context); + } + return ts.visitNode(rootNode, visit); + }; +} + + +const main = async (fileName: string, outFile?: string) => { + try { + const generatorFileContents = (await fsAsync.readFile('./tasks/fig/generators.ts')).toString(); + const contents = (await fsAsync.readFile(fileName)).toString(); + const sourceFile = ts.createSourceFile( + "example.ts", + contents, + ts.ScriptTarget.Latest, + true + ); + const result = ts.transform(sourceFile, [transformer]); + const transformedSourceFile = result.transformed[0]; + //traverse(sourceFile, sourceFile); + + const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); + const output = printer.printNode( + ts.EmitHint.Unspecified, + transformedSourceFile, + sourceFile + ); + + fsAsync.writeFile(outFile ?? `${fileName.replace('.ts', '')}.out.ts`, generatorFileContents + '\n' +output) + + } catch (e) { + console.error(e); + } + +} + +main(process.argv[2], process.argv[3]); \ No newline at end of file diff --git a/tasks/fig/generators.ts b/tasks/fig/generators.ts new file mode 100644 index 0000000000..7560502085 --- /dev/null +++ b/tasks/fig/generators.ts @@ -0,0 +1,247 @@ +// If not being published, these need to manually downloaded from https://github.com/withfig/autocomplete/tree/master/src +import { createNpmSearchHandler } from "./npm" +import { searchGenerator as createCargoSearchGenerator } from "./cargo" + +const envVarGenerator = { + script: ['sh', '-c', 'env'], + postProcess: (output: string) => { + return output.split('\n').map(l => ({name: l.split('=')[0]})) + } +} + +const singleCmdNewLineGenerator = (completion_cmd: string): Fig.Generator => ({ + script: completion_cmd.split(' '), + splitOn: '\n' +}) + +const singleCmdJsonGenerator = (cmd: string): Fig.Generator => ({ + script: cmd.split(' '), + postProcess: (out) => (JSON.parse(out).map((r: any) => ({name: r.name, description: r.description}))) +}) + +const contextualGeneratorLastWord = (cmd: string): Fig.Generator => ({ + script: (context) => { + if (context.length < 2) { + return [] + } + + const prev = context[context.length - 2] // -1 is the current word + return ['sh', '-c', [cmd, prev].join(' ')] + } +}) + +const aliasGenerator: Fig.Generator = { + ...contextualGeneratorLastWord('mise alias ls'), + postProcess: (out) => { + //return [{name: out}] + //return out.split('\t').map(l => ({name: l})) + //return [{name: "test", "description": out}] + const tokens = out.split(/\s+/) + if (tokens.length == 0) + return [] + + return tokens.flatMap((_, i) => { + if ((i % 3) == 0) { + return [tokens[i+1]] + } + return [] + }).filter(l => l.trim().length > 0).map(l => ({name: l.trim()})) + } +} + +const pluginWithAlias: Fig.Generator = { + script: 'mise alias ls'.split(' '), + postProcess: (output: string) => { + const plugins = output.split('\n').map((line) => { + const tokens = line.split(/\s+/) + return tokens[0] + }) + return [... new Set(plugins)].map((p) => ({name: p})) + } +} + +const getInstalledTools = async (executeShellCommand: Fig.ExecuteCommandFunction) => { + const {stdout} = await executeShellCommand({ + command: 'sh', args: ['-c', 'mise ls --installed'] + }) + return [...new Set(stdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return {name: tokens[0], version: tokens[1]} + }))] +} + + +type ConfigLsOutput = { + path: string + tools: string[] +} + +const configPathGenerator: Fig.Generator = { + ...singleCmdJsonGenerator('mise config ls -J'), + postProcess: (out) => JSON.parse(out).map((r: ConfigLsOutput) => ({name: r.path, description: r.path})) +} + + +type ObjectKeyType = string | symbol | number +type ObjectAcceptableKeyValues = { + [key: string]: ObjectKeyType +} + +function groupBy(array: T[], key: keyof T): Record { + return array.reduce((result, currentItem) => { + (result[currentItem[key] as (ObjectKeyType)] = result[currentItem[key] as (ObjectKeyType)] || []) + .push(currentItem); + return result; + }, {} as Record); +}; + +const installedToolsGenerator: Fig.Generator = { + script: ['sh', '-c', 'mise ls --installed'], + postProcess: (stdout: string) => { + return [...new Set(stdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return {name: tokens[0], version: tokens[1]} + }))] + } +} + + +const pluginGenerator: Fig.Generator = installedToolsGenerator +const allPluginsGenerator: Fig.Generator = singleCmdNewLineGenerator('mise plugins --all') +const simpleTaskGenerator = singleCmdJsonGenerator('mise tasks -J') +const settingsGenerator = singleCmdNewLineGenerator(`mise settings --keys`) + +const atsInStr = (s: string) => (s.match(/@/g) || []).length != 0; +const backendSepInStr = (s: string) => (s.match(/:/g) || []).length != 0; + +const searchBackend = async (backend: string, context: string[], + executeShellCommand: Fig.ExecuteCommandFunction, + shellContext: Fig.GeneratorContext): Promise => { + const customContext = context; + customContext[context.length - 1] = customContext[context.length - 1].replace(`${backend}:`, '') + switch (backend) { + case 'npm': + return (await (createNpmSearchHandler()(context, executeShellCommand, shellContext))) + case 'cargo': + //return [{name: customContext[context.length - 1]}] + return (await (createCargoSearchGenerator.custom(customContext, executeShellCommand, shellContext))) + case 'asdf': + const { stdout } = await executeShellCommand({ + command: 'sh', args: ['-c', 'mise registry'] + }) + return [...new Set(stdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return { name: tokens[1].replace(`${backend}:`, '') } + }))] + case 'ubi': + const { stdout: ubiOut } = await executeShellCommand({ + command: 'sh', args: ['-c', 'mise registry'] + }) + return [...new Set(ubiOut.split('\n').flatMap(l => { + const tokens = l.split(/\s+/) + if (!tokens[1].includes('ubi:')) return [] + return [{ name: tokens[1].replace('ubi:', '') }] as Fig.Suggestion + }))] + default: + return [] + } +} + +const compareVersions = (a: string, b: string ): number => { + const result = [a,b].sort() // Unless we can add semversort + if (result[0] != a) return 1 + return -1 +} + +const toolVersionGenerator: Fig.Generator = { + trigger: (newToken: string, oldToken: string): boolean => { + return (backendSepInStr(newToken) && !backendSepInStr(oldToken)) || + (atsInStr(newToken) && !atsInStr(oldToken)) + }, + getQueryTerm: '@', + + custom: async (context: string[], + executeShellCommand: Fig.ExecuteCommandFunction, + shellContext: Fig.GeneratorContext) => { + + const currentWord = context[context.length - 1] + if (backendSepInStr(currentWord)) { + // Let's handle backends + const backend = currentWord.slice(0, currentWord.lastIndexOf(':')) + + return (await searchBackend(backend, context, executeShellCommand, shellContext)) + .map(s => ({...s, name: `${backend}:${s.name}`, displayName: s.name, icon: '📦'})) + + } else if (atsInStr(currentWord)) { + const tool = currentWord.slice(0, currentWord.lastIndexOf('@')) + const { stdout } = await executeShellCommand({ + command: 'sh', args: ['-c', `mise ls-remote ${tool}`] + }) + const remote_versions_suggestions = stdout.split('\n').sort((a,b) => compareVersions(b,a)).map(l => ({name: l})) + const { stdout: aliasStdout } = await executeShellCommand({ + command: 'sh', args: ['-c', `mise alias ls ${tool}`] + }) + const aliases_suggestions = aliasStdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return {name: tokens[1]} + }) + return [...aliases_suggestions, ...remote_versions_suggestions] + } + + const { stdout } = await executeShellCommand({ + command: 'sh', args: ['-c', 'mise registry'] + }) + return [...new Set(stdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return { name: tokens[0] } + }))] + } +} + + +const installedToolVersionGenerator: Fig.Generator = { + trigger: '@', + getQueryTerm: '@', + custom: async (context: string[], + executeShellCommand: Fig.ExecuteCommandFunction) => { + + const tools = await getInstalledTools(executeShellCommand) + const toolsVersions = groupBy(tools, "name") + + const currentWord = context[context.length - 1] + if (atsInStr(currentWord)) { + const tool = currentWord.slice(0, currentWord.lastIndexOf('@')) + + const { stdout: aliasStdout } = await executeShellCommand({ + command: 'sh', args: ['-c', `mise alias ls ${tool}`] + }) + + // This lists all aliases even if they are not installed + /* + const aliases_suggestions = aliasStdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return {name: tokens[1], description: tokens[2]} + }) as Fig.Suggestion[] + */ + + const toolVersions = (toolsVersions[tool] || []) as {name: string, version: string}[] + const suggestions = toolVersions.map(s => ({ + name: s.version + })) as Fig.Suggestion[] + + return [...suggestions] + } + + const suggestions: Fig.Suggestion[] = [] + Object.keys(toolsVersions).forEach((k) => { + if (toolsVersions[k].length == 1) { + suggestions.push({name: k}) + } + else { + suggestions.push({name: `${k}@`}) + } + }) + + return suggestions + } +} \ No newline at end of file diff --git a/tasks/fig/src/.gitignore b/tasks/fig/src/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..31ef758243 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@tsconfig/node18/tsconfig.json", + "include": ["**/*"], + "exclude": ["node_modules"], + "compilerOptions": { + "outDir": "./build", + "types": ["@withfig/autocomplete-types", "node"] + } + } From 6b89fdbdd7d8da84693fe368abe0bdfca5bcafeb Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 19:56:04 +0000 Subject: [PATCH 02/14] [autofix.ci] apply automated fixes --- tasks.md | 6 + tasks/fig/src/mise.ts | 2890 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2896 insertions(+) create mode 100644 tasks/fig/src/mise.ts diff --git a/tasks.md b/tasks.md index 6b672cf0ab..1ba43fe48d 100644 --- a/tasks.md +++ b/tasks.md @@ -178,6 +178,12 @@ User to run as - **Usage**: `render:completions` +## `render:fig` + +- Depends: build, render:usage + +- **Usage**: `render:fig` + ## `render:help` - Depends: build diff --git a/tasks/fig/src/mise.ts b/tasks/fig/src/mise.ts new file mode 100644 index 0000000000..2e125764d2 --- /dev/null +++ b/tasks/fig/src/mise.ts @@ -0,0 +1,2890 @@ +const usageGenerateSpec = (cmds: string[]) => { + return async ( + context: string[], + executeCommand: Fig.ExecuteCommandFunction, + ): Promise => { + const promises = cmds.map(async (cmd): Promise => { + try { + const args = cmd.split(" "); + const { + stdout, + stderr: cmdStderr, + status: cmdStatus, + } = await executeCommand({ + command: args[0], + args: args.splice(1), + }); + if (cmdStatus !== 0) { + return [{ name: "error", description: cmdStderr }]; + } + const { + stdout: figSpecOut, + stderr: figSpecStderr, + status: usageFigStatus, + } = await executeCommand({ + command: "usage", + args: ["g", "fig", "--spec", stdout], + }); + if (usageFigStatus !== 0) { + return [{ name: "error", description: figSpecStderr }]; + } + + const start_of_json = figSpecOut.indexOf("{"); + const j = figSpecOut.slice(start_of_json); + return JSON.parse(j).subcommands as Fig.Subcommand[]; + } catch (e) { + return [{ name: "error", description: e }] as Fig.Subcommand[]; + } + }); + + // eslint-disable-next-line compat/compat + const results = await Promise.allSettled(promises); + const subcommands = results + .filter((p) => p.status === "fulfilled") + .map((p) => p.value); + const failed = results + .filter((p) => p.status === "rejected") + .map((p) => ({ name: "error", description: p.reason })); + + return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; + }; +}; + +const completionGeneratorTemplate = ( + argSuggestionBash: string, +): Fig.Generator => { + return { + custom: async (tokens: string[], executeCommand) => { + let arg = argSuggestionBash; + if (tokens.length >= 1) { + arg = argSuggestionBash.replace( + "{{words[CURRENT]}}", + tokens[tokens.length - 1], + ); + } + + if (tokens.length >= 2) { + arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); + } + const { stdout: text } = await executeCommand({ + command: "sh", + args: ["-c", arg], + }); + if (text.trim().length == 0) return []; + return text.split("\n").map((elm) => ({ name: elm })); + }, + }; +}; + + +const completionSpec: Fig.Spec = { + "name": [ + "mise" + ], + "subcommands": [ + { + "name": [ + "activate" + ], + "description": "Initializes mise in the current shell session", + "options": [ + { + "name": [ + "--shims" + ], + "description": "Use shims instead of modifying PATH\nEffectively the same as:", + "isRepeatable": false + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress non-error messages", + "isRepeatable": false + } + ], + "args": [ + { + "name": "shell_type", + "description": "Shell type to generate the script for", + "isOptional": true, + "isVariadic": false, + "suggestions": [ + "bash", + "elvish", + "fish", + "nu", + "xonsh", + "zsh" + ] + } + ] + }, + { + "name": [ + "alias", + "a" + ], + "description": "Manage aliases", + "subcommands": [ + { + "name": [ + "get" + ], + "description": "Show an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to show the alias for", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + }, + { + "name": "alias", + "description": "The alias to show", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise alias ls {{words[PREV]}} | awk '{print $2}'`) + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool", + "description": "Show aliases for ", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "set", + "add", + "create" + ], + "description": "Add/update an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to set the alias for", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + }, + { + "name": "alias", + "description": "The alias to set", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise alias ls {{words[PREV]}} | awk '{print $2}'`) + }, + { + "name": "value", + "description": "The value to set the alias to", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "unset", + "rm", + "remove", + "delete", + "del" + ], + "description": "Clears an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to remove the alias from", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + }, + { + "name": "alias", + "description": "The alias to remove", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise alias ls {{words[PREV]}} | awk '{print $2}'`) + } + ] + } + ], + "options": [ + { + "name": [ + "-p", + "--plugin" + ], + "description": "filter aliases by plugin", + "isRepeatable": false, + "args": { + "name": "plugin", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + } + }, + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ] + }, + { + "name": [ + "backends", + "b" + ], + "description": "Manage backends", + "subcommands": [ + { + "name": [ + "ls", + "list" + ], + "description": "List built-in backends" + } + ] + }, + { + "name": [ + "bin-paths" + ], + "description": "List all the active runtime bin paths" + }, + { + "name": [ + "cache" + ], + "description": "Manage the mise cache", + "subcommands": [ + { + "name": [ + "clear", + "c" + ], + "description": "Deletes all cache files in mise", + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to clear cache for e.g.: node, python", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + } + ] + }, + { + "name": [ + "prune", + "p" + ], + "description": "Removes stale mise cache files", + "options": [ + { + "name": [ + "--dry-run" + ], + "description": "Just show what would be pruned", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show pruned files", + "isRepeatable": true + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to clear cache for e.g.: node, python", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + } + ] + } + ] + }, + { + "name": [ + "completion" + ], + "description": "Generate shell completions", + "args": [ + { + "name": "shell", + "description": "Shell type to generate completions for", + "isOptional": true, + "isVariadic": false, + "suggestions": [ + "bash", + "fish", + "zsh" + ] + } + ] + }, + { + "name": [ + "config", + "cfg" + ], + "description": "Manage config files", + "subcommands": [ + { + "name": [ + "generate", + "g" + ], + "description": "[experimental] Generate a mise.toml file", + "options": [ + { + "name": [ + "-o", + "--output" + ], + "description": "Output to file instead of stdout", + "isRepeatable": false, + "args": { + "name": "output", + "isOptional": false, + "isVariadic": false + } + } + ] + }, + { + "name": [ + "get" + ], + "description": "Display the value of a setting in a mise.toml file", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "The path to the mise.toml file to edit", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + } + ], + "args": [ + { + "name": "key", + "description": "The path of the config to display", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "ls" + ], + "description": "List config files currently in use", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "set" + ], + "description": "Set the value of a setting in a mise.toml file", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "The path to the mise.toml file to edit", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-t", + "--type" + ], + "isRepeatable": false, + "args": { + "name": "type", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "infer", + "string", + "integer", + "float", + "bool", + "list" + ] + } + } + ], + "args": [ + { + "name": "key", + "description": "The path of the config to display", + "isOptional": false, + "isVariadic": false + }, + { + "name": "value", + "description": "The value to set the key to", + "isOptional": false, + "isVariadic": false + } + ] + } + ], + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "deactivate" + ], + "description": "Disable mise for current shell session" + }, + { + "name": [ + "direnv" + ], + "description": "Output direnv function to use mise inside direnv", + "subcommands": [ + { + "name": [ + "activate" + ], + "description": "Output direnv function to use mise inside direnv" + } + ] + }, + { + "name": [ + "doctor", + "dr" + ], + "description": "Check mise installation for possible problems" + }, + { + "name": [ + "env", + "e" + ], + "description": "Exports env vars to activate mise a single time", + "options": [ + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "-s", + "--shell" + ], + "description": "Shell type to generate environment variables for", + "isRepeatable": false, + "args": { + "name": "shell", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "bash", + "elvish", + "fish", + "nu", + "xonsh", + "zsh" + ] + } + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to use", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + ] + }, + { + "name": [ + "exec", + "x" + ], + "description": "Execute a command with tool(s) set", + "options": [ + { + "name": [ + "-c", + "--command" + ], + "description": "Command string to execute", + "isRepeatable": false, + "args": { + "name": "c", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to start e.g.: node@20 python@3.10", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + }, + { + "name": "command", + "description": "Command string to execute (same as --command)", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "generate", + "g" + ], + "description": "[experimental] Generate files for various tools/services", + "subcommands": [ + { + "name": [ + "git-pre-commit", + "pre-commit" + ], + "description": "[experimental] Generate a git pre-commit hook", + "options": [ + { + "name": [ + "--hook" + ], + "description": "Which hook to generate (saves to .git/hooks/$hook)", + "isRepeatable": false, + "args": { + "name": "hook", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-t", + "--task" + ], + "description": "The task to run when the pre-commit hook is triggered", + "isRepeatable": false, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) + } + }, + { + "name": [ + "-w", + "--write" + ], + "description": "write to .git/hooks/pre-commit and make it executable", + "isRepeatable": false + } + ] + }, + { + "name": [ + "github-action" + ], + "description": "[experimental] Generate a GitHub Action workflow file", + "options": [ + { + "name": [ + "-n", + "--name" + ], + "description": "the name of the workflow to generate", + "isRepeatable": false, + "args": { + "name": "name", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-t", + "--task" + ], + "description": "The task to run when the workflow is triggered", + "isRepeatable": false, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) + } + }, + { + "name": [ + "-w", + "--write" + ], + "description": "write to .github/workflows/$name.yml", + "isRepeatable": false + } + ] + }, + { + "name": [ + "task-docs" + ], + "description": "Generate documentation for tasks in a project", + "options": [ + { + "name": [ + "-I", + "--index" + ], + "description": "write only an index of tasks, intended for use with `--multi`", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--inject" + ], + "description": "inserts the documentation into an existing file", + "isRepeatable": false + }, + { + "name": [ + "-m", + "--multi" + ], + "description": "render each task as a separate document, requires `--output` to be a directory", + "isRepeatable": false + }, + { + "name": [ + "-o", + "--output" + ], + "description": "writes the generated docs to a file/directory", + "isRepeatable": false, + "args": { + "name": "output", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--root" + ], + "description": "root directory to search for tasks", + "isRepeatable": false, + "args": { + "name": "root", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-s", + "--style" + ], + "isRepeatable": false, + "args": { + "name": "style", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "simple", + "detailed" + ] + } + } + ] + } + ] + }, + { + "name": [ + "implode" + ], + "description": "Removes mise CLI and all related data", + "options": [ + { + "name": [ + "--config" + ], + "description": "Also remove config directory", + "isRepeatable": false + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "List directories that would be removed without actually removing them", + "isRepeatable": false + } + ] + }, + { + "name": [ + "install", + "i" + ], + "description": "Install a tool version", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Force reinstall even if already installed", + "isRepeatable": false + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show installation output", + "isRepeatable": true + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to install e.g.: node@20", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + ] + }, + { + "name": [ + "latest" + ], + "description": "Gets the latest available version for a plugin", + "options": [ + { + "name": [ + "-i", + "--installed" + ], + "description": "Show latest installed instead of available version", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool to get the latest version of", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + ] + }, + { + "name": [ + "link", + "ln" + ], + "description": "Symlinks a tool version into mise", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Overwrite an existing tool version if it exists", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool name and version to create a symlink for", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + }, + { + "name": "path", + "description": "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List installed and active tool versions", + "options": [ + { + "name": [ + "-c", + "--current" + ], + "description": "Only show tool versions currently specified in a mise.toml", + "isRepeatable": false + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Only show tool versions currently specified in the global mise.toml", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--installed" + ], + "description": "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", + "isRepeatable": false + }, + { + "name": [ + "-o", + "--offline" + ], + "description": "Don't fetch information such as outdated versions", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "-m", + "--missing" + ], + "description": "Display missing tool versions", + "isRepeatable": false + }, + { + "name": [ + "--prefix" + ], + "description": "Display versions matching this prefix", + "isRepeatable": false, + "args": { + "name": "prefix", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) + } + }, + { + "name": [ + "--no-header" + ], + "description": "Don't display headers", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Only show tool versions from [PLUGIN]", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + } + ] + }, + { + "name": [ + "ls-remote" + ], + "description": "List runtime versions available for install.", + "options": [ + { + "name": [ + "--all" + ], + "description": "Show all installed plugins and versions", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Plugin to get versions for", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + }, + { + "name": "prefix", + "description": "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\"", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) + } + ] + }, + { + "name": [ + "outdated" + ], + "description": "Shows outdated tool versions", + "options": [ + { + "name": [ + "-l", + "--bump" + ], + "description": "Compares against the latest versions available, not what matches the current config", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "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", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + ] + }, + { + "name": [ + "plugins", + "p" + ], + "description": "Manage plugins", + "subcommands": [ + { + "name": [ + "install", + "i", + "a", + "add" + ], + "description": "Install a plugin", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Reinstall even if plugin exists", + "isRepeatable": false + }, + { + "name": [ + "-a", + "--all" + ], + "description": "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show installation output", + "isRepeatable": true + } + ], + "args": [ + { + "name": "new_plugin", + "description": "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise plugins --all`) + }, + { + "name": "git_url", + "description": "The git url of the plugin", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "link", + "ln" + ], + "description": "Symlinks a plugin into mise", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Overwrite existing plugin", + "isRepeatable": false + } + ], + "args": [ + { + "name": "name", + "description": "The name of the plugin\ne.g.: node, ruby", + "isOptional": false, + "isVariadic": false + }, + { + "name": "path", + "description": "The local path to the plugin\ne.g.: ./mise-node", + "isOptional": true, + "isVariadic": false, + "template": "filepaths" + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List installed plugins", + "options": [ + { + "name": [ + "-c", + "--core" + ], + "description": "The built-in plugins only\nNormally these are not shown", + "isRepeatable": false + }, + { + "name": [ + "--user" + ], + "description": "List installed plugins", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + "isRepeatable": false + } + ] + }, + { + "name": [ + "ls-remote", + "list-remote", + "list-all" + ], + "description": "List all available remote plugins", + "options": [ + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", + "isRepeatable": false + }, + { + "name": [ + "--only-names" + ], + "description": "Only show the name of each plugin by default it will show a \"*\" next to installed plugins", + "isRepeatable": false + } + ] + }, + { + "name": [ + "uninstall", + "remove", + "rm" + ], + "description": "Removes a plugin", + "options": [ + { + "name": [ + "-p", + "--purge" + ], + "description": "Also remove the plugin's installs, downloads, and cache", + "isRepeatable": false + }, + { + "name": [ + "-a", + "--all" + ], + "description": "Remove all plugins", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to remove", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + } + ] + }, + { + "name": [ + "update", + "up", + "upgrade" + ], + "description": "Updates a plugin to the latest version", + "options": [ + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\nDefault: 4", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to update", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + } + ] + } + ], + "options": [ + { + "name": [ + "-c", + "--core" + ], + "description": "The built-in plugins only\nNormally these are not shown", + "isRepeatable": false + }, + { + "name": [ + "--user" + ], + "description": "List installed plugins", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + "isRepeatable": false + } + ] + }, + { + "name": [ + "prune" + ], + "description": "Delete unused versions of tools", + "options": [ + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Do not actually delete anything", + "isRepeatable": false + }, + { + "name": [ + "--configs" + ], + "description": "Prune only tracked and trusted configuration links that point to non-existent configurations", + "isRepeatable": false + }, + { + "name": [ + "--tools" + ], + "description": "Prune only unused versions of tools", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Prune only versions from this plugin(s)", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + } + ] + }, + { + "name": [ + "registry" + ], + "description": "List available tools to install", + "args": [ + { + "name": "name", + "description": "Show only the specified tool's full name", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "reshim" + ], + "description": "Creates new shims based on bin paths from currently installed tools.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Removes all shims before reshimming", + "isRepeatable": false + } + ] + }, + { + "name": [ + "run", + "r" + ], + "description": "Run task(s)", + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change to this directory before executing the command", + "isRepeatable": false, + "args": { + "name": "cd", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Don't actually run the tasks(s), just print them in order of execution", + "isRepeatable": false + }, + { + "name": [ + "-f", + "--force" + ], + "description": "Force the tasks to run even if outputs are up to date", + "isRepeatable": false + }, + { + "name": [ + "-p", + "--prefix" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interleave" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Tool(s) to also add e.g.: node@20 python@3.10", + "isRepeatable": true, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--raw" + ], + "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + "isRepeatable": false + }, + { + "name": [ + "--timings" + ], + "description": "Shows elapsed time after each task completes", + "isRepeatable": false + } + ], + "generateSpec": usageGenerateSpec(["mise tasks --usage"]), + "cache": false + }, + { + "name": [ + "self-update" + ], + "description": "Updates mise itself.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Update even if already up to date", + "isRepeatable": false + }, + { + "name": [ + "--no-plugins" + ], + "description": "Disable auto-updating plugins", + "isRepeatable": false + }, + { + "name": [ + "-y", + "--yes" + ], + "description": "Skip confirmation prompt", + "isRepeatable": false + } + ], + "args": [ + { + "name": "version", + "description": "Update to a specific version", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "set" + ], + "description": "Set environment variables in mise.toml", + "options": [ + { + "name": [ + "--file" + ], + "description": "The TOML file to update", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Set the environment variable in the global config file", + "isRepeatable": false + } + ], + "args": [ + { + "name": "env_vars", + "description": "Environment variable(s) to set\ne.g.: NODE_ENV=production", + "isOptional": true, + "isVariadic": true, + "generators": envVarGenerator + } + ] + }, + { + "name": [ + "settings" + ], + "description": "Manage settings", + "subcommands": [ + { + "name": [ + "add" + ], + "description": "Adds a setting to the configuration file", + "args": [ + { + "name": "setting", + "description": "The setting to set", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise settings --keys`) + }, + { + "name": "value", + "description": "The value to set", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "get" + ], + "description": "Show a current setting", + "args": [ + { + "name": "setting", + "description": "The setting to show", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise settings --keys`) + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "Show current settings", + "options": [ + { + "name": [ + "--keys" + ], + "description": "Only display key names for each setting", + "isRepeatable": false + } + ] + }, + { + "name": [ + "set", + "create" + ], + "description": "Add/update a setting", + "args": [ + { + "name": "setting", + "description": "The setting to set", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise settings --keys`) + }, + { + "name": "value", + "description": "The value to set", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "unset", + "rm", + "remove", + "delete", + "del" + ], + "description": "Clears a setting", + "args": [ + { + "name": "setting", + "description": "The setting to remove", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise settings --keys`) + } + ] + } + ], + "options": [ + { + "name": [ + "--keys" + ], + "description": "Only display key names for each setting", + "isRepeatable": false + } + ] + }, + { + "name": [ + "shell", + "sh" + ], + "description": "Sets a tool version for the current session.", + "options": [ + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--unset" + ], + "description": "Removes a previously set version", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to use", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + ] + }, + { + "name": [ + "sync" + ], + "description": "Add tool versions from external tools to mise", + "subcommands": [ + { + "name": [ + "node" + ], + "description": "Symlinks all tool versions from an external tool into mise", + "options": [ + { + "name": [ + "--brew" + ], + "description": "Get tool versions from Homebrew", + "isRepeatable": false + }, + { + "name": [ + "--nvm" + ], + "description": "Get tool versions from nvm", + "isRepeatable": false + }, + { + "name": [ + "--nodenv" + ], + "description": "Get tool versions from nodenv", + "isRepeatable": false + } + ] + }, + { + "name": [ + "python" + ], + "description": "Symlinks all tool versions from an external tool into mise", + "options": [ + { + "name": [ + "--pyenv" + ], + "description": "Get tool versions from pyenv", + "isRepeatable": false + } + ] + } + ] + }, + { + "name": [ + "tasks", + "t" + ], + "description": "Manage tasks", + "subcommands": [ + { + "name": [ + "deps" + ], + "description": "Display a tree visualization of a dependency graph", + "options": [ + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--dot" + ], + "description": "Display dependencies in DOT format", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tasks", + "description": "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "edit" + ], + "description": "Edit a tasks with $EDITOR", + "options": [ + { + "name": [ + "-p", + "--path" + ], + "description": "Display the path to the tasks instead of editing it", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Tasks to edit", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) + } + ] + }, + { + "name": [ + "info" + ], + "description": "Get information about a task", + "options": [ + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Name of the task to get information about", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) + } + ] + }, + { + "name": [ + "ls" + ], + "description": "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.", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-x", + "--extended" + ], + "description": "Show all columns", + "isRepeatable": false + }, + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--sort" + ], + "description": "Sort by column. Default is name.", + "isRepeatable": false, + "args": { + "name": "column", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "name", + "alias", + "description", + "source" + ] + } + }, + { + "name": [ + "--sort-order" + ], + "description": "Sort order. Default is asc.", + "isRepeatable": false, + "args": { + "name": "sort_order", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "asc", + "desc" + ] + } + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "run", + "r" + ], + "description": "Run task(s)", + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change to this directory before executing the command", + "isRepeatable": false, + "args": { + "name": "cd", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Don't actually run the tasks(s), just print them in order of execution", + "isRepeatable": false + }, + { + "name": [ + "-f", + "--force" + ], + "description": "Force the tasks to run even if outputs are up to date", + "isRepeatable": false + }, + { + "name": [ + "-p", + "--prefix" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interleave" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Tool(s) to also add e.g.: node@20 python@3.10", + "isRepeatable": true, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--raw" + ], + "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + "isRepeatable": false + }, + { + "name": [ + "--timings" + ], + "description": "Shows elapsed time after each task completes", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) + }, + { + "name": "args", + "description": "Arguments to pass to the tasks. Use \":::\" to separate tasks", + "isOptional": true, + "isVariadic": true + } + ], + "generateSpec": usageGenerateSpec(["mise tasks --usage"]), + "cache": false + } + ], + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-x", + "--extended" + ], + "description": "Show all columns", + "isRepeatable": false + }, + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--sort" + ], + "description": "Sort by column. Default is name.", + "isRepeatable": false, + "args": { + "name": "column", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "name", + "alias", + "description", + "source" + ] + } + }, + { + "name": [ + "--sort-order" + ], + "description": "Sort order. Default is asc.", + "isRepeatable": false, + "args": { + "name": "sort_order", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "asc", + "desc" + ] + } + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "trust" + ], + "description": "Marks a config file as trusted", + "options": [ + { + "name": [ + "-a", + "--all" + ], + "description": "Trust all config files in the current directory and its parents", + "isRepeatable": false + }, + { + "name": [ + "--untrust" + ], + "description": "No longer trust this config", + "isRepeatable": false + }, + { + "name": [ + "--show" + ], + "description": "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", + "isRepeatable": false + } + ], + "args": [ + { + "name": "config_file", + "description": "The config file to trust", + "isOptional": true, + "isVariadic": false, + "template": "filepaths", + "generators": completionGeneratorTemplate(``) + } + ] + }, + { + "name": [ + "uninstall", + "remove", + "rm" + ], + "description": "Removes installed tool versions", + "options": [ + { + "name": [ + "-a", + "--all" + ], + "description": "Delete all installed versions", + "isRepeatable": false + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Do not actually delete anything", + "isRepeatable": false + } + ], + "args": [ + { + "name": "installed_tool@version", + "description": "Tool(s) to remove", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + if [ ! -z "$prefix" ]; then + prefix="--prefix $prefix" + fi + versions=$(mise ls --installed $tool $prefix | awk '{print $2}' | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise ls --installed | awk '{print $1}' | sed '1!G;h;$!d') + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + ] + }, + { + "name": [ + "unset" + ], + "description": "Remove environment variable(s) from the config file.", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "Specify a file to use instead of `mise.toml`", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Use the global config file", + "isRepeatable": false + } + ], + "args": [ + { + "name": "keys", + "description": "Environment variable(s) to remove\ne.g.: NODE_ENV", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "upgrade", + "up" + ], + "description": "Upgrades outdated tools", + "options": [ + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Just print what would be done, don't actually do it", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interactive" + ], + "description": "Display multiselect menu to choose which tools to upgrade", + "isRepeatable": false + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-l", + "--bump" + ], + "description": "Upgrades to the latest version available, bumping the version in mise.toml", + "isRepeatable": false + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + ] + }, + { + "name": [ + "use", + "u" + ], + "description": "Installs a tool and adds the version it to mise.toml.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Force reinstall even if already installed", + "isRepeatable": false + }, + { + "name": [ + "--fuzzy" + ], + "description": "Save fuzzy version to config file", + "isRepeatable": false + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", + "isRepeatable": false + }, + { + "name": [ + "-e", + "--env" + ], + "description": "Modify an environment-specific config file like .mise..toml", + "isRepeatable": false, + "args": { + "name": "env", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", + "isRepeatable": false + }, + { + "name": [ + "--remove" + ], + "description": "Remove the plugin(s) from config file", + "isRepeatable": true, + "args": { + "name": "plugin", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise plugins --core --user`) + } + }, + { + "name": [ + "-p", + "--path" + ], + "description": "Specify a path to a config file or directory", + "isRepeatable": false, + "args": { + "name": "path", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "--pin" + ], + "description": "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to add to config file", + "isOptional": true, + "isVariadic": true, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + ] + }, + { + "name": [ + "version", + "v" + ], + "description": "Display the version of mise" + }, + { + "name": [ + "watch", + "w" + ], + "description": "Run task(s) and watch for changes to rerun it", + "options": [ + { + "name": [ + "-t", + "--task" + ], + "description": "Tasks to run", + "isRepeatable": true, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) + } + }, + { + "name": [ + "-g", + "--glob" + ], + "description": "Files to watch\nDefaults to sources from the tasks(s)", + "isRepeatable": true, + "args": { + "name": "glob", + "isOptional": false, + "isVariadic": false + } + } + ], + "args": [ + { + "name": "args", + "description": "Extra arguments", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "where" + ], + "description": "Display the installation path for a tool", + "args": [ + { + "name": "tool@version", + "description": "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", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + ] + }, + { + "name": [ + "which" + ], + "description": "Shows the path that a tool's bin points to.", + "options": [ + { + "name": [ + "--plugin" + ], + "description": "Show the plugin name instead of the path", + "isRepeatable": false + }, + { + "name": [ + "--version" + ], + "description": "Show the version instead of the path", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", + "isRepeatable": false, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`) + } + } + ], + "args": [ + { + "name": "bin_name", + "description": "The bin to look up", + "isOptional": false, + "isVariadic": false + } + ] + } + ], + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change directory before running command", + "isRepeatable": false, + "args": { + "name": "dir", + "isOptional": false, + "isVariadic": false, + "template": "folders" + } + }, + { + "name": [ + "-P", + "--profile" + ], + "description": "Set the profile (environment)", + "isRepeatable": false, + "args": { + "name": "profile", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress non-error messages", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show extra output (use -vv for even more)", + "isRepeatable": true + }, + { + "name": [ + "-y", + "--yes" + ], + "description": "Answer yes to all confirmation prompts", + "isRepeatable": false + } + ] +} + +export default completionSpec; From aed424b9d69201958d9f78756a1c5c9061b9e292 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 19:58:34 +0000 Subject: [PATCH 03/14] [autofix.ci] apply automated fixes (attempt 2/3) --- tasks/fig/src/mise.ts | 5480 ++++++++++++++++++++--------------------- 1 file changed, 2701 insertions(+), 2779 deletions(-) diff --git a/tasks/fig/src/mise.ts b/tasks/fig/src/mise.ts index 2e125764d2..b80f778d84 100644 --- a/tasks/fig/src/mise.ts +++ b/tasks/fig/src/mise.ts @@ -1,2890 +1,2812 @@ -const usageGenerateSpec = (cmds: string[]) => { - return async ( - context: string[], - executeCommand: Fig.ExecuteCommandFunction, - ): Promise => { - const promises = cmds.map(async (cmd): Promise => { - try { - const args = cmd.split(" "); - const { - stdout, - stderr: cmdStderr, - status: cmdStatus, - } = await executeCommand({ - command: args[0], - args: args.splice(1), - }); - if (cmdStatus !== 0) { - return [{ name: "error", description: cmdStderr }]; - } - const { - stdout: figSpecOut, - stderr: figSpecStderr, - status: usageFigStatus, - } = await executeCommand({ - command: "usage", - args: ["g", "fig", "--spec", stdout], - }); - if (usageFigStatus !== 0) { - return [{ name: "error", description: figSpecStderr }]; - } +// If not being published, these need to manually downloaded from https://github.com/withfig/autocomplete/tree/master/src +import { createNpmSearchHandler } from "./npm" +import { searchGenerator as createCargoSearchGenerator } from "./cargo" - const start_of_json = figSpecOut.indexOf("{"); - const j = figSpecOut.slice(start_of_json); - return JSON.parse(j).subcommands as Fig.Subcommand[]; - } catch (e) { - return [{ name: "error", description: e }] as Fig.Subcommand[]; - } - }); +const envVarGenerator = { + script: ['sh', '-c', 'env'], + postProcess: (output: string) => { + return output.split('\n').map(l => ({name: l.split('=')[0]})) + } +} - // eslint-disable-next-line compat/compat - const results = await Promise.allSettled(promises); - const subcommands = results - .filter((p) => p.status === "fulfilled") - .map((p) => p.value); - const failed = results - .filter((p) => p.status === "rejected") - .map((p) => ({ name: "error", description: p.reason })); +const singleCmdNewLineGenerator = (completion_cmd: string): Fig.Generator => ({ + script: completion_cmd.split(' '), + splitOn: '\n' +}) - return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; - }; -}; +const singleCmdJsonGenerator = (cmd: string): Fig.Generator => ({ + script: cmd.split(' '), + postProcess: (out) => (JSON.parse(out).map((r: any) => ({name: r.name, description: r.description}))) +}) -const completionGeneratorTemplate = ( - argSuggestionBash: string, -): Fig.Generator => { - return { - custom: async (tokens: string[], executeCommand) => { - let arg = argSuggestionBash; - if (tokens.length >= 1) { - arg = argSuggestionBash.replace( - "{{words[CURRENT]}}", - tokens[tokens.length - 1], - ); - } +const contextualGeneratorLastWord = (cmd: string): Fig.Generator => ({ + script: (context) => { + if (context.length < 2) { + return [] + } + + const prev = context[context.length - 2] // -1 is the current word + return ['sh', '-c', [cmd, prev].join(' ')] + } +}) - if (tokens.length >= 2) { - arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); +const aliasGenerator: Fig.Generator = { + ...contextualGeneratorLastWord('mise alias ls'), + postProcess: (out) => { + //return [{name: out}] + //return out.split('\t').map(l => ({name: l})) + //return [{name: "test", "description": out}] + const tokens = out.split(/\s+/) + if (tokens.length == 0) + return [] + + return tokens.flatMap((_, i) => { + if ((i % 3) == 0) { + return [tokens[i+1]] } - const { stdout: text } = await executeCommand({ - command: "sh", - args: ["-c", arg], - }); - if (text.trim().length == 0) return []; - return text.split("\n").map((elm) => ({ name: elm })); - }, - }; + return [] + }).filter(l => l.trim().length > 0).map(l => ({name: l.trim()})) + } +} + +const pluginWithAlias: Fig.Generator = { + script: 'mise alias ls'.split(' '), + postProcess: (output: string) => { + const plugins = output.split('\n').map((line) => { + const tokens = line.split(/\s+/) + return tokens[0] + }) + return [... new Set(plugins)].map((p) => ({name: p})) + } +} + +const getInstalledTools = async (executeShellCommand: Fig.ExecuteCommandFunction) => { + const {stdout} = await executeShellCommand({ + command: 'sh', args: ['-c', 'mise ls --installed'] + }) + return [...new Set(stdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return {name: tokens[0], version: tokens[1]} + }))] +} + + +type ConfigLsOutput = { + path: string + tools: string[] +} + +const configPathGenerator: Fig.Generator = { + ...singleCmdJsonGenerator('mise config ls -J'), + postProcess: (out) => JSON.parse(out).map((r: ConfigLsOutput) => ({name: r.path, description: r.path})) +} + + +type ObjectKeyType = string | symbol | number +type ObjectAcceptableKeyValues = { + [key: string]: ObjectKeyType +} + +function groupBy(array: T[], key: keyof T): Record { + return array.reduce((result, currentItem) => { + (result[currentItem[key] as (ObjectKeyType)] = result[currentItem[key] as (ObjectKeyType)] || []) + .push(currentItem); + return result; + }, {} as Record); }; +const installedToolsGenerator: Fig.Generator = { + script: ['sh', '-c', 'mise ls --installed'], + postProcess: (stdout: string) => { + return [...new Set(stdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return {name: tokens[0], version: tokens[1]} + }))] + } +} -const completionSpec: Fig.Spec = { - "name": [ - "mise" - ], - "subcommands": [ - { - "name": [ - "activate" - ], - "description": "Initializes mise in the current shell session", - "options": [ - { - "name": [ - "--shims" - ], - "description": "Use shims instead of modifying PATH\nEffectively the same as:", - "isRepeatable": false - }, - { - "name": [ - "-q", - "--quiet" - ], - "description": "Suppress non-error messages", - "isRepeatable": false - } - ], - "args": [ - { - "name": "shell_type", - "description": "Shell type to generate the script for", - "isOptional": true, - "isVariadic": false, - "suggestions": [ - "bash", - "elvish", - "fish", - "nu", - "xonsh", - "zsh" - ] - } - ] - }, - { - "name": [ - "alias", - "a" - ], - "description": "Manage aliases", - "subcommands": [ - { - "name": [ - "get" - ], - "description": "Show an alias for a plugin", - "args": [ - { - "name": "plugin", - "description": "The plugin to show the alias for", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) - }, - { - "name": "alias", - "description": "The alias to show", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise alias ls {{words[PREV]}} | awk '{print $2}'`) - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Don't show table header", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool", - "description": "Show aliases for ", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "set", - "add", - "create" - ], - "description": "Add/update an alias for a plugin", - "args": [ - { - "name": "plugin", - "description": "The plugin to set the alias for", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) - }, - { - "name": "alias", - "description": "The alias to set", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise alias ls {{words[PREV]}} | awk '{print $2}'`) - }, - { - "name": "value", - "description": "The value to set the alias to", - "isOptional": false, - "isVariadic": false - } - ] - }, - { - "name": [ - "unset", - "rm", - "remove", - "delete", - "del" - ], - "description": "Clears an alias for a plugin", - "args": [ - { - "name": "plugin", - "description": "The plugin to remove the alias from", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) - }, - { - "name": "alias", - "description": "The alias to remove", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise alias ls {{words[PREV]}} | awk '{print $2}'`) - } - ] - } - ], - "options": [ - { - "name": [ - "-p", - "--plugin" - ], - "description": "filter aliases by plugin", - "isRepeatable": false, - "args": { - "name": "plugin", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) - } - }, - { - "name": [ - "--no-header" - ], - "description": "Don't show table header", - "isRepeatable": false - } - ] - }, - { - "name": [ - "backends", - "b" - ], - "description": "Manage backends", - "subcommands": [ - { - "name": [ - "ls", - "list" - ], - "description": "List built-in backends" - } - ] - }, - { - "name": [ - "bin-paths" - ], - "description": "List all the active runtime bin paths" - }, - { - "name": [ - "cache" - ], - "description": "Manage the mise cache", - "subcommands": [ - { - "name": [ - "clear", - "c" - ], - "description": "Deletes all cache files in mise", - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to clear cache for e.g.: node, python", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) - } - ] - }, - { - "name": [ - "prune", - "p" - ], - "description": "Removes stale mise cache files", - "options": [ - { - "name": [ - "--dry-run" - ], - "description": "Just show what would be pruned", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show pruned files", - "isRepeatable": true - } - ], - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to clear cache for e.g.: node, python", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) - } - ] - } - ] - }, - { - "name": [ - "completion" - ], - "description": "Generate shell completions", - "args": [ - { - "name": "shell", - "description": "Shell type to generate completions for", - "isOptional": true, - "isVariadic": false, - "suggestions": [ - "bash", - "fish", - "zsh" - ] - } - ] - }, - { - "name": [ - "config", - "cfg" - ], - "description": "Manage config files", - "subcommands": [ - { - "name": [ - "generate", - "g" - ], - "description": "[experimental] Generate a mise.toml file", - "options": [ - { - "name": [ - "-o", - "--output" - ], - "description": "Output to file instead of stdout", - "isRepeatable": false, - "args": { - "name": "output", - "isOptional": false, - "isVariadic": false - } - } - ] - }, - { - "name": [ - "get" - ], - "description": "Display the value of a setting in a mise.toml file", - "options": [ - { - "name": [ - "-f", - "--file" - ], - "description": "The path to the mise.toml file to edit", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - } - ], - "args": [ - { - "name": "key", - "description": "The path of the config to display", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "ls" - ], - "description": "List config files currently in use", - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "set" - ], - "description": "Set the value of a setting in a mise.toml file", - "options": [ - { - "name": [ - "-f", - "--file" - ], - "description": "The path to the mise.toml file to edit", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-t", - "--type" - ], - "isRepeatable": false, - "args": { - "name": "type", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "infer", - "string", - "integer", - "float", - "bool", - "list" - ] - } - } - ], - "args": [ - { - "name": "key", - "description": "The path of the config to display", - "isOptional": false, - "isVariadic": false - }, - { - "name": "value", - "description": "The value to set the key to", - "isOptional": false, - "isVariadic": false - } - ] - } - ], - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "deactivate" - ], - "description": "Disable mise for current shell session" - }, - { - "name": [ - "direnv" - ], - "description": "Output direnv function to use mise inside direnv", - "subcommands": [ - { - "name": [ - "activate" - ], - "description": "Output direnv function to use mise inside direnv" - } - ] - }, - { - "name": [ - "doctor", - "dr" - ], - "description": "Check mise installation for possible problems" - }, - { - "name": [ - "env", - "e" - ], - "description": "Exports env vars to activate mise a single time", - "options": [ - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - }, - { - "name": [ - "-s", - "--shell" - ], - "description": "Shell type to generate environment variables for", - "isRepeatable": false, - "args": { - "name": "shell", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "bash", - "elvish", - "fish", - "nu", - "xonsh", - "zsh" - ] - } - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to use", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') +const pluginGenerator: Fig.Generator = installedToolsGenerator +const allPluginsGenerator: Fig.Generator = singleCmdNewLineGenerator('mise plugins --all') +const simpleTaskGenerator = singleCmdJsonGenerator('mise tasks -J') +const settingsGenerator = singleCmdNewLineGenerator(`mise settings --keys`) - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - ] - }, - { - "name": [ - "exec", - "x" - ], - "description": "Execute a command with tool(s) set", - "options": [ - { - "name": [ - "-c", - "--command" - ], - "description": "Command string to execute", - "isRepeatable": false, - "args": { - "name": "c", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to start e.g.: node@20 python@3.10", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" +const atsInStr = (s: string) => (s.match(/@/g) || []).length != 0; +const backendSepInStr = (s: string) => (s.match(/:/g) || []).length != 0; - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') +const searchBackend = async (backend: string, context: string[], + executeShellCommand: Fig.ExecuteCommandFunction, + shellContext: Fig.GeneratorContext): Promise => { + const customContext = context; + customContext[context.length - 1] = customContext[context.length - 1].replace(`${backend}:`, '') + switch (backend) { + case 'npm': + return (await (createNpmSearchHandler()(context, executeShellCommand, shellContext))) + case 'cargo': + //return [{name: customContext[context.length - 1]}] + return (await (createCargoSearchGenerator.custom(customContext, executeShellCommand, shellContext))) + case 'asdf': + const { stdout } = await executeShellCommand({ + command: 'sh', args: ['-c', 'mise registry'] + }) + return [...new Set(stdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return { name: tokens[1].replace(`${backend}:`, '') } + }))] + case 'ubi': + const { stdout: ubiOut } = await executeShellCommand({ + command: 'sh', args: ['-c', 'mise registry'] + }) + return [...new Set(ubiOut.split('\n').flatMap(l => { + const tokens = l.split(/\s+/) + if (!tokens[1].includes('ubi:')) return [] + return [{ name: tokens[1].replace('ubi:', '') }] as Fig.Suggestion + }))] + default: + return [] + } +} - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - }, - { - "name": "command", - "description": "Command string to execute (same as --command)", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "generate", - "g" - ], - "description": "[experimental] Generate files for various tools/services", - "subcommands": [ - { - "name": [ - "git-pre-commit", - "pre-commit" - ], - "description": "[experimental] Generate a git pre-commit hook", - "options": [ - { - "name": [ - "--hook" - ], - "description": "Which hook to generate (saves to .git/hooks/$hook)", - "isRepeatable": false, - "args": { - "name": "hook", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-t", - "--task" - ], - "description": "The task to run when the pre-commit hook is triggered", - "isRepeatable": false, - "args": { - "name": "task", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) - } - }, - { - "name": [ - "-w", - "--write" - ], - "description": "write to .git/hooks/pre-commit and make it executable", - "isRepeatable": false - } - ] - }, - { - "name": [ - "github-action" - ], - "description": "[experimental] Generate a GitHub Action workflow file", - "options": [ - { - "name": [ - "-n", - "--name" - ], - "description": "the name of the workflow to generate", - "isRepeatable": false, - "args": { - "name": "name", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-t", - "--task" - ], - "description": "The task to run when the workflow is triggered", - "isRepeatable": false, - "args": { - "name": "task", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) - } - }, - { - "name": [ - "-w", - "--write" - ], - "description": "write to .github/workflows/$name.yml", - "isRepeatable": false - } - ] - }, - { - "name": [ - "task-docs" - ], - "description": "Generate documentation for tasks in a project", - "options": [ - { - "name": [ - "-I", - "--index" - ], - "description": "write only an index of tasks, intended for use with `--multi`", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--inject" - ], - "description": "inserts the documentation into an existing file", - "isRepeatable": false - }, - { - "name": [ - "-m", - "--multi" - ], - "description": "render each task as a separate document, requires `--output` to be a directory", - "isRepeatable": false - }, - { - "name": [ - "-o", - "--output" - ], - "description": "writes the generated docs to a file/directory", - "isRepeatable": false, - "args": { - "name": "output", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-r", - "--root" - ], - "description": "root directory to search for tasks", - "isRepeatable": false, - "args": { - "name": "root", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-s", - "--style" - ], - "isRepeatable": false, - "args": { - "name": "style", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "simple", - "detailed" - ] - } - } - ] - } - ] - }, - { - "name": [ - "implode" - ], - "description": "Removes mise CLI and all related data", - "options": [ - { - "name": [ - "--config" - ], - "description": "Also remove config directory", - "isRepeatable": false - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "List directories that would be removed without actually removing them", - "isRepeatable": false - } - ] - }, - { - "name": [ - "install", - "i" - ], - "description": "Install a tool version", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Force reinstall even if already installed", - "isRepeatable": false - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show installation output", - "isRepeatable": true - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to install e.g.: node@20", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" +const compareVersions = (a: string, b: string ): number => { + const result = [a,b].sort() // Unless we can add semversort + if (result[0] != a) return 1 + return -1 +} - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') +const toolVersionGenerator: Fig.Generator = { + trigger: (newToken: string, oldToken: string): boolean => { + return (backendSepInStr(newToken) && !backendSepInStr(oldToken)) || + (atsInStr(newToken) && !atsInStr(oldToken)) + }, + getQueryTerm: '@', - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - ] - }, - { - "name": [ - "latest" - ], - "description": "Gets the latest available version for a plugin", - "options": [ - { - "name": [ - "-i", - "--installed" - ], - "description": "Show latest installed instead of available version", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool to get the latest version of", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" + custom: async (context: string[], + executeShellCommand: Fig.ExecuteCommandFunction, + shellContext: Fig.GeneratorContext) => { + + const currentWord = context[context.length - 1] + if (backendSepInStr(currentWord)) { + // Let's handle backends + const backend = currentWord.slice(0, currentWord.lastIndexOf(':')) + + return (await searchBackend(backend, context, executeShellCommand, shellContext)) + .map(s => ({...s, name: `${backend}:${s.name}`, displayName: s.name, icon: '📦'})) + + } else if (atsInStr(currentWord)) { + const tool = currentWord.slice(0, currentWord.lastIndexOf('@')) + const { stdout } = await executeShellCommand({ + command: 'sh', args: ['-c', `mise ls-remote ${tool}`] + }) + const remote_versions_suggestions = stdout.split('\n').sort((a,b) => compareVersions(b,a)).map(l => ({name: l})) + const { stdout: aliasStdout } = await executeShellCommand({ + command: 'sh', args: ['-c', `mise alias ls ${tool}`] + }) + const aliases_suggestions = aliasStdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return {name: tokens[1]} + }) + return [...aliases_suggestions, ...remote_versions_suggestions] + } - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + const { stdout } = await executeShellCommand({ + command: 'sh', args: ['-c', 'mise registry'] + }) + return [...new Set(stdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return { name: tokens[0] } + }))] + } +} - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - ] - }, - { - "name": [ - "link", - "ln" - ], - "description": "Symlinks a tool version into mise", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Overwrite an existing tool version if it exists", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool name and version to create a symlink for", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') +const installedToolVersionGenerator: Fig.Generator = { + trigger: '@', + getQueryTerm: '@', + custom: async (context: string[], + executeShellCommand: Fig.ExecuteCommandFunction) => { + + const tools = await getInstalledTools(executeShellCommand) + const toolsVersions = groupBy(tools, "name") - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - }, - { - "name": "path", - "description": "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "List installed and active tool versions", - "options": [ - { - "name": [ - "-c", - "--current" - ], - "description": "Only show tool versions currently specified in a mise.toml", - "isRepeatable": false - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Only show tool versions currently specified in the global mise.toml", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--installed" - ], - "description": "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", - "isRepeatable": false - }, - { - "name": [ - "-o", - "--offline" - ], - "description": "Don't fetch information such as outdated versions", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - }, - { - "name": [ - "-m", - "--missing" - ], - "description": "Display missing tool versions", - "isRepeatable": false - }, - { - "name": [ - "--prefix" - ], - "description": "Display versions matching this prefix", - "isRepeatable": false, - "args": { - "name": "prefix", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) - } - }, - { - "name": [ - "--no-header" - ], - "description": "Don't display headers", - "isRepeatable": false - } - ], - "args": [ - { - "name": "plugin", - "description": "Only show tool versions from [PLUGIN]", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) - } - ] - }, - { - "name": [ - "ls-remote" - ], - "description": "List runtime versions available for install.", - "options": [ - { - "name": [ - "--all" - ], - "description": "Show all installed plugins and versions", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Plugin to get versions for", - "isOptional": true, - "isVariadic": false, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" + const currentWord = context[context.length - 1] + if (atsInStr(currentWord)) { + const tool = currentWord.slice(0, currentWord.lastIndexOf('@')) - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + const { stdout: aliasStdout } = await executeShellCommand({ + command: 'sh', args: ['-c', `mise alias ls ${tool}`] + }) - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - }, - { - "name": "prefix", - "description": "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\"", - "isOptional": true, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) - } - ] - }, - { - "name": [ - "outdated" - ], - "description": "Shows outdated tool versions", - "options": [ - { - "name": [ - "-l", - "--bump" - ], - "description": "Compares against the latest versions available, not what matches the current config", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - }, - { - "name": [ - "--no-header" - ], - "description": "Don't show table header", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "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", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" + // This lists all aliases even if they are not installed + /* + const aliases_suggestions = aliasStdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return {name: tokens[1], description: tokens[2]} + }) as Fig.Suggestion[] + */ + + const toolVersions = (toolsVersions[tool] || []) as {name: string, version: string}[] + const suggestions = toolVersions.map(s => ({ + name: s.version + })) as Fig.Suggestion[] - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + return [...suggestions] + } + + const suggestions: Fig.Suggestion[] = [] + Object.keys(toolsVersions).forEach((k) => { + if (toolsVersions[k].length == 1) { + suggestions.push({name: k}) + } + else { + suggestions.push({name: `${k}@`}) + } + }) - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - ] - }, - { - "name": [ - "plugins", - "p" - ], - "description": "Manage plugins", - "subcommands": [ - { - "name": [ - "install", - "i", - "a", - "add" - ], - "description": "Install a plugin", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Reinstall even if plugin exists", - "isRepeatable": false - }, - { - "name": [ - "-a", - "--all" - ], - "description": "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show installation output", - "isRepeatable": true - } - ], - "args": [ - { - "name": "new_plugin", - "description": "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", - "isOptional": true, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise plugins --all`) - }, - { - "name": "git_url", - "description": "The git url of the plugin", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "link", - "ln" - ], - "description": "Symlinks a plugin into mise", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Overwrite existing plugin", - "isRepeatable": false - } - ], - "args": [ - { - "name": "name", - "description": "The name of the plugin\ne.g.: node, ruby", - "isOptional": false, - "isVariadic": false - }, - { - "name": "path", - "description": "The local path to the plugin\ne.g.: ./mise-node", - "isOptional": true, - "isVariadic": false, - "template": "filepaths" - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "List installed plugins", - "options": [ - { - "name": [ - "-c", - "--core" - ], - "description": "The built-in plugins only\nNormally these are not shown", - "isRepeatable": false - }, - { - "name": [ - "--user" - ], - "description": "List installed plugins", - "isRepeatable": false - }, - { - "name": [ - "-u", - "--urls" - ], - "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - "isRepeatable": false - } - ] - }, - { - "name": [ - "ls-remote", - "list-remote", - "list-all" - ], - "description": "List all available remote plugins", - "options": [ - { - "name": [ - "-u", - "--urls" - ], - "description": "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", - "isRepeatable": false - }, - { - "name": [ - "--only-names" - ], - "description": "Only show the name of each plugin by default it will show a \"*\" next to installed plugins", - "isRepeatable": false - } - ] - }, - { - "name": [ - "uninstall", - "remove", - "rm" - ], - "description": "Removes a plugin", - "options": [ - { - "name": [ - "-p", - "--purge" - ], - "description": "Also remove the plugin's installs, downloads, and cache", - "isRepeatable": false - }, - { - "name": [ - "-a", - "--all" - ], - "description": "Remove all plugins", - "isRepeatable": false + return suggestions + } +} +const usageGenerateSpec = (cmds: string[]) => { + return async (context: string[], executeCommand: Fig.ExecuteCommandFunction): Promise => { + const promises = cmds.map(async (cmd): Promise => { + try { + const args = cmd.split(" "); + const { stdout, stderr: cmdStderr, status: cmdStatus, } = await executeCommand({ + command: args[0], + args: args.splice(1), + }); + if (cmdStatus !== 0) { + return [{ name: "error", description: cmdStderr }]; + } + const { stdout: figSpecOut, stderr: figSpecStderr, status: usageFigStatus, } = await executeCommand({ + command: "usage", + args: ["g", "fig", "--spec", stdout], + }); + if (usageFigStatus !== 0) { + return [{ name: "error", description: figSpecStderr }]; + } + const start_of_json = figSpecOut.indexOf("{"); + const j = figSpecOut.slice(start_of_json); + return JSON.parse(j).subcommands as Fig.Subcommand[]; } - ], - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to remove", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) + catch (e) { + return [{ name: "error", description: e }] as Fig.Subcommand[]; } - ] - }, - { - "name": [ - "update", - "up", - "upgrade" - ], - "description": "Updates a plugin to the latest version", - "options": [ - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\nDefault: 4", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } + }); + // eslint-disable-next-line compat/compat + const results = await Promise.allSettled(promises); + const subcommands = results + .filter((p) => p.status === "fulfilled") + .map((p) => p.value); + const failed = results + .filter((p) => p.status === "rejected") + .map((p) => ({ name: "error", description: p.reason })); + return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; + }; +}; +const completionGeneratorTemplate = (argSuggestionBash: string): Fig.Generator => { + return { + custom: async (tokens: string[], executeCommand) => { + let arg = argSuggestionBash; + if (tokens.length >= 1) { + arg = argSuggestionBash.replace("{{words[CURRENT]}}", tokens[tokens.length - 1]); } - ], - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to update", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) + if (tokens.length >= 2) { + arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); } - ] - } - ], - "options": [ - { - "name": [ - "-c", - "--core" - ], - "description": "The built-in plugins only\nNormally these are not shown", - "isRepeatable": false - }, - { - "name": [ - "--user" - ], - "description": "List installed plugins", - "isRepeatable": false - }, - { - "name": [ - "-u", - "--urls" - ], - "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - "isRepeatable": false - } - ] - }, - { - "name": [ - "prune" - ], - "description": "Delete unused versions of tools", - "options": [ - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Do not actually delete anything", - "isRepeatable": false - }, - { - "name": [ - "--configs" - ], - "description": "Prune only tracked and trusted configuration links that point to non-existent configurations", - "isRepeatable": false - }, - { - "name": [ - "--tools" - ], - "description": "Prune only unused versions of tools", - "isRepeatable": false - } - ], - "args": [ - { - "name": "plugin", - "description": "Prune only versions from this plugin(s)", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) - } - ] - }, - { - "name": [ - "registry" - ], - "description": "List available tools to install", - "args": [ - { - "name": "name", - "description": "Show only the specified tool's full name", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "reshim" - ], - "description": "Creates new shims based on bin paths from currently installed tools.", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Removes all shims before reshimming", - "isRepeatable": false - } - ] - }, - { - "name": [ - "run", - "r" - ], - "description": "Run task(s)", - "options": [ - { - "name": [ - "-C", - "--cd" - ], - "description": "Change to this directory before executing the command", - "isRepeatable": false, - "args": { - "name": "cd", - "isOptional": false, - "isVariadic": false - } + const { stdout: text } = await executeCommand({ + command: "sh", + args: ["-c", arg], + }); + if (text.trim().length == 0) + return []; + return text.split("\n").map((elm) => ({ name: elm })); + }, + }; +}; +const completionSpec: Fig.Spec = { + "name": [ + "mise" + ], + "subcommands": [ + { + "name": [ + "activate" + ], + "description": "Initializes mise in the current shell session", + "options": [ + { + "name": [ + "--shims" + ], + "description": "Use shims instead of modifying PATH\nEffectively the same as:", + "isRepeatable": false + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress non-error messages", + "isRepeatable": false + } + ], + "args": [ + { + "name": "shell_type", + "description": "Shell type to generate the script for", + "isOptional": true, + "isVariadic": false, + "suggestions": [ + "bash", + "elvish", + "fish", + "nu", + "xonsh", + "zsh" + ] + } + ] }, { - "name": [ - "-n", - "--dry-run" - ], - "description": "Don't actually run the tasks(s), just print them in order of execution", - "isRepeatable": false + "name": [ + "alias", + "a" + ], + "description": "Manage aliases", + "subcommands": [ + { + "name": [ + "get" + ], + "description": "Show an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to show the alias for", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + }, + { + "name": "alias", + "description": "The alias to show", + "isOptional": false, + "isVariadic": false, + "generators": aliasGenerator + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool", + "description": "Show aliases for ", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "set", + "add", + "create" + ], + "description": "Add/update an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to set the alias for", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + }, + { + "name": "alias", + "description": "The alias to set", + "isOptional": false, + "isVariadic": false, + "generators": aliasGenerator + }, + { + "name": "value", + "description": "The value to set the alias to", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "unset", + "rm", + "remove", + "delete", + "del" + ], + "description": "Clears an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to remove the alias from", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + }, + { + "name": "alias", + "description": "The alias to remove", + "isOptional": false, + "isVariadic": false, + "generators": aliasGenerator + } + ] + } + ], + "options": [ + { + "name": [ + "-p", + "--plugin" + ], + "description": "filter aliases by plugin", + "isRepeatable": false, + "args": { + "name": "plugin", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + } + }, + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ] }, { - "name": [ - "-f", - "--force" - ], - "description": "Force the tasks to run even if outputs are up to date", - "isRepeatable": false + "name": [ + "backends", + "b" + ], + "description": "Manage backends", + "subcommands": [ + { + "name": [ + "ls", + "list" + ], + "description": "List built-in backends" + } + ] }, { - "name": [ - "-p", - "--prefix" - ], - "description": "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", - "isRepeatable": false + "name": [ + "bin-paths" + ], + "description": "List all the active runtime bin paths" + }, + { + "name": [ + "cache" + ], + "description": "Manage the mise cache", + "subcommands": [ + { + "name": [ + "clear", + "c" + ], + "description": "Deletes all cache files in mise", + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to clear cache for e.g.: node, python", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "prune", + "p" + ], + "description": "Removes stale mise cache files", + "options": [ + { + "name": [ + "--dry-run" + ], + "description": "Just show what would be pruned", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show pruned files", + "isRepeatable": true + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to clear cache for e.g.: node, python", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + } + ] }, { - "name": [ - "-i", - "--interleave" - ], - "description": "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", - "isRepeatable": false + "name": [ + "completion" + ], + "description": "Generate shell completions", + "args": [ + { + "name": "shell", + "description": "Shell type to generate completions for", + "isOptional": true, + "isVariadic": false, + "suggestions": [ + "bash", + "fish", + "zsh" + ] + } + ] }, { - "name": [ - "-t", - "--tool" - ], - "description": "Tool(s) to also add e.g.: node@20 python@3.10", - "isRepeatable": true, - "args": { - "name": "tool@version", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } + "name": [ + "config", + "cfg" + ], + "description": "Manage config files", + "subcommands": [ + { + "name": [ + "generate", + "g" + ], + "description": "[experimental] Generate a mise.toml file", + "options": [ + { + "name": [ + "-o", + "--output" + ], + "description": "Output to file instead of stdout", + "isRepeatable": false, + "args": { + "name": "output", + "isOptional": false, + "isVariadic": false + } + } + ] + }, + { + "name": [ + "get" + ], + "description": "Display the value of a setting in a mise.toml file", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "The path to the mise.toml file to edit", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + } + ], + "args": [ + { + "name": "key", + "description": "The path of the config to display", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "ls" + ], + "description": "List config files currently in use", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "set" + ], + "description": "Set the value of a setting in a mise.toml file", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "The path to the mise.toml file to edit", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-t", + "--type" + ], + "isRepeatable": false, + "args": { + "name": "type", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "infer", + "string", + "integer", + "float", + "bool", + "list" + ] + } + } + ], + "args": [ + { + "name": "key", + "description": "The path of the config to display", + "isOptional": false, + "isVariadic": false + }, + { + "name": "value", + "description": "The value to set the key to", + "isOptional": false, + "isVariadic": false + } + ] + } + ], + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] }, { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } + "name": [ + "deactivate" + ], + "description": "Disable mise for current shell session" }, { - "name": [ - "-r", - "--raw" - ], - "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - "isRepeatable": false + "name": [ + "direnv" + ], + "description": "Output direnv function to use mise inside direnv", + "subcommands": [ + { + "name": [ + "activate" + ], + "description": "Output direnv function to use mise inside direnv" + } + ] }, { - "name": [ - "--timings" - ], - "description": "Shows elapsed time after each task completes", - "isRepeatable": false - } - ], - "generateSpec": usageGenerateSpec(["mise tasks --usage"]), - "cache": false - }, - { - "name": [ - "self-update" - ], - "description": "Updates mise itself.", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Update even if already up to date", - "isRepeatable": false + "name": [ + "doctor", + "dr" + ], + "description": "Check mise installation for possible problems" + }, + { + "name": [ + "env", + "e" + ], + "description": "Exports env vars to activate mise a single time", + "options": [ + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "-s", + "--shell" + ], + "description": "Shell type to generate environment variables for", + "isRepeatable": false, + "args": { + "name": "shell", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "bash", + "elvish", + "fish", + "nu", + "xonsh", + "zsh" + ] + } + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to use", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] }, { - "name": [ - "--no-plugins" - ], - "description": "Disable auto-updating plugins", - "isRepeatable": false + "name": [ + "exec", + "x" + ], + "description": "Execute a command with tool(s) set", + "options": [ + { + "name": [ + "-c", + "--command" + ], + "description": "Command string to execute", + "isRepeatable": false, + "args": { + "name": "c", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to start e.g.: node@20 python@3.10", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + }, + { + "name": "command", + "description": "Command string to execute (same as --command)", + "isOptional": true, + "isVariadic": true + } + ] }, { - "name": [ - "-y", - "--yes" - ], - "description": "Skip confirmation prompt", - "isRepeatable": false - } - ], - "args": [ - { - "name": "version", - "description": "Update to a specific version", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "set" - ], - "description": "Set environment variables in mise.toml", - "options": [ - { - "name": [ - "--file" - ], - "description": "The TOML file to update", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } + "name": [ + "generate", + "g" + ], + "description": "[experimental] Generate files for various tools/services", + "subcommands": [ + { + "name": [ + "git-pre-commit", + "pre-commit" + ], + "description": "[experimental] Generate a git pre-commit hook", + "options": [ + { + "name": [ + "--hook" + ], + "description": "Which hook to generate (saves to .git/hooks/$hook)", + "isRepeatable": false, + "args": { + "name": "hook", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-t", + "--task" + ], + "description": "The task to run when the pre-commit hook is triggered", + "isRepeatable": false, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + }, + { + "name": [ + "-w", + "--write" + ], + "description": "write to .git/hooks/pre-commit and make it executable", + "isRepeatable": false + } + ] + }, + { + "name": [ + "github-action" + ], + "description": "[experimental] Generate a GitHub Action workflow file", + "options": [ + { + "name": [ + "-n", + "--name" + ], + "description": "the name of the workflow to generate", + "isRepeatable": false, + "args": { + "name": "name", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-t", + "--task" + ], + "description": "The task to run when the workflow is triggered", + "isRepeatable": false, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + }, + { + "name": [ + "-w", + "--write" + ], + "description": "write to .github/workflows/$name.yml", + "isRepeatable": false + } + ] + }, + { + "name": [ + "task-docs" + ], + "description": "Generate documentation for tasks in a project", + "options": [ + { + "name": [ + "-I", + "--index" + ], + "description": "write only an index of tasks, intended for use with `--multi`", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--inject" + ], + "description": "inserts the documentation into an existing file", + "isRepeatable": false + }, + { + "name": [ + "-m", + "--multi" + ], + "description": "render each task as a separate document, requires `--output` to be a directory", + "isRepeatable": false + }, + { + "name": [ + "-o", + "--output" + ], + "description": "writes the generated docs to a file/directory", + "isRepeatable": false, + "args": { + "name": "output", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--root" + ], + "description": "root directory to search for tasks", + "isRepeatable": false, + "args": { + "name": "root", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-s", + "--style" + ], + "isRepeatable": false, + "args": { + "name": "style", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "simple", + "detailed" + ] + } + } + ] + } + ] }, { - "name": [ - "-g", - "--global" - ], - "description": "Set the environment variable in the global config file", - "isRepeatable": false - } - ], - "args": [ - { - "name": "env_vars", - "description": "Environment variable(s) to set\ne.g.: NODE_ENV=production", - "isOptional": true, - "isVariadic": true, - "generators": envVarGenerator - } - ] - }, - { - "name": [ - "settings" - ], - "description": "Manage settings", - "subcommands": [ - { - "name": [ - "add" - ], - "description": "Adds a setting to the configuration file", - "args": [ - { - "name": "setting", - "description": "The setting to set", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise settings --keys`) - }, - { - "name": "value", - "description": "The value to set", - "isOptional": false, - "isVariadic": false - } - ] + "name": [ + "implode" + ], + "description": "Removes mise CLI and all related data", + "options": [ + { + "name": [ + "--config" + ], + "description": "Also remove config directory", + "isRepeatable": false + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "List directories that would be removed without actually removing them", + "isRepeatable": false + } + ] }, { - "name": [ - "get" - ], - "description": "Show a current setting", - "args": [ - { - "name": "setting", - "description": "The setting to show", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise settings --keys`) - } - ] + "name": [ + "install", + "i" + ], + "description": "Install a tool version", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Force reinstall even if already installed", + "isRepeatable": false + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show installation output", + "isRepeatable": true + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to install e.g.: node@20", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] }, { - "name": [ - "ls", - "list" - ], - "description": "Show current settings", - "options": [ - { - "name": [ - "--keys" - ], - "description": "Only display key names for each setting", - "isRepeatable": false - } - ] + "name": [ + "latest" + ], + "description": "Gets the latest available version for a plugin", + "options": [ + { + "name": [ + "-i", + "--installed" + ], + "description": "Show latest installed instead of available version", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool to get the latest version of", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + ] }, { - "name": [ - "set", - "create" - ], - "description": "Add/update a setting", - "args": [ - { - "name": "setting", - "description": "The setting to set", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise settings --keys`) - }, - { - "name": "value", - "description": "The value to set", - "isOptional": false, - "isVariadic": false - } - ] + "name": [ + "link", + "ln" + ], + "description": "Symlinks a tool version into mise", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Overwrite an existing tool version if it exists", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool name and version to create a symlink for", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + }, + { + "name": "path", + "description": "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + ] }, { - "name": [ - "unset", - "rm", - "remove", - "delete", - "del" - ], - "description": "Clears a setting", - "args": [ - { - "name": "setting", - "description": "The setting to remove", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise settings --keys`) - } - ] - } - ], - "options": [ - { - "name": [ - "--keys" - ], - "description": "Only display key names for each setting", - "isRepeatable": false - } - ] - }, - { - "name": [ - "shell", - "sh" - ], - "description": "Sets a tool version for the current session.", - "options": [ - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } + "name": [ + "ls", + "list" + ], + "description": "List installed and active tool versions", + "options": [ + { + "name": [ + "-c", + "--current" + ], + "description": "Only show tool versions currently specified in a mise.toml", + "isRepeatable": false + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Only show tool versions currently specified in the global mise.toml", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--installed" + ], + "description": "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", + "isRepeatable": false + }, + { + "name": [ + "-o", + "--offline" + ], + "description": "Don't fetch information such as outdated versions", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "-m", + "--missing" + ], + "description": "Display missing tool versions", + "isRepeatable": false + }, + { + "name": [ + "--prefix" + ], + "description": "Display versions matching this prefix", + "isRepeatable": false, + "args": { + "name": "prefix", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) + } + }, + { + "name": [ + "--no-header" + ], + "description": "Don't display headers", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Only show tool versions from [PLUGIN]", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] }, { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false + "name": [ + "ls-remote" + ], + "description": "List runtime versions available for install.", + "options": [ + { + "name": [ + "--all" + ], + "description": "Show all installed plugins and versions", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Plugin to get versions for", + "isOptional": true, + "isVariadic": false, + "generators": toolVersionGenerator + }, + { + "name": "prefix", + "description": "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\"", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) + } + ] }, { - "name": [ - "-u", - "--unset" - ], - "description": "Removes a previously set version", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to use", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - ] - }, - { - "name": [ - "sync" - ], - "description": "Add tool versions from external tools to mise", - "subcommands": [ - { - "name": [ - "node" - ], - "description": "Symlinks all tool versions from an external tool into mise", - "options": [ - { - "name": [ - "--brew" - ], - "description": "Get tool versions from Homebrew", - "isRepeatable": false - }, - { - "name": [ - "--nvm" - ], - "description": "Get tool versions from nvm", - "isRepeatable": false - }, - { - "name": [ - "--nodenv" - ], - "description": "Get tool versions from nodenv", - "isRepeatable": false - } - ] + "name": [ + "outdated" + ], + "description": "Shows outdated tool versions", + "options": [ + { + "name": [ + "-l", + "--bump" + ], + "description": "Compares against the latest versions available, not what matches the current config", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "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", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] }, { - "name": [ - "python" - ], - "description": "Symlinks all tool versions from an external tool into mise", - "options": [ - { - "name": [ - "--pyenv" - ], - "description": "Get tool versions from pyenv", - "isRepeatable": false - } - ] - } - ] - }, - { - "name": [ - "tasks", - "t" - ], - "description": "Manage tasks", - "subcommands": [ - { - "name": [ - "deps" - ], - "description": "Display a tree visualization of a dependency graph", - "options": [ - { - "name": [ - "--hidden" - ], - "description": "Show hidden tasks", - "isRepeatable": false - }, - { - "name": [ - "--dot" - ], - "description": "Display dependencies in DOT format", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tasks", - "description": "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", - "isOptional": true, - "isVariadic": true - } - ] + "name": [ + "plugins", + "p" + ], + "description": "Manage plugins", + "subcommands": [ + { + "name": [ + "install", + "i", + "a", + "add" + ], + "description": "Install a plugin", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Reinstall even if plugin exists", + "isRepeatable": false + }, + { + "name": [ + "-a", + "--all" + ], + "description": "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show installation output", + "isRepeatable": true + } + ], + "args": [ + { + "name": "new_plugin", + "description": "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise plugins --all`) + }, + { + "name": "git_url", + "description": "The git url of the plugin", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "link", + "ln" + ], + "description": "Symlinks a plugin into mise", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Overwrite existing plugin", + "isRepeatable": false + } + ], + "args": [ + { + "name": "name", + "description": "The name of the plugin\ne.g.: node, ruby", + "isOptional": false, + "isVariadic": false + }, + { + "name": "path", + "description": "The local path to the plugin\ne.g.: ./mise-node", + "isOptional": true, + "isVariadic": false, + "template": "filepaths" + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List installed plugins", + "options": [ + { + "name": [ + "-c", + "--core" + ], + "description": "The built-in plugins only\nNormally these are not shown", + "isRepeatable": false + }, + { + "name": [ + "--user" + ], + "description": "List installed plugins", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + "isRepeatable": false + } + ] + }, + { + "name": [ + "ls-remote", + "list-remote", + "list-all" + ], + "description": "List all available remote plugins", + "options": [ + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", + "isRepeatable": false + }, + { + "name": [ + "--only-names" + ], + "description": "Only show the name of each plugin by default it will show a \"*\" next to installed plugins", + "isRepeatable": false + } + ] + }, + { + "name": [ + "uninstall", + "remove", + "rm" + ], + "description": "Removes a plugin", + "options": [ + { + "name": [ + "-p", + "--purge" + ], + "description": "Also remove the plugin's installs, downloads, and cache", + "isRepeatable": false + }, + { + "name": [ + "-a", + "--all" + ], + "description": "Remove all plugins", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to remove", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "update", + "up", + "upgrade" + ], + "description": "Updates a plugin to the latest version", + "options": [ + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\nDefault: 4", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to update", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + } + ], + "options": [ + { + "name": [ + "-c", + "--core" + ], + "description": "The built-in plugins only\nNormally these are not shown", + "isRepeatable": false + }, + { + "name": [ + "--user" + ], + "description": "List installed plugins", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + "isRepeatable": false + } + ] }, { - "name": [ - "edit" - ], - "description": "Edit a tasks with $EDITOR", - "options": [ - { - "name": [ - "-p", - "--path" - ], - "description": "Display the path to the tasks instead of editing it", - "isRepeatable": false - } - ], - "args": [ - { - "name": "task", - "description": "Tasks to edit", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) - } - ] + "name": [ + "prune" + ], + "description": "Delete unused versions of tools", + "options": [ + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Do not actually delete anything", + "isRepeatable": false + }, + { + "name": [ + "--configs" + ], + "description": "Prune only tracked and trusted configuration links that point to non-existent configurations", + "isRepeatable": false + }, + { + "name": [ + "--tools" + ], + "description": "Prune only unused versions of tools", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Prune only versions from this plugin(s)", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] }, { - "name": [ - "info" - ], - "description": "Get information about a task", - "options": [ - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ], - "args": [ - { - "name": "task", - "description": "Name of the task to get information about", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) - } - ] + "name": [ + "registry" + ], + "description": "List available tools to install", + "args": [ + { + "name": "name", + "description": "Show only the specified tool's full name", + "isOptional": true, + "isVariadic": false + } + ] }, { - "name": [ - "ls" - ], - "description": "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.", - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-x", - "--extended" - ], - "description": "Show all columns", - "isRepeatable": false - }, - { - "name": [ - "--hidden" - ], - "description": "Show hidden tasks", - "isRepeatable": false - }, - { - "name": [ - "--sort" - ], - "description": "Sort by column. Default is name.", - "isRepeatable": false, - "args": { - "name": "column", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "name", - "alias", - "description", - "source" - ] - } - }, - { - "name": [ - "--sort-order" - ], - "description": "Sort order. Default is asc.", - "isRepeatable": false, - "args": { - "name": "sort_order", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "asc", - "desc" - ] - } - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] + "name": [ + "reshim" + ], + "description": "Creates new shims based on bin paths from currently installed tools.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Removes all shims before reshimming", + "isRepeatable": false + } + ] }, { - "name": [ - "run", - "r" - ], - "description": "Run task(s)", - "options": [ - { - "name": [ - "-C", - "--cd" - ], - "description": "Change to this directory before executing the command", - "isRepeatable": false, - "args": { - "name": "cd", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Don't actually run the tasks(s), just print them in order of execution", - "isRepeatable": false - }, - { - "name": [ - "-f", - "--force" - ], - "description": "Force the tasks to run even if outputs are up to date", - "isRepeatable": false - }, - { - "name": [ - "-p", - "--prefix" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--interleave" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-t", - "--tool" - ], - "description": "Tool(s) to also add e.g.: node@20 python@3.10", - "isRepeatable": true, - "args": { - "name": "tool@version", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-r", - "--raw" - ], - "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - "isRepeatable": false - }, - { - "name": [ - "--timings" - ], - "description": "Shows elapsed time after each task completes", - "isRepeatable": false - } - ], - "args": [ - { - "name": "task", - "description": "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", - "isOptional": true, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) - }, - { - "name": "args", - "description": "Arguments to pass to the tasks. Use \":::\" to separate tasks", - "isOptional": true, - "isVariadic": true - } - ], - "generateSpec": usageGenerateSpec(["mise tasks --usage"]), - "cache": false - } - ], - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false + "name": [ + "run", + "r" + ], + "description": "Run task(s)", + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change to this directory before executing the command", + "isRepeatable": false, + "args": { + "name": "cd", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Don't actually run the tasks(s), just print them in order of execution", + "isRepeatable": false + }, + { + "name": [ + "-f", + "--force" + ], + "description": "Force the tasks to run even if outputs are up to date", + "isRepeatable": false + }, + { + "name": [ + "-p", + "--prefix" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interleave" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Tool(s) to also add e.g.: node@20 python@3.10", + "isRepeatable": true, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--raw" + ], + "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + "isRepeatable": false + }, + { + "name": [ + "--timings" + ], + "description": "Shows elapsed time after each task completes", + "isRepeatable": false + } + ], + "generateSpec": usageGenerateSpec(["mise tasks --usage"]), + "cache": false + }, + { + "name": [ + "self-update" + ], + "description": "Updates mise itself.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Update even if already up to date", + "isRepeatable": false + }, + { + "name": [ + "--no-plugins" + ], + "description": "Disable auto-updating plugins", + "isRepeatable": false + }, + { + "name": [ + "-y", + "--yes" + ], + "description": "Skip confirmation prompt", + "isRepeatable": false + } + ], + "args": [ + { + "name": "version", + "description": "Update to a specific version", + "isOptional": true, + "isVariadic": false + } + ] }, { - "name": [ - "-x", - "--extended" - ], - "description": "Show all columns", - "isRepeatable": false + "name": [ + "set" + ], + "description": "Set environment variables in mise.toml", + "options": [ + { + "name": [ + "--file" + ], + "description": "The TOML file to update", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Set the environment variable in the global config file", + "isRepeatable": false + } + ], + "args": [ + { + "name": "env_vars", + "description": "Environment variable(s) to set\ne.g.: NODE_ENV=production", + "isOptional": true, + "isVariadic": true, + "generators": envVarGenerator + } + ] }, { - "name": [ - "--hidden" - ], - "description": "Show hidden tasks", - "isRepeatable": false + "name": [ + "settings" + ], + "description": "Manage settings", + "subcommands": [ + { + "name": [ + "add" + ], + "description": "Adds a setting to the configuration file", + "args": [ + { + "name": "setting", + "description": "The setting to set", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + }, + { + "name": "value", + "description": "The value to set", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "get" + ], + "description": "Show a current setting", + "args": [ + { + "name": "setting", + "description": "The setting to show", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "Show current settings", + "options": [ + { + "name": [ + "--keys" + ], + "description": "Only display key names for each setting", + "isRepeatable": false + } + ] + }, + { + "name": [ + "set", + "create" + ], + "description": "Add/update a setting", + "args": [ + { + "name": "setting", + "description": "The setting to set", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + }, + { + "name": "value", + "description": "The value to set", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "unset", + "rm", + "remove", + "delete", + "del" + ], + "description": "Clears a setting", + "args": [ + { + "name": "setting", + "description": "The setting to remove", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + } + ] + } + ], + "options": [ + { + "name": [ + "--keys" + ], + "description": "Only display key names for each setting", + "isRepeatable": false + } + ] }, { - "name": [ - "--sort" - ], - "description": "Sort by column. Default is name.", - "isRepeatable": false, - "args": { - "name": "column", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "name", - "alias", - "description", - "source" + "name": [ + "shell", + "sh" + ], + "description": "Sets a tool version for the current session.", + "options": [ + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--unset" + ], + "description": "Removes a previously set version", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to use", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } ] - } }, { - "name": [ - "--sort-order" - ], - "description": "Sort order. Default is asc.", - "isRepeatable": false, - "args": { - "name": "sort_order", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "asc", - "desc" + "name": [ + "sync" + ], + "description": "Add tool versions from external tools to mise", + "subcommands": [ + { + "name": [ + "node" + ], + "description": "Symlinks all tool versions from an external tool into mise", + "options": [ + { + "name": [ + "--brew" + ], + "description": "Get tool versions from Homebrew", + "isRepeatable": false + }, + { + "name": [ + "--nvm" + ], + "description": "Get tool versions from nvm", + "isRepeatable": false + }, + { + "name": [ + "--nodenv" + ], + "description": "Get tool versions from nodenv", + "isRepeatable": false + } + ] + }, + { + "name": [ + "python" + ], + "description": "Symlinks all tool versions from an external tool into mise", + "options": [ + { + "name": [ + "--pyenv" + ], + "description": "Get tool versions from pyenv", + "isRepeatable": false + } + ] + } ] - } }, { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "trust" - ], - "description": "Marks a config file as trusted", - "options": [ - { - "name": [ - "-a", - "--all" - ], - "description": "Trust all config files in the current directory and its parents", - "isRepeatable": false + "name": [ + "tasks", + "t" + ], + "description": "Manage tasks", + "subcommands": [ + { + "name": [ + "deps" + ], + "description": "Display a tree visualization of a dependency graph", + "options": [ + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--dot" + ], + "description": "Display dependencies in DOT format", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tasks", + "description": "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "edit" + ], + "description": "Edit a tasks with $EDITOR", + "options": [ + { + "name": [ + "-p", + "--path" + ], + "description": "Display the path to the tasks instead of editing it", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Tasks to edit", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + ] + }, + { + "name": [ + "info" + ], + "description": "Get information about a task", + "options": [ + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Name of the task to get information about", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + ] + }, + { + "name": [ + "ls" + ], + "description": "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.", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-x", + "--extended" + ], + "description": "Show all columns", + "isRepeatable": false + }, + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--sort" + ], + "description": "Sort by column. Default is name.", + "isRepeatable": false, + "args": { + "name": "column", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "name", + "alias", + "description", + "source" + ] + } + }, + { + "name": [ + "--sort-order" + ], + "description": "Sort order. Default is asc.", + "isRepeatable": false, + "args": { + "name": "sort_order", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "asc", + "desc" + ] + } + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "run", + "r" + ], + "description": "Run task(s)", + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change to this directory before executing the command", + "isRepeatable": false, + "args": { + "name": "cd", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Don't actually run the tasks(s), just print them in order of execution", + "isRepeatable": false + }, + { + "name": [ + "-f", + "--force" + ], + "description": "Force the tasks to run even if outputs are up to date", + "isRepeatable": false + }, + { + "name": [ + "-p", + "--prefix" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interleave" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Tool(s) to also add e.g.: node@20 python@3.10", + "isRepeatable": true, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--raw" + ], + "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + "isRepeatable": false + }, + { + "name": [ + "--timings" + ], + "description": "Shows elapsed time after each task completes", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", + "isOptional": true, + "isVariadic": false, + "generators": simpleTaskGenerator + }, + { + "name": "args", + "description": "Arguments to pass to the tasks. Use \":::\" to separate tasks", + "isOptional": true, + "isVariadic": true + } + ], + "generateSpec": usageGenerateSpec(["mise tasks --usage"]), + "cache": false + } + ], + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-x", + "--extended" + ], + "description": "Show all columns", + "isRepeatable": false + }, + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--sort" + ], + "description": "Sort by column. Default is name.", + "isRepeatable": false, + "args": { + "name": "column", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "name", + "alias", + "description", + "source" + ] + } + }, + { + "name": [ + "--sort-order" + ], + "description": "Sort order. Default is asc.", + "isRepeatable": false, + "args": { + "name": "sort_order", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "asc", + "desc" + ] + } + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] }, { - "name": [ - "--untrust" - ], - "description": "No longer trust this config", - "isRepeatable": false + "name": [ + "trust" + ], + "description": "Marks a config file as trusted", + "options": [ + { + "name": [ + "-a", + "--all" + ], + "description": "Trust all config files in the current directory and its parents", + "isRepeatable": false + }, + { + "name": [ + "--untrust" + ], + "description": "No longer trust this config", + "isRepeatable": false + }, + { + "name": [ + "--show" + ], + "description": "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", + "isRepeatable": false + } + ], + "args": [ + { + "name": "config_file", + "description": "The config file to trust", + "isOptional": true, + "isVariadic": false, + "template": "filepaths", + "generators": configPathGenerator + } + ] }, { - "name": [ - "--show" - ], - "description": "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", - "isRepeatable": false - } - ], - "args": [ - { - "name": "config_file", - "description": "The config file to trust", - "isOptional": true, - "isVariadic": false, - "template": "filepaths", - "generators": completionGeneratorTemplate(``) - } - ] - }, - { - "name": [ - "uninstall", - "remove", - "rm" - ], - "description": "Removes installed tool versions", - "options": [ - { - "name": [ - "-a", - "--all" - ], - "description": "Delete all installed versions", - "isRepeatable": false + "name": [ + "uninstall", + "remove", + "rm" + ], + "description": "Removes installed tool versions", + "options": [ + { + "name": [ + "-a", + "--all" + ], + "description": "Delete all installed versions", + "isRepeatable": false + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Do not actually delete anything", + "isRepeatable": false + } + ], + "args": [ + { + "name": "installed_tool@version", + "description": "Tool(s) to remove", + "isOptional": true, + "isVariadic": true, + "generators": installedToolVersionGenerator + } + ] }, { - "name": [ - "-n", - "--dry-run" - ], - "description": "Do not actually delete anything", - "isRepeatable": false - } - ], - "args": [ - { - "name": "installed_tool@version", - "description": "Tool(s) to remove", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - if [ ! -z "$prefix" ]; then - prefix="--prefix $prefix" - fi - versions=$(mise ls --installed $tool $prefix | awk '{print $2}' | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise ls --installed | awk '{print $1}' | sed '1!G;h;$!d') - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - ] - }, - { - "name": [ - "unset" - ], - "description": "Remove environment variable(s) from the config file.", - "options": [ - { - "name": [ - "-f", - "--file" - ], - "description": "Specify a file to use instead of `mise.toml`", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } + "name": [ + "unset" + ], + "description": "Remove environment variable(s) from the config file.", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "Specify a file to use instead of `mise.toml`", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Use the global config file", + "isRepeatable": false + } + ], + "args": [ + { + "name": "keys", + "description": "Environment variable(s) to remove\ne.g.: NODE_ENV", + "isOptional": true, + "isVariadic": true + } + ] }, { - "name": [ - "-g", - "--global" - ], - "description": "Use the global config file", - "isRepeatable": false - } - ], - "args": [ - { - "name": "keys", - "description": "Environment variable(s) to remove\ne.g.: NODE_ENV", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "upgrade", - "up" - ], - "description": "Upgrades outdated tools", - "options": [ - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Just print what would be done, don't actually do it", - "isRepeatable": false + "name": [ + "upgrade", + "up" + ], + "description": "Upgrades outdated tools", + "options": [ + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Just print what would be done, don't actually do it", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interactive" + ], + "description": "Display multiselect menu to choose which tools to upgrade", + "isRepeatable": false + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-l", + "--bump" + ], + "description": "Upgrades to the latest version available, bumping the version in mise.toml", + "isRepeatable": false + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] }, { - "name": [ - "-i", - "--interactive" - ], - "description": "Display multiselect menu to choose which tools to upgrade", - "isRepeatable": false + "name": [ + "use", + "u" + ], + "description": "Installs a tool and adds the version it to mise.toml.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Force reinstall even if already installed", + "isRepeatable": false + }, + { + "name": [ + "--fuzzy" + ], + "description": "Save fuzzy version to config file", + "isRepeatable": false + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", + "isRepeatable": false + }, + { + "name": [ + "-e", + "--env" + ], + "description": "Modify an environment-specific config file like .mise..toml", + "isRepeatable": false, + "args": { + "name": "env", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", + "isRepeatable": false + }, + { + "name": [ + "--remove" + ], + "description": "Remove the plugin(s) from config file", + "isRepeatable": true, + "args": { + "name": "plugin", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + } + }, + { + "name": [ + "-p", + "--path" + ], + "description": "Specify a path to a config file or directory", + "isRepeatable": false, + "args": { + "name": "path", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "--pin" + ], + "description": "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to add to config file", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] }, { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } + "name": [ + "version", + "v" + ], + "description": "Display the version of mise" + }, + { + "name": [ + "watch", + "w" + ], + "description": "Run task(s) and watch for changes to rerun it", + "options": [ + { + "name": [ + "-t", + "--task" + ], + "description": "Tasks to run", + "isRepeatable": true, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + }, + { + "name": [ + "-g", + "--glob" + ], + "description": "Files to watch\nDefaults to sources from the tasks(s)", + "isRepeatable": true, + "args": { + "name": "glob", + "isOptional": false, + "isVariadic": false + } + } + ], + "args": [ + { + "name": "args", + "description": "Extra arguments", + "isOptional": true, + "isVariadic": true + } + ] }, { - "name": [ - "-l", - "--bump" - ], - "description": "Upgrades to the latest version available, bumping the version in mise.toml", - "isRepeatable": false + "name": [ + "where" + ], + "description": "Display the installation path for a tool", + "args": [ + { + "name": "tool@version", + "description": "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", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + ] }, { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) + "name": [ + "which" + ], + "description": "Shows the path that a tool's bin points to.", + "options": [ + { + "name": [ + "--plugin" + ], + "description": "Show the plugin name instead of the path", + "isRepeatable": false + }, + { + "name": [ + "--version" + ], + "description": "Show the version instead of the path", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", + "isRepeatable": false, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + } + ], + "args": [ + { + "name": "bin_name", + "description": "The bin to look up", + "isOptional": false, + "isVariadic": false + } + ] } - ] - }, - { - "name": [ - "use", - "u" - ], - "description": "Installs a tool and adds the version it to mise.toml.", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Force reinstall even if already installed", - "isRepeatable": false - }, - { - "name": [ - "--fuzzy" - ], - "description": "Save fuzzy version to config file", - "isRepeatable": false - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", - "isRepeatable": false - }, - { - "name": [ - "-e", - "--env" - ], - "description": "Modify an environment-specific config file like .mise..toml", - "isRepeatable": false, - "args": { - "name": "env", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", - "isRepeatable": false - }, - { - "name": [ - "--remove" - ], - "description": "Remove the plugin(s) from config file", - "isRepeatable": true, - "args": { - "name": "plugin", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise plugins --core --user`) - } - }, + ], + "options": [ { - "name": [ - "-p", - "--path" - ], - "description": "Specify a path to a config file or directory", - "isRepeatable": false, - "args": { - "name": "path", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } + "name": [ + "-C", + "--cd" + ], + "description": "Change directory before running command", + "isRepeatable": false, + "args": { + "name": "dir", + "isOptional": false, + "isVariadic": false, + "template": "folders" + } }, { - "name": [ - "--pin" - ], - "description": "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to add to config file", - "isOptional": true, - "isVariadic": true, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - ] - }, - { - "name": [ - "version", - "v" - ], - "description": "Display the version of mise" - }, - { - "name": [ - "watch", - "w" - ], - "description": "Run task(s) and watch for changes to rerun it", - "options": [ - { - "name": [ - "-t", - "--task" - ], - "description": "Tasks to run", - "isRepeatable": true, - "args": { - "name": "task", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise tasks | awk '{print $1}'`) - } + "name": [ + "-P", + "--profile" + ], + "description": "Set the profile (environment)", + "isRepeatable": false, + "args": { + "name": "profile", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } }, { - "name": [ - "-g", - "--glob" - ], - "description": "Files to watch\nDefaults to sources from the tasks(s)", - "isRepeatable": true, - "args": { - "name": "glob", - "isOptional": false, - "isVariadic": false - } - } - ], - "args": [ - { - "name": "args", - "description": "Extra arguments", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "where" - ], - "description": "Display the installation path for a tool", - "args": [ - { - "name": "tool@version", - "description": "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", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - ] - }, - { - "name": [ - "which" - ], - "description": "Shows the path that a tool's bin points to.", - "options": [ - { - "name": [ - "--plugin" - ], - "description": "Show the plugin name instead of the path", - "isRepeatable": false + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress non-error messages", + "isRepeatable": false }, { - "name": [ - "--version" - ], - "description": "Show the version instead of the path", - "isRepeatable": false + "name": [ + "-v", + "--verbose" + ], + "description": "Show extra output (use -vv for even more)", + "isRepeatable": true }, { - "name": [ - "-t", - "--tool" - ], - "description": "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", - "isRepeatable": false, - "args": { - "name": "tool@version", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`) - } - } - ], - "args": [ - { - "name": "bin_name", - "description": "The bin to look up", - "isOptional": false, - "isVariadic": false + "name": [ + "-y", + "--yes" + ], + "description": "Answer yes to all confirmation prompts", + "isRepeatable": false } - ] - } - ], - "options": [ - { - "name": [ - "-C", - "--cd" - ], - "description": "Change directory before running command", - "isRepeatable": false, - "args": { - "name": "dir", - "isOptional": false, - "isVariadic": false, - "template": "folders" - } - }, - { - "name": [ - "-P", - "--profile" - ], - "description": "Set the profile (environment)", - "isRepeatable": false, - "args": { - "name": "profile", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-q", - "--quiet" - ], - "description": "Suppress non-error messages", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show extra output (use -vv for even more)", - "isRepeatable": true - }, - { - "name": [ - "-y", - "--yes" - ], - "description": "Answer yes to all confirmation prompts", - "isRepeatable": false - } - ] -} - + ] +}; export default completionSpec; From 3bc53914ff73fb62bdb0b76449a9bc0cc9e1fcdf Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Sun, 10 Nov 2024 20:04:17 +0000 Subject: [PATCH 04/14] Fix task --- .mise.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mise.toml b/.mise.toml index 8378a7e996..955c7c40e9 100644 --- a/.mise.toml +++ b/.mise.toml @@ -85,7 +85,7 @@ run = "mise render-mangen" [tasks."render:fig"] depends = ["build", "render:usage"] run = [ - "usage generate fig --file mise.usage.kdl --out-file tasks/fig/src/mise.ts", + 'mise x usage "usage generate fig --file mise.usage.kdl --out-file tasks/fig/src/mise.ts"', "tsx tasks/fig/addCustomGenerators.ts tasks/fig/src/mise.ts tasks/fig/src/mise.ts" ] From 10bfa367031779e39950a9227a2ea6487115dea3 Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Sun, 10 Nov 2024 20:07:58 +0000 Subject: [PATCH 05/14] Make task depend on completions or it will run in parallel --- .mise.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.mise.toml b/.mise.toml index 955c7c40e9..fb56a94f9c 100644 --- a/.mise.toml +++ b/.mise.toml @@ -83,9 +83,9 @@ env = { NO_COLOR = "1" } run = "mise render-mangen" [tasks."render:fig"] -depends = ["build", "render:usage"] +depends = ["build", "render:usage", "render:completions"] run = [ - 'mise x usage "usage generate fig --file mise.usage.kdl --out-file tasks/fig/src/mise.ts"', + 'usage generate fig --file mise.usage.kdl --out-file tasks/fig/src/mise.ts', "tsx tasks/fig/addCustomGenerators.ts tasks/fig/src/mise.ts tasks/fig/src/mise.ts" ] From 3fe7b73f82913774213717d8e80ac6d8d94c7cd1 Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Sun, 10 Nov 2024 20:11:12 +0000 Subject: [PATCH 06/14] Remove hardcoded input path, oops --- tasks/fig/addCustomGenerators.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/fig/addCustomGenerators.ts b/tasks/fig/addCustomGenerators.ts index 82932122b6..e51eb99144 100644 --- a/tasks/fig/addCustomGenerators.ts +++ b/tasks/fig/addCustomGenerators.ts @@ -96,7 +96,7 @@ function transformer(context: ts.TransformationContext) { const main = async (fileName: string, outFile?: string) => { try { - const generatorFileContents = (await fsAsync.readFile('./tasks/fig/generators.ts')).toString(); + const generatorFileContents = (await fsAsync.readFile(fileName)).toString(); const contents = (await fsAsync.readFile(fileName)).toString(); const sourceFile = ts.createSourceFile( "example.ts", From 01e4ff6f754812704f701e871e0ccb99e69a6c2c Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Sun, 10 Nov 2024 20:14:55 +0000 Subject: [PATCH 07/14] Lint fix --- .github/workflows/release-fig.yml | 10 +- tasks/fig/addCustomGenerators.ts | 116 +- tasks/fig/generators.ts | 402 +++-- tasks/fig/src/mise.ts | 2812 ----------------------------- tsconfig.json | 14 +- 5 files changed, 305 insertions(+), 3049 deletions(-) delete mode 100644 tasks/fig/src/mise.ts diff --git a/.github/workflows/release-fig.yml b/.github/workflows/release-fig.yml index d7fbf78b5f..95c6f292a6 100644 --- a/.github/workflows/release-fig.yml +++ b/.github/workflows/release-fig.yml @@ -1,11 +1,11 @@ -name: 'Publish mise completions version' +name: "Publish mise completions version" on: push: - tags: - - 'v*' ## Only run the action on new versions, this prevents useless runs of the action + tags: + - "v*" ## Only run the action on new versions, this prevents useless runs of the action jobs: - push-to-fig-autocomplete: + push-to-fig-autocomplete: ## if github.repository == 'jdx/mise' runs-on: ubuntu-latest steps: @@ -34,4 +34,4 @@ jobs: token: ${{ secrets.MY_RELEASE_PLEASE_TOKEN }} autocomplete-spec-name: mise spec-path: tasks/fig/src/mise.ts - pr-body: "Automated PR for latest mise release by https://github.com/jdx/mise" \ No newline at end of file + pr-body: "Automated PR for latest mise release by https://github.com/jdx/mise" diff --git a/tasks/fig/addCustomGenerators.ts b/tasks/fig/addCustomGenerators.ts index e51eb99144..f3186831cc 100644 --- a/tasks/fig/addCustomGenerators.ts +++ b/tasks/fig/addCustomGenerators.ts @@ -1,54 +1,53 @@ -import fsAsync = require('node:fs/promises'); +import fsAsync = require("node:fs/promises"); import * as ts from "typescript"; type GeneratorIdentifier = { - identifier: string - generator_name: string -} + identifier: string; + generator_name: string; +}; const customGenerators: GeneratorIdentifier[] = [ { - identifier: 'alias', - generator_name: 'aliasGenerator' + identifier: "alias", + generator_name: "aliasGenerator", }, { - identifier: 'plugin', - generator_name: 'pluginGenerator' + identifier: "plugin", + generator_name: "pluginGenerator", }, { - identifier: 'all_plugins', - generator_name: 'allPluginsGenerator' + identifier: "all_plugins", + generator_name: "allPluginsGenerator", }, { - identifier: 'task', - generator_name: 'simpleTaskGenerator' + identifier: "task", + generator_name: "simpleTaskGenerator", }, { - identifier: 'tasks', - generator_name: 'simpleTaskGenerator' + identifier: "tasks", + generator_name: "simpleTaskGenerator", }, { - identifier: 'setting', - generator_name: 'settingsGenerator' + identifier: "setting", + generator_name: "settingsGenerator", }, { - identifier: 'tool@version', - generator_name: 'toolVersionGenerator' + identifier: "tool@version", + generator_name: "toolVersionGenerator", }, { - identifier: 'installed_tool@version', - generator_name: 'installedToolVersionGenerator' + identifier: "installed_tool@version", + generator_name: "installedToolVersionGenerator", }, - { - identifier: 'config_file', - generator_name: 'configPathGenerator' + { + identifier: "config_file", + generator_name: "configPathGenerator", }, { - identifier: 'env_vars', - generator_name: 'envVarGenerator' - } - -] + identifier: "env_vars", + generator_name: "envVarGenerator", + }, +]; const get_identifier = (node: ts.Node): ts.Identifier | undefined => { let name = ""; @@ -57,35 +56,35 @@ const get_identifier = (node: ts.Node): ts.Identifier | undefined => { const properties = objectLiteralExpr.properties; properties.forEach((p) => { if (ts.isPropertyAssignment(p) && p.name.getText() == '"name"') { - const value = p.getChildAt(2) - name = value.getText().replaceAll('"', ''); + const value = p.getChildAt(2); + name = value.getText().replaceAll('"', ""); } - }) + }); - const custom = customGenerators.filter((g) => { - if (name === g.identifier) { - return true; - // - } - }).map(g => ts.factory.createIdentifier(g.generator_name)) + const custom = customGenerators + .filter((g) => { + if (name === g.identifier) { + return true; + // + } + }) + .map((g) => ts.factory.createIdentifier(g.generator_name)); - if (custom.length > 0) return custom[0] - return; -} + if (custom.length > 0) return custom[0]; + return; +}; function transformer(context: ts.TransformationContext) { return (rootNode: T) => { function visit(node: ts.Node): ts.Node { - if (ts.isPropertyAssignment(node) - && node.name.getText() === '"generators"') { - const id = get_identifier(node.parent) - if (id) { - return ts.factory.updatePropertyAssignment( - node, - node.name, - id - ) - } + if ( + ts.isPropertyAssignment(node) && + node.name.getText() === '"generators"' + ) { + const id = get_identifier(node.parent); + if (id) { + return ts.factory.updatePropertyAssignment(node, node.name, id); + } } return ts.visitEachChild(node, visit, context); } @@ -93,7 +92,6 @@ function transformer(context: ts.TransformationContext) { }; } - const main = async (fileName: string, outFile?: string) => { try { const generatorFileContents = (await fsAsync.readFile(fileName)).toString(); @@ -102,25 +100,25 @@ const main = async (fileName: string, outFile?: string) => { "example.ts", contents, ts.ScriptTarget.Latest, - true + true, ); const result = ts.transform(sourceFile, [transformer]); const transformedSourceFile = result.transformed[0]; - //traverse(sourceFile, sourceFile); const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); const output = printer.printNode( ts.EmitHint.Unspecified, transformedSourceFile, - sourceFile + sourceFile, ); - fsAsync.writeFile(outFile ?? `${fileName.replace('.ts', '')}.out.ts`, generatorFileContents + '\n' +output) - + fsAsync.writeFile( + outFile ?? `${fileName.replace(".ts", "")}.out.ts`, + generatorFileContents + "\n" + output, + ); } catch (e) { console.error(e); } - -} +}; -main(process.argv[2], process.argv[3]); \ No newline at end of file +main(process.argv[2], process.argv[3]); diff --git a/tasks/fig/generators.ts b/tasks/fig/generators.ts index 7560502085..3921597857 100644 --- a/tasks/fig/generators.ts +++ b/tasks/fig/generators.ts @@ -1,220 +1,288 @@ // If not being published, these need to manually downloaded from https://github.com/withfig/autocomplete/tree/master/src -import { createNpmSearchHandler } from "./npm" -import { searchGenerator as createCargoSearchGenerator } from "./cargo" +import { createNpmSearchHandler } from "./npm"; +import { searchGenerator as createCargoSearchGenerator } from "./cargo"; const envVarGenerator = { - script: ['sh', '-c', 'env'], + script: ["sh", "-c", "env"], postProcess: (output: string) => { - return output.split('\n').map(l => ({name: l.split('=')[0]})) - } -} + return output.split("\n").map((l) => ({ name: l.split("=")[0] })); + }, +}; const singleCmdNewLineGenerator = (completion_cmd: string): Fig.Generator => ({ - script: completion_cmd.split(' '), - splitOn: '\n' -}) + script: completion_cmd.split(" "), + splitOn: "\n", +}); const singleCmdJsonGenerator = (cmd: string): Fig.Generator => ({ - script: cmd.split(' '), - postProcess: (out) => (JSON.parse(out).map((r: any) => ({name: r.name, description: r.description}))) -}) + script: cmd.split(" "), + postProcess: (out) => + JSON.parse(out).map((r: any) => ({ + name: r.name, + description: r.description, + })), +}); const contextualGeneratorLastWord = (cmd: string): Fig.Generator => ({ script: (context) => { if (context.length < 2) { - return [] + return []; } - - const prev = context[context.length - 2] // -1 is the current word - return ['sh', '-c', [cmd, prev].join(' ')] - } -}) + + const prev = context[context.length - 2]; // -1 is the current word + return ["sh", "-c", [cmd, prev].join(" ")]; + }, +}); const aliasGenerator: Fig.Generator = { - ...contextualGeneratorLastWord('mise alias ls'), + ...contextualGeneratorLastWord("mise alias ls"), postProcess: (out) => { //return [{name: out}] //return out.split('\t').map(l => ({name: l})) //return [{name: "test", "description": out}] - const tokens = out.split(/\s+/) - if (tokens.length == 0) - return [] + const tokens = out.split(/\s+/); + if (tokens.length == 0) return []; - return tokens.flatMap((_, i) => { - if ((i % 3) == 0) { - return [tokens[i+1]] - } - return [] - }).filter(l => l.trim().length > 0).map(l => ({name: l.trim()})) - } -} + return tokens + .flatMap((_, i) => { + if (i % 3 == 0) { + return [tokens[i + 1]]; + } + return []; + }) + .filter((l) => l.trim().length > 0) + .map((l) => ({ name: l.trim() })); + }, +}; const pluginWithAlias: Fig.Generator = { - script: 'mise alias ls'.split(' '), + script: "mise alias ls".split(" "), postProcess: (output: string) => { - const plugins = output.split('\n').map((line) => { - const tokens = line.split(/\s+/) - return tokens[0] - }) - return [... new Set(plugins)].map((p) => ({name: p})) - } -} - -const getInstalledTools = async (executeShellCommand: Fig.ExecuteCommandFunction) => { - const {stdout} = await executeShellCommand({ - command: 'sh', args: ['-c', 'mise ls --installed'] - }) - return [...new Set(stdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return {name: tokens[0], version: tokens[1]} - }))] -} + const plugins = output.split("\n").map((line) => { + const tokens = line.split(/\s+/); + return tokens[0]; + }); + return [...new Set(plugins)].map((p) => ({ name: p })); + }, +}; +const getInstalledTools = async ( + executeShellCommand: Fig.ExecuteCommandFunction, +) => { + const { stdout } = await executeShellCommand({ + command: "sh", + args: ["-c", "mise ls --installed"], + }); + return [ + ...new Set( + stdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[0], version: tokens[1] }; + }), + ), + ]; +}; type ConfigLsOutput = { - path: string - tools: string[] -} + path: string; + tools: string[]; +}; const configPathGenerator: Fig.Generator = { - ...singleCmdJsonGenerator('mise config ls -J'), - postProcess: (out) => JSON.parse(out).map((r: ConfigLsOutput) => ({name: r.path, description: r.path})) -} - + ...singleCmdJsonGenerator("mise config ls -J"), + postProcess: (out) => + JSON.parse(out).map((r: ConfigLsOutput) => ({ + name: r.path, + description: r.path, + })), +}; -type ObjectKeyType = string | symbol | number +type ObjectKeyType = string | symbol | number; type ObjectAcceptableKeyValues = { - [key: string]: ObjectKeyType -} - -function groupBy(array: T[], key: keyof T): Record { - return array.reduce((result, currentItem) => { - (result[currentItem[key] as (ObjectKeyType)] = result[currentItem[key] as (ObjectKeyType)] || []) - .push(currentItem); - return result; - }, {} as Record); + [key: string]: ObjectKeyType; }; -const installedToolsGenerator: Fig.Generator = { - script: ['sh', '-c', 'mise ls --installed'], - postProcess: (stdout: string) => { - return [...new Set(stdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return {name: tokens[0], version: tokens[1]} - }))] - } +function groupBy( + array: T[], + key: keyof T, +): Record { + return array.reduce( + (result, currentItem) => { + (result[currentItem[key] as ObjectKeyType] = + result[currentItem[key] as ObjectKeyType] || []).push(currentItem); + return result; + }, + {} as Record, + ); } +const installedToolsGenerator: Fig.Generator = { + script: ["sh", "-c", "mise ls --installed"], + postProcess: (stdout: string) => { + return [ + ...new Set( + stdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[0], version: tokens[1] }; + }), + ), + ]; + }, +}; -const pluginGenerator: Fig.Generator = installedToolsGenerator -const allPluginsGenerator: Fig.Generator = singleCmdNewLineGenerator('mise plugins --all') -const simpleTaskGenerator = singleCmdJsonGenerator('mise tasks -J') -const settingsGenerator = singleCmdNewLineGenerator(`mise settings --keys`) +const pluginGenerator: Fig.Generator = installedToolsGenerator; +const allPluginsGenerator: Fig.Generator = + singleCmdNewLineGenerator("mise plugins --all"); +const simpleTaskGenerator = singleCmdJsonGenerator("mise tasks -J"); +const settingsGenerator = singleCmdNewLineGenerator(`mise settings --keys`); const atsInStr = (s: string) => (s.match(/@/g) || []).length != 0; const backendSepInStr = (s: string) => (s.match(/:/g) || []).length != 0; -const searchBackend = async (backend: string, context: string[], - executeShellCommand: Fig.ExecuteCommandFunction, - shellContext: Fig.GeneratorContext): Promise => { +const searchBackend = async ( + backend: string, + context: string[], + executeShellCommand: Fig.ExecuteCommandFunction, + shellContext: Fig.GeneratorContext, +): Promise => { const customContext = context; - customContext[context.length - 1] = customContext[context.length - 1].replace(`${backend}:`, '') + customContext[context.length - 1] = customContext[context.length - 1].replace( + `${backend}:`, + "", + ); switch (backend) { - case 'npm': - return (await (createNpmSearchHandler()(context, executeShellCommand, shellContext))) - case 'cargo': + case "npm": + return await createNpmSearchHandler()( + context, + executeShellCommand, + shellContext, + ); + case "cargo": //return [{name: customContext[context.length - 1]}] - return (await (createCargoSearchGenerator.custom(customContext, executeShellCommand, shellContext))) - case 'asdf': + return await createCargoSearchGenerator.custom( + customContext, + executeShellCommand, + shellContext, + ); + case "asdf": const { stdout } = await executeShellCommand({ - command: 'sh', args: ['-c', 'mise registry'] - }) - return [...new Set(stdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return { name: tokens[1].replace(`${backend}:`, '') } - }))] - case 'ubi': + command: "sh", + args: ["-c", "mise registry"], + }); + return [ + ...new Set( + stdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[1].replace(`${backend}:`, "") }; + }), + ), + ]; + case "ubi": const { stdout: ubiOut } = await executeShellCommand({ - command: 'sh', args: ['-c', 'mise registry'] - }) - return [...new Set(ubiOut.split('\n').flatMap(l => { - const tokens = l.split(/\s+/) - if (!tokens[1].includes('ubi:')) return [] - return [{ name: tokens[1].replace('ubi:', '') }] as Fig.Suggestion - }))] + command: "sh", + args: ["-c", "mise registry"], + }); + return [ + ...new Set( + ubiOut.split("\n").flatMap((l) => { + const tokens = l.split(/\s+/); + if (!tokens[1].includes("ubi:")) return []; + return [{ name: tokens[1].replace("ubi:", "") }] as Fig.Suggestion; + }), + ), + ]; default: - return [] + return []; } -} +}; -const compareVersions = (a: string, b: string ): number => { - const result = [a,b].sort() // Unless we can add semversort - if (result[0] != a) return 1 - return -1 -} +const compareVersions = (a: string, b: string): number => { + const result = [a, b].sort(); // Unless we can add semversort + if (result[0] != a) return 1; + return -1; +}; const toolVersionGenerator: Fig.Generator = { trigger: (newToken: string, oldToken: string): boolean => { - return (backendSepInStr(newToken) && !backendSepInStr(oldToken)) || + return ( + (backendSepInStr(newToken) && !backendSepInStr(oldToken)) || (atsInStr(newToken) && !atsInStr(oldToken)) + ); }, - getQueryTerm: '@', + getQueryTerm: "@", - custom: async (context: string[], + custom: async ( + context: string[], executeShellCommand: Fig.ExecuteCommandFunction, - shellContext: Fig.GeneratorContext) => { - - const currentWord = context[context.length - 1] + shellContext: Fig.GeneratorContext, + ) => { + const currentWord = context[context.length - 1]; if (backendSepInStr(currentWord)) { // Let's handle backends - const backend = currentWord.slice(0, currentWord.lastIndexOf(':')) - - return (await searchBackend(backend, context, executeShellCommand, shellContext)) - .map(s => ({...s, name: `${backend}:${s.name}`, displayName: s.name, icon: '📦'})) - + const backend = currentWord.slice(0, currentWord.lastIndexOf(":")); + + return ( + await searchBackend(backend, context, executeShellCommand, shellContext) + ).map((s) => ({ + ...s, + name: `${backend}:${s.name}`, + displayName: s.name, + icon: "📦", + })); } else if (atsInStr(currentWord)) { - const tool = currentWord.slice(0, currentWord.lastIndexOf('@')) + const tool = currentWord.slice(0, currentWord.lastIndexOf("@")); const { stdout } = await executeShellCommand({ - command: 'sh', args: ['-c', `mise ls-remote ${tool}`] - }) - const remote_versions_suggestions = stdout.split('\n').sort((a,b) => compareVersions(b,a)).map(l => ({name: l})) + command: "sh", + args: ["-c", `mise ls-remote ${tool}`], + }); + const remote_versions_suggestions = stdout + .split("\n") + .sort((a, b) => compareVersions(b, a)) + .map((l) => ({ name: l })); const { stdout: aliasStdout } = await executeShellCommand({ - command: 'sh', args: ['-c', `mise alias ls ${tool}`] - }) - const aliases_suggestions = aliasStdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return {name: tokens[1]} - }) - return [...aliases_suggestions, ...remote_versions_suggestions] + command: "sh", + args: ["-c", `mise alias ls ${tool}`], + }); + const aliases_suggestions = aliasStdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[1] }; + }); + return [...aliases_suggestions, ...remote_versions_suggestions]; } const { stdout } = await executeShellCommand({ - command: 'sh', args: ['-c', 'mise registry'] - }) - return [...new Set(stdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return { name: tokens[0] } - }))] - } -} - + command: "sh", + args: ["-c", "mise registry"], + }); + return [ + ...new Set( + stdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[0] }; + }), + ), + ]; + }, +}; const installedToolVersionGenerator: Fig.Generator = { - trigger: '@', - getQueryTerm: '@', - custom: async (context: string[], - executeShellCommand: Fig.ExecuteCommandFunction) => { - - const tools = await getInstalledTools(executeShellCommand) - const toolsVersions = groupBy(tools, "name") - - const currentWord = context[context.length - 1] + trigger: "@", + getQueryTerm: "@", + custom: async ( + context: string[], + executeShellCommand: Fig.ExecuteCommandFunction, + ) => { + const tools = await getInstalledTools(executeShellCommand); + const toolsVersions = groupBy(tools, "name"); + + const currentWord = context[context.length - 1]; if (atsInStr(currentWord)) { - const tool = currentWord.slice(0, currentWord.lastIndexOf('@')) + const tool = currentWord.slice(0, currentWord.lastIndexOf("@")); const { stdout: aliasStdout } = await executeShellCommand({ - command: 'sh', args: ['-c', `mise alias ls ${tool}`] - }) + command: "sh", + args: ["-c", `mise alias ls ${tool}`], + }); // This lists all aliases even if they are not installed /* @@ -223,25 +291,27 @@ const installedToolVersionGenerator: Fig.Generator = { return {name: tokens[1], description: tokens[2]} }) as Fig.Suggestion[] */ - - const toolVersions = (toolsVersions[tool] || []) as {name: string, version: string}[] - const suggestions = toolVersions.map(s => ({ - name: s.version - })) as Fig.Suggestion[] - return [...suggestions] + const toolVersions = (toolsVersions[tool] || []) as { + name: string; + version: string; + }[]; + const suggestions = toolVersions.map((s) => ({ + name: s.version, + })) as Fig.Suggestion[]; + + return [...suggestions]; } - - const suggestions: Fig.Suggestion[] = [] + + const suggestions: Fig.Suggestion[] = []; Object.keys(toolsVersions).forEach((k) => { if (toolsVersions[k].length == 1) { - suggestions.push({name: k}) - } - else { - suggestions.push({name: `${k}@`}) + suggestions.push({ name: k }); + } else { + suggestions.push({ name: `${k}@` }); } - }) + }); - return suggestions - } -} \ No newline at end of file + return suggestions; + }, +}; diff --git a/tasks/fig/src/mise.ts b/tasks/fig/src/mise.ts deleted file mode 100644 index b80f778d84..0000000000 --- a/tasks/fig/src/mise.ts +++ /dev/null @@ -1,2812 +0,0 @@ -// If not being published, these need to manually downloaded from https://github.com/withfig/autocomplete/tree/master/src -import { createNpmSearchHandler } from "./npm" -import { searchGenerator as createCargoSearchGenerator } from "./cargo" - -const envVarGenerator = { - script: ['sh', '-c', 'env'], - postProcess: (output: string) => { - return output.split('\n').map(l => ({name: l.split('=')[0]})) - } -} - -const singleCmdNewLineGenerator = (completion_cmd: string): Fig.Generator => ({ - script: completion_cmd.split(' '), - splitOn: '\n' -}) - -const singleCmdJsonGenerator = (cmd: string): Fig.Generator => ({ - script: cmd.split(' '), - postProcess: (out) => (JSON.parse(out).map((r: any) => ({name: r.name, description: r.description}))) -}) - -const contextualGeneratorLastWord = (cmd: string): Fig.Generator => ({ - script: (context) => { - if (context.length < 2) { - return [] - } - - const prev = context[context.length - 2] // -1 is the current word - return ['sh', '-c', [cmd, prev].join(' ')] - } -}) - -const aliasGenerator: Fig.Generator = { - ...contextualGeneratorLastWord('mise alias ls'), - postProcess: (out) => { - //return [{name: out}] - //return out.split('\t').map(l => ({name: l})) - //return [{name: "test", "description": out}] - const tokens = out.split(/\s+/) - if (tokens.length == 0) - return [] - - return tokens.flatMap((_, i) => { - if ((i % 3) == 0) { - return [tokens[i+1]] - } - return [] - }).filter(l => l.trim().length > 0).map(l => ({name: l.trim()})) - } -} - -const pluginWithAlias: Fig.Generator = { - script: 'mise alias ls'.split(' '), - postProcess: (output: string) => { - const plugins = output.split('\n').map((line) => { - const tokens = line.split(/\s+/) - return tokens[0] - }) - return [... new Set(plugins)].map((p) => ({name: p})) - } -} - -const getInstalledTools = async (executeShellCommand: Fig.ExecuteCommandFunction) => { - const {stdout} = await executeShellCommand({ - command: 'sh', args: ['-c', 'mise ls --installed'] - }) - return [...new Set(stdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return {name: tokens[0], version: tokens[1]} - }))] -} - - -type ConfigLsOutput = { - path: string - tools: string[] -} - -const configPathGenerator: Fig.Generator = { - ...singleCmdJsonGenerator('mise config ls -J'), - postProcess: (out) => JSON.parse(out).map((r: ConfigLsOutput) => ({name: r.path, description: r.path})) -} - - -type ObjectKeyType = string | symbol | number -type ObjectAcceptableKeyValues = { - [key: string]: ObjectKeyType -} - -function groupBy(array: T[], key: keyof T): Record { - return array.reduce((result, currentItem) => { - (result[currentItem[key] as (ObjectKeyType)] = result[currentItem[key] as (ObjectKeyType)] || []) - .push(currentItem); - return result; - }, {} as Record); -}; - -const installedToolsGenerator: Fig.Generator = { - script: ['sh', '-c', 'mise ls --installed'], - postProcess: (stdout: string) => { - return [...new Set(stdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return {name: tokens[0], version: tokens[1]} - }))] - } -} - - -const pluginGenerator: Fig.Generator = installedToolsGenerator -const allPluginsGenerator: Fig.Generator = singleCmdNewLineGenerator('mise plugins --all') -const simpleTaskGenerator = singleCmdJsonGenerator('mise tasks -J') -const settingsGenerator = singleCmdNewLineGenerator(`mise settings --keys`) - -const atsInStr = (s: string) => (s.match(/@/g) || []).length != 0; -const backendSepInStr = (s: string) => (s.match(/:/g) || []).length != 0; - -const searchBackend = async (backend: string, context: string[], - executeShellCommand: Fig.ExecuteCommandFunction, - shellContext: Fig.GeneratorContext): Promise => { - const customContext = context; - customContext[context.length - 1] = customContext[context.length - 1].replace(`${backend}:`, '') - switch (backend) { - case 'npm': - return (await (createNpmSearchHandler()(context, executeShellCommand, shellContext))) - case 'cargo': - //return [{name: customContext[context.length - 1]}] - return (await (createCargoSearchGenerator.custom(customContext, executeShellCommand, shellContext))) - case 'asdf': - const { stdout } = await executeShellCommand({ - command: 'sh', args: ['-c', 'mise registry'] - }) - return [...new Set(stdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return { name: tokens[1].replace(`${backend}:`, '') } - }))] - case 'ubi': - const { stdout: ubiOut } = await executeShellCommand({ - command: 'sh', args: ['-c', 'mise registry'] - }) - return [...new Set(ubiOut.split('\n').flatMap(l => { - const tokens = l.split(/\s+/) - if (!tokens[1].includes('ubi:')) return [] - return [{ name: tokens[1].replace('ubi:', '') }] as Fig.Suggestion - }))] - default: - return [] - } -} - -const compareVersions = (a: string, b: string ): number => { - const result = [a,b].sort() // Unless we can add semversort - if (result[0] != a) return 1 - return -1 -} - -const toolVersionGenerator: Fig.Generator = { - trigger: (newToken: string, oldToken: string): boolean => { - return (backendSepInStr(newToken) && !backendSepInStr(oldToken)) || - (atsInStr(newToken) && !atsInStr(oldToken)) - }, - getQueryTerm: '@', - - custom: async (context: string[], - executeShellCommand: Fig.ExecuteCommandFunction, - shellContext: Fig.GeneratorContext) => { - - const currentWord = context[context.length - 1] - if (backendSepInStr(currentWord)) { - // Let's handle backends - const backend = currentWord.slice(0, currentWord.lastIndexOf(':')) - - return (await searchBackend(backend, context, executeShellCommand, shellContext)) - .map(s => ({...s, name: `${backend}:${s.name}`, displayName: s.name, icon: '📦'})) - - } else if (atsInStr(currentWord)) { - const tool = currentWord.slice(0, currentWord.lastIndexOf('@')) - const { stdout } = await executeShellCommand({ - command: 'sh', args: ['-c', `mise ls-remote ${tool}`] - }) - const remote_versions_suggestions = stdout.split('\n').sort((a,b) => compareVersions(b,a)).map(l => ({name: l})) - const { stdout: aliasStdout } = await executeShellCommand({ - command: 'sh', args: ['-c', `mise alias ls ${tool}`] - }) - const aliases_suggestions = aliasStdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return {name: tokens[1]} - }) - return [...aliases_suggestions, ...remote_versions_suggestions] - } - - const { stdout } = await executeShellCommand({ - command: 'sh', args: ['-c', 'mise registry'] - }) - return [...new Set(stdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return { name: tokens[0] } - }))] - } -} - - -const installedToolVersionGenerator: Fig.Generator = { - trigger: '@', - getQueryTerm: '@', - custom: async (context: string[], - executeShellCommand: Fig.ExecuteCommandFunction) => { - - const tools = await getInstalledTools(executeShellCommand) - const toolsVersions = groupBy(tools, "name") - - const currentWord = context[context.length - 1] - if (atsInStr(currentWord)) { - const tool = currentWord.slice(0, currentWord.lastIndexOf('@')) - - const { stdout: aliasStdout } = await executeShellCommand({ - command: 'sh', args: ['-c', `mise alias ls ${tool}`] - }) - - // This lists all aliases even if they are not installed - /* - const aliases_suggestions = aliasStdout.split('\n').map(l => { - const tokens = l.split(/\s+/) - return {name: tokens[1], description: tokens[2]} - }) as Fig.Suggestion[] - */ - - const toolVersions = (toolsVersions[tool] || []) as {name: string, version: string}[] - const suggestions = toolVersions.map(s => ({ - name: s.version - })) as Fig.Suggestion[] - - return [...suggestions] - } - - const suggestions: Fig.Suggestion[] = [] - Object.keys(toolsVersions).forEach((k) => { - if (toolsVersions[k].length == 1) { - suggestions.push({name: k}) - } - else { - suggestions.push({name: `${k}@`}) - } - }) - - return suggestions - } -} -const usageGenerateSpec = (cmds: string[]) => { - return async (context: string[], executeCommand: Fig.ExecuteCommandFunction): Promise => { - const promises = cmds.map(async (cmd): Promise => { - try { - const args = cmd.split(" "); - const { stdout, stderr: cmdStderr, status: cmdStatus, } = await executeCommand({ - command: args[0], - args: args.splice(1), - }); - if (cmdStatus !== 0) { - return [{ name: "error", description: cmdStderr }]; - } - const { stdout: figSpecOut, stderr: figSpecStderr, status: usageFigStatus, } = await executeCommand({ - command: "usage", - args: ["g", "fig", "--spec", stdout], - }); - if (usageFigStatus !== 0) { - return [{ name: "error", description: figSpecStderr }]; - } - const start_of_json = figSpecOut.indexOf("{"); - const j = figSpecOut.slice(start_of_json); - return JSON.parse(j).subcommands as Fig.Subcommand[]; - } - catch (e) { - return [{ name: "error", description: e }] as Fig.Subcommand[]; - } - }); - // eslint-disable-next-line compat/compat - const results = await Promise.allSettled(promises); - const subcommands = results - .filter((p) => p.status === "fulfilled") - .map((p) => p.value); - const failed = results - .filter((p) => p.status === "rejected") - .map((p) => ({ name: "error", description: p.reason })); - return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; - }; -}; -const completionGeneratorTemplate = (argSuggestionBash: string): Fig.Generator => { - return { - custom: async (tokens: string[], executeCommand) => { - let arg = argSuggestionBash; - if (tokens.length >= 1) { - arg = argSuggestionBash.replace("{{words[CURRENT]}}", tokens[tokens.length - 1]); - } - if (tokens.length >= 2) { - arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); - } - const { stdout: text } = await executeCommand({ - command: "sh", - args: ["-c", arg], - }); - if (text.trim().length == 0) - return []; - return text.split("\n").map((elm) => ({ name: elm })); - }, - }; -}; -const completionSpec: Fig.Spec = { - "name": [ - "mise" - ], - "subcommands": [ - { - "name": [ - "activate" - ], - "description": "Initializes mise in the current shell session", - "options": [ - { - "name": [ - "--shims" - ], - "description": "Use shims instead of modifying PATH\nEffectively the same as:", - "isRepeatable": false - }, - { - "name": [ - "-q", - "--quiet" - ], - "description": "Suppress non-error messages", - "isRepeatable": false - } - ], - "args": [ - { - "name": "shell_type", - "description": "Shell type to generate the script for", - "isOptional": true, - "isVariadic": false, - "suggestions": [ - "bash", - "elvish", - "fish", - "nu", - "xonsh", - "zsh" - ] - } - ] - }, - { - "name": [ - "alias", - "a" - ], - "description": "Manage aliases", - "subcommands": [ - { - "name": [ - "get" - ], - "description": "Show an alias for a plugin", - "args": [ - { - "name": "plugin", - "description": "The plugin to show the alias for", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - }, - { - "name": "alias", - "description": "The alias to show", - "isOptional": false, - "isVariadic": false, - "generators": aliasGenerator - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Don't show table header", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool", - "description": "Show aliases for ", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "set", - "add", - "create" - ], - "description": "Add/update an alias for a plugin", - "args": [ - { - "name": "plugin", - "description": "The plugin to set the alias for", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - }, - { - "name": "alias", - "description": "The alias to set", - "isOptional": false, - "isVariadic": false, - "generators": aliasGenerator - }, - { - "name": "value", - "description": "The value to set the alias to", - "isOptional": false, - "isVariadic": false - } - ] - }, - { - "name": [ - "unset", - "rm", - "remove", - "delete", - "del" - ], - "description": "Clears an alias for a plugin", - "args": [ - { - "name": "plugin", - "description": "The plugin to remove the alias from", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - }, - { - "name": "alias", - "description": "The alias to remove", - "isOptional": false, - "isVariadic": false, - "generators": aliasGenerator - } - ] - } - ], - "options": [ - { - "name": [ - "-p", - "--plugin" - ], - "description": "filter aliases by plugin", - "isRepeatable": false, - "args": { - "name": "plugin", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - } - }, - { - "name": [ - "--no-header" - ], - "description": "Don't show table header", - "isRepeatable": false - } - ] - }, - { - "name": [ - "backends", - "b" - ], - "description": "Manage backends", - "subcommands": [ - { - "name": [ - "ls", - "list" - ], - "description": "List built-in backends" - } - ] - }, - { - "name": [ - "bin-paths" - ], - "description": "List all the active runtime bin paths" - }, - { - "name": [ - "cache" - ], - "description": "Manage the mise cache", - "subcommands": [ - { - "name": [ - "clear", - "c" - ], - "description": "Deletes all cache files in mise", - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to clear cache for e.g.: node, python", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - }, - { - "name": [ - "prune", - "p" - ], - "description": "Removes stale mise cache files", - "options": [ - { - "name": [ - "--dry-run" - ], - "description": "Just show what would be pruned", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show pruned files", - "isRepeatable": true - } - ], - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to clear cache for e.g.: node, python", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - } - ] - }, - { - "name": [ - "completion" - ], - "description": "Generate shell completions", - "args": [ - { - "name": "shell", - "description": "Shell type to generate completions for", - "isOptional": true, - "isVariadic": false, - "suggestions": [ - "bash", - "fish", - "zsh" - ] - } - ] - }, - { - "name": [ - "config", - "cfg" - ], - "description": "Manage config files", - "subcommands": [ - { - "name": [ - "generate", - "g" - ], - "description": "[experimental] Generate a mise.toml file", - "options": [ - { - "name": [ - "-o", - "--output" - ], - "description": "Output to file instead of stdout", - "isRepeatable": false, - "args": { - "name": "output", - "isOptional": false, - "isVariadic": false - } - } - ] - }, - { - "name": [ - "get" - ], - "description": "Display the value of a setting in a mise.toml file", - "options": [ - { - "name": [ - "-f", - "--file" - ], - "description": "The path to the mise.toml file to edit", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - } - ], - "args": [ - { - "name": "key", - "description": "The path of the config to display", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "ls" - ], - "description": "List config files currently in use", - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "set" - ], - "description": "Set the value of a setting in a mise.toml file", - "options": [ - { - "name": [ - "-f", - "--file" - ], - "description": "The path to the mise.toml file to edit", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-t", - "--type" - ], - "isRepeatable": false, - "args": { - "name": "type", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "infer", - "string", - "integer", - "float", - "bool", - "list" - ] - } - } - ], - "args": [ - { - "name": "key", - "description": "The path of the config to display", - "isOptional": false, - "isVariadic": false - }, - { - "name": "value", - "description": "The value to set the key to", - "isOptional": false, - "isVariadic": false - } - ] - } - ], - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "deactivate" - ], - "description": "Disable mise for current shell session" - }, - { - "name": [ - "direnv" - ], - "description": "Output direnv function to use mise inside direnv", - "subcommands": [ - { - "name": [ - "activate" - ], - "description": "Output direnv function to use mise inside direnv" - } - ] - }, - { - "name": [ - "doctor", - "dr" - ], - "description": "Check mise installation for possible problems" - }, - { - "name": [ - "env", - "e" - ], - "description": "Exports env vars to activate mise a single time", - "options": [ - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - }, - { - "name": [ - "-s", - "--shell" - ], - "description": "Shell type to generate environment variables for", - "isRepeatable": false, - "args": { - "name": "shell", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "bash", - "elvish", - "fish", - "nu", - "xonsh", - "zsh" - ] - } - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to use", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "exec", - "x" - ], - "description": "Execute a command with tool(s) set", - "options": [ - { - "name": [ - "-c", - "--command" - ], - "description": "Command string to execute", - "isRepeatable": false, - "args": { - "name": "c", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to start e.g.: node@20 python@3.10", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - }, - { - "name": "command", - "description": "Command string to execute (same as --command)", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "generate", - "g" - ], - "description": "[experimental] Generate files for various tools/services", - "subcommands": [ - { - "name": [ - "git-pre-commit", - "pre-commit" - ], - "description": "[experimental] Generate a git pre-commit hook", - "options": [ - { - "name": [ - "--hook" - ], - "description": "Which hook to generate (saves to .git/hooks/$hook)", - "isRepeatable": false, - "args": { - "name": "hook", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-t", - "--task" - ], - "description": "The task to run when the pre-commit hook is triggered", - "isRepeatable": false, - "args": { - "name": "task", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - }, - { - "name": [ - "-w", - "--write" - ], - "description": "write to .git/hooks/pre-commit and make it executable", - "isRepeatable": false - } - ] - }, - { - "name": [ - "github-action" - ], - "description": "[experimental] Generate a GitHub Action workflow file", - "options": [ - { - "name": [ - "-n", - "--name" - ], - "description": "the name of the workflow to generate", - "isRepeatable": false, - "args": { - "name": "name", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-t", - "--task" - ], - "description": "The task to run when the workflow is triggered", - "isRepeatable": false, - "args": { - "name": "task", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - }, - { - "name": [ - "-w", - "--write" - ], - "description": "write to .github/workflows/$name.yml", - "isRepeatable": false - } - ] - }, - { - "name": [ - "task-docs" - ], - "description": "Generate documentation for tasks in a project", - "options": [ - { - "name": [ - "-I", - "--index" - ], - "description": "write only an index of tasks, intended for use with `--multi`", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--inject" - ], - "description": "inserts the documentation into an existing file", - "isRepeatable": false - }, - { - "name": [ - "-m", - "--multi" - ], - "description": "render each task as a separate document, requires `--output` to be a directory", - "isRepeatable": false - }, - { - "name": [ - "-o", - "--output" - ], - "description": "writes the generated docs to a file/directory", - "isRepeatable": false, - "args": { - "name": "output", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-r", - "--root" - ], - "description": "root directory to search for tasks", - "isRepeatable": false, - "args": { - "name": "root", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-s", - "--style" - ], - "isRepeatable": false, - "args": { - "name": "style", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "simple", - "detailed" - ] - } - } - ] - } - ] - }, - { - "name": [ - "implode" - ], - "description": "Removes mise CLI and all related data", - "options": [ - { - "name": [ - "--config" - ], - "description": "Also remove config directory", - "isRepeatable": false - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "List directories that would be removed without actually removing them", - "isRepeatable": false - } - ] - }, - { - "name": [ - "install", - "i" - ], - "description": "Install a tool version", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Force reinstall even if already installed", - "isRepeatable": false - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show installation output", - "isRepeatable": true - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to install e.g.: node@20", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "latest" - ], - "description": "Gets the latest available version for a plugin", - "options": [ - { - "name": [ - "-i", - "--installed" - ], - "description": "Show latest installed instead of available version", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool to get the latest version of", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "link", - "ln" - ], - "description": "Symlinks a tool version into mise", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Overwrite an existing tool version if it exists", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool name and version to create a symlink for", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - }, - { - "name": "path", - "description": "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "List installed and active tool versions", - "options": [ - { - "name": [ - "-c", - "--current" - ], - "description": "Only show tool versions currently specified in a mise.toml", - "isRepeatable": false - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Only show tool versions currently specified in the global mise.toml", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--installed" - ], - "description": "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", - "isRepeatable": false - }, - { - "name": [ - "-o", - "--offline" - ], - "description": "Don't fetch information such as outdated versions", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - }, - { - "name": [ - "-m", - "--missing" - ], - "description": "Display missing tool versions", - "isRepeatable": false - }, - { - "name": [ - "--prefix" - ], - "description": "Display versions matching this prefix", - "isRepeatable": false, - "args": { - "name": "prefix", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) - } - }, - { - "name": [ - "--no-header" - ], - "description": "Don't display headers", - "isRepeatable": false - } - ], - "args": [ - { - "name": "plugin", - "description": "Only show tool versions from [PLUGIN]", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - }, - { - "name": [ - "ls-remote" - ], - "description": "List runtime versions available for install.", - "options": [ - { - "name": [ - "--all" - ], - "description": "Show all installed plugins and versions", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Plugin to get versions for", - "isOptional": true, - "isVariadic": false, - "generators": toolVersionGenerator - }, - { - "name": "prefix", - "description": "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\"", - "isOptional": true, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) - } - ] - }, - { - "name": [ - "outdated" - ], - "description": "Shows outdated tool versions", - "options": [ - { - "name": [ - "-l", - "--bump" - ], - "description": "Compares against the latest versions available, not what matches the current config", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - }, - { - "name": [ - "--no-header" - ], - "description": "Don't show table header", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "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", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "plugins", - "p" - ], - "description": "Manage plugins", - "subcommands": [ - { - "name": [ - "install", - "i", - "a", - "add" - ], - "description": "Install a plugin", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Reinstall even if plugin exists", - "isRepeatable": false - }, - { - "name": [ - "-a", - "--all" - ], - "description": "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show installation output", - "isRepeatable": true - } - ], - "args": [ - { - "name": "new_plugin", - "description": "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", - "isOptional": true, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise plugins --all`) - }, - { - "name": "git_url", - "description": "The git url of the plugin", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "link", - "ln" - ], - "description": "Symlinks a plugin into mise", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Overwrite existing plugin", - "isRepeatable": false - } - ], - "args": [ - { - "name": "name", - "description": "The name of the plugin\ne.g.: node, ruby", - "isOptional": false, - "isVariadic": false - }, - { - "name": "path", - "description": "The local path to the plugin\ne.g.: ./mise-node", - "isOptional": true, - "isVariadic": false, - "template": "filepaths" - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "List installed plugins", - "options": [ - { - "name": [ - "-c", - "--core" - ], - "description": "The built-in plugins only\nNormally these are not shown", - "isRepeatable": false - }, - { - "name": [ - "--user" - ], - "description": "List installed plugins", - "isRepeatable": false - }, - { - "name": [ - "-u", - "--urls" - ], - "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - "isRepeatable": false - } - ] - }, - { - "name": [ - "ls-remote", - "list-remote", - "list-all" - ], - "description": "List all available remote plugins", - "options": [ - { - "name": [ - "-u", - "--urls" - ], - "description": "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", - "isRepeatable": false - }, - { - "name": [ - "--only-names" - ], - "description": "Only show the name of each plugin by default it will show a \"*\" next to installed plugins", - "isRepeatable": false - } - ] - }, - { - "name": [ - "uninstall", - "remove", - "rm" - ], - "description": "Removes a plugin", - "options": [ - { - "name": [ - "-p", - "--purge" - ], - "description": "Also remove the plugin's installs, downloads, and cache", - "isRepeatable": false - }, - { - "name": [ - "-a", - "--all" - ], - "description": "Remove all plugins", - "isRepeatable": false - } - ], - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to remove", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - }, - { - "name": [ - "update", - "up", - "upgrade" - ], - "description": "Updates a plugin to the latest version", - "options": [ - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\nDefault: 4", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - } - ], - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to update", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - } - ], - "options": [ - { - "name": [ - "-c", - "--core" - ], - "description": "The built-in plugins only\nNormally these are not shown", - "isRepeatable": false - }, - { - "name": [ - "--user" - ], - "description": "List installed plugins", - "isRepeatable": false - }, - { - "name": [ - "-u", - "--urls" - ], - "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - "isRepeatable": false - } - ] - }, - { - "name": [ - "prune" - ], - "description": "Delete unused versions of tools", - "options": [ - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Do not actually delete anything", - "isRepeatable": false - }, - { - "name": [ - "--configs" - ], - "description": "Prune only tracked and trusted configuration links that point to non-existent configurations", - "isRepeatable": false - }, - { - "name": [ - "--tools" - ], - "description": "Prune only unused versions of tools", - "isRepeatable": false - } - ], - "args": [ - { - "name": "plugin", - "description": "Prune only versions from this plugin(s)", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - }, - { - "name": [ - "registry" - ], - "description": "List available tools to install", - "args": [ - { - "name": "name", - "description": "Show only the specified tool's full name", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "reshim" - ], - "description": "Creates new shims based on bin paths from currently installed tools.", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Removes all shims before reshimming", - "isRepeatable": false - } - ] - }, - { - "name": [ - "run", - "r" - ], - "description": "Run task(s)", - "options": [ - { - "name": [ - "-C", - "--cd" - ], - "description": "Change to this directory before executing the command", - "isRepeatable": false, - "args": { - "name": "cd", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Don't actually run the tasks(s), just print them in order of execution", - "isRepeatable": false - }, - { - "name": [ - "-f", - "--force" - ], - "description": "Force the tasks to run even if outputs are up to date", - "isRepeatable": false - }, - { - "name": [ - "-p", - "--prefix" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--interleave" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-t", - "--tool" - ], - "description": "Tool(s) to also add e.g.: node@20 python@3.10", - "isRepeatable": true, - "args": { - "name": "tool@version", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-r", - "--raw" - ], - "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - "isRepeatable": false - }, - { - "name": [ - "--timings" - ], - "description": "Shows elapsed time after each task completes", - "isRepeatable": false - } - ], - "generateSpec": usageGenerateSpec(["mise tasks --usage"]), - "cache": false - }, - { - "name": [ - "self-update" - ], - "description": "Updates mise itself.", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Update even if already up to date", - "isRepeatable": false - }, - { - "name": [ - "--no-plugins" - ], - "description": "Disable auto-updating plugins", - "isRepeatable": false - }, - { - "name": [ - "-y", - "--yes" - ], - "description": "Skip confirmation prompt", - "isRepeatable": false - } - ], - "args": [ - { - "name": "version", - "description": "Update to a specific version", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "set" - ], - "description": "Set environment variables in mise.toml", - "options": [ - { - "name": [ - "--file" - ], - "description": "The TOML file to update", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Set the environment variable in the global config file", - "isRepeatable": false - } - ], - "args": [ - { - "name": "env_vars", - "description": "Environment variable(s) to set\ne.g.: NODE_ENV=production", - "isOptional": true, - "isVariadic": true, - "generators": envVarGenerator - } - ] - }, - { - "name": [ - "settings" - ], - "description": "Manage settings", - "subcommands": [ - { - "name": [ - "add" - ], - "description": "Adds a setting to the configuration file", - "args": [ - { - "name": "setting", - "description": "The setting to set", - "isOptional": false, - "isVariadic": false, - "generators": settingsGenerator - }, - { - "name": "value", - "description": "The value to set", - "isOptional": false, - "isVariadic": false - } - ] - }, - { - "name": [ - "get" - ], - "description": "Show a current setting", - "args": [ - { - "name": "setting", - "description": "The setting to show", - "isOptional": false, - "isVariadic": false, - "generators": settingsGenerator - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "Show current settings", - "options": [ - { - "name": [ - "--keys" - ], - "description": "Only display key names for each setting", - "isRepeatable": false - } - ] - }, - { - "name": [ - "set", - "create" - ], - "description": "Add/update a setting", - "args": [ - { - "name": "setting", - "description": "The setting to set", - "isOptional": false, - "isVariadic": false, - "generators": settingsGenerator - }, - { - "name": "value", - "description": "The value to set", - "isOptional": false, - "isVariadic": false - } - ] - }, - { - "name": [ - "unset", - "rm", - "remove", - "delete", - "del" - ], - "description": "Clears a setting", - "args": [ - { - "name": "setting", - "description": "The setting to remove", - "isOptional": false, - "isVariadic": false, - "generators": settingsGenerator - } - ] - } - ], - "options": [ - { - "name": [ - "--keys" - ], - "description": "Only display key names for each setting", - "isRepeatable": false - } - ] - }, - { - "name": [ - "shell", - "sh" - ], - "description": "Sets a tool version for the current session.", - "options": [ - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - }, - { - "name": [ - "-u", - "--unset" - ], - "description": "Removes a previously set version", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to use", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "sync" - ], - "description": "Add tool versions from external tools to mise", - "subcommands": [ - { - "name": [ - "node" - ], - "description": "Symlinks all tool versions from an external tool into mise", - "options": [ - { - "name": [ - "--brew" - ], - "description": "Get tool versions from Homebrew", - "isRepeatable": false - }, - { - "name": [ - "--nvm" - ], - "description": "Get tool versions from nvm", - "isRepeatable": false - }, - { - "name": [ - "--nodenv" - ], - "description": "Get tool versions from nodenv", - "isRepeatable": false - } - ] - }, - { - "name": [ - "python" - ], - "description": "Symlinks all tool versions from an external tool into mise", - "options": [ - { - "name": [ - "--pyenv" - ], - "description": "Get tool versions from pyenv", - "isRepeatable": false - } - ] - } - ] - }, - { - "name": [ - "tasks", - "t" - ], - "description": "Manage tasks", - "subcommands": [ - { - "name": [ - "deps" - ], - "description": "Display a tree visualization of a dependency graph", - "options": [ - { - "name": [ - "--hidden" - ], - "description": "Show hidden tasks", - "isRepeatable": false - }, - { - "name": [ - "--dot" - ], - "description": "Display dependencies in DOT format", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tasks", - "description": "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "edit" - ], - "description": "Edit a tasks with $EDITOR", - "options": [ - { - "name": [ - "-p", - "--path" - ], - "description": "Display the path to the tasks instead of editing it", - "isRepeatable": false - } - ], - "args": [ - { - "name": "task", - "description": "Tasks to edit", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - ] - }, - { - "name": [ - "info" - ], - "description": "Get information about a task", - "options": [ - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ], - "args": [ - { - "name": "task", - "description": "Name of the task to get information about", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - ] - }, - { - "name": [ - "ls" - ], - "description": "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.", - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-x", - "--extended" - ], - "description": "Show all columns", - "isRepeatable": false - }, - { - "name": [ - "--hidden" - ], - "description": "Show hidden tasks", - "isRepeatable": false - }, - { - "name": [ - "--sort" - ], - "description": "Sort by column. Default is name.", - "isRepeatable": false, - "args": { - "name": "column", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "name", - "alias", - "description", - "source" - ] - } - }, - { - "name": [ - "--sort-order" - ], - "description": "Sort order. Default is asc.", - "isRepeatable": false, - "args": { - "name": "sort_order", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "asc", - "desc" - ] - } - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "run", - "r" - ], - "description": "Run task(s)", - "options": [ - { - "name": [ - "-C", - "--cd" - ], - "description": "Change to this directory before executing the command", - "isRepeatable": false, - "args": { - "name": "cd", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Don't actually run the tasks(s), just print them in order of execution", - "isRepeatable": false - }, - { - "name": [ - "-f", - "--force" - ], - "description": "Force the tasks to run even if outputs are up to date", - "isRepeatable": false - }, - { - "name": [ - "-p", - "--prefix" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--interleave" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-t", - "--tool" - ], - "description": "Tool(s) to also add e.g.: node@20 python@3.10", - "isRepeatable": true, - "args": { - "name": "tool@version", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-r", - "--raw" - ], - "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - "isRepeatable": false - }, - { - "name": [ - "--timings" - ], - "description": "Shows elapsed time after each task completes", - "isRepeatable": false - } - ], - "args": [ - { - "name": "task", - "description": "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", - "isOptional": true, - "isVariadic": false, - "generators": simpleTaskGenerator - }, - { - "name": "args", - "description": "Arguments to pass to the tasks. Use \":::\" to separate tasks", - "isOptional": true, - "isVariadic": true - } - ], - "generateSpec": usageGenerateSpec(["mise tasks --usage"]), - "cache": false - } - ], - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-x", - "--extended" - ], - "description": "Show all columns", - "isRepeatable": false - }, - { - "name": [ - "--hidden" - ], - "description": "Show hidden tasks", - "isRepeatable": false - }, - { - "name": [ - "--sort" - ], - "description": "Sort by column. Default is name.", - "isRepeatable": false, - "args": { - "name": "column", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "name", - "alias", - "description", - "source" - ] - } - }, - { - "name": [ - "--sort-order" - ], - "description": "Sort order. Default is asc.", - "isRepeatable": false, - "args": { - "name": "sort_order", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "asc", - "desc" - ] - } - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "trust" - ], - "description": "Marks a config file as trusted", - "options": [ - { - "name": [ - "-a", - "--all" - ], - "description": "Trust all config files in the current directory and its parents", - "isRepeatable": false - }, - { - "name": [ - "--untrust" - ], - "description": "No longer trust this config", - "isRepeatable": false - }, - { - "name": [ - "--show" - ], - "description": "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", - "isRepeatable": false - } - ], - "args": [ - { - "name": "config_file", - "description": "The config file to trust", - "isOptional": true, - "isVariadic": false, - "template": "filepaths", - "generators": configPathGenerator - } - ] - }, - { - "name": [ - "uninstall", - "remove", - "rm" - ], - "description": "Removes installed tool versions", - "options": [ - { - "name": [ - "-a", - "--all" - ], - "description": "Delete all installed versions", - "isRepeatable": false - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Do not actually delete anything", - "isRepeatable": false - } - ], - "args": [ - { - "name": "installed_tool@version", - "description": "Tool(s) to remove", - "isOptional": true, - "isVariadic": true, - "generators": installedToolVersionGenerator - } - ] - }, - { - "name": [ - "unset" - ], - "description": "Remove environment variable(s) from the config file.", - "options": [ - { - "name": [ - "-f", - "--file" - ], - "description": "Specify a file to use instead of `mise.toml`", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Use the global config file", - "isRepeatable": false - } - ], - "args": [ - { - "name": "keys", - "description": "Environment variable(s) to remove\ne.g.: NODE_ENV", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "upgrade", - "up" - ], - "description": "Upgrades outdated tools", - "options": [ - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Just print what would be done, don't actually do it", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--interactive" - ], - "description": "Display multiselect menu to choose which tools to upgrade", - "isRepeatable": false - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-l", - "--bump" - ], - "description": "Upgrades to the latest version available, bumping the version in mise.toml", - "isRepeatable": false - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "use", - "u" - ], - "description": "Installs a tool and adds the version it to mise.toml.", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Force reinstall even if already installed", - "isRepeatable": false - }, - { - "name": [ - "--fuzzy" - ], - "description": "Save fuzzy version to config file", - "isRepeatable": false - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", - "isRepeatable": false - }, - { - "name": [ - "-e", - "--env" - ], - "description": "Modify an environment-specific config file like .mise..toml", - "isRepeatable": false, - "args": { - "name": "env", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", - "isRepeatable": false - }, - { - "name": [ - "--remove" - ], - "description": "Remove the plugin(s) from config file", - "isRepeatable": true, - "args": { - "name": "plugin", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - } - }, - { - "name": [ - "-p", - "--path" - ], - "description": "Specify a path to a config file or directory", - "isRepeatable": false, - "args": { - "name": "path", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "--pin" - ], - "description": "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to add to config file", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "version", - "v" - ], - "description": "Display the version of mise" - }, - { - "name": [ - "watch", - "w" - ], - "description": "Run task(s) and watch for changes to rerun it", - "options": [ - { - "name": [ - "-t", - "--task" - ], - "description": "Tasks to run", - "isRepeatable": true, - "args": { - "name": "task", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - }, - { - "name": [ - "-g", - "--glob" - ], - "description": "Files to watch\nDefaults to sources from the tasks(s)", - "isRepeatable": true, - "args": { - "name": "glob", - "isOptional": false, - "isVariadic": false - } - } - ], - "args": [ - { - "name": "args", - "description": "Extra arguments", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "where" - ], - "description": "Display the installation path for a tool", - "args": [ - { - "name": "tool@version", - "description": "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", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "which" - ], - "description": "Shows the path that a tool's bin points to.", - "options": [ - { - "name": [ - "--plugin" - ], - "description": "Show the plugin name instead of the path", - "isRepeatable": false - }, - { - "name": [ - "--version" - ], - "description": "Show the version instead of the path", - "isRepeatable": false - }, - { - "name": [ - "-t", - "--tool" - ], - "description": "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", - "isRepeatable": false, - "args": { - "name": "tool@version", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - } - ], - "args": [ - { - "name": "bin_name", - "description": "The bin to look up", - "isOptional": false, - "isVariadic": false - } - ] - } - ], - "options": [ - { - "name": [ - "-C", - "--cd" - ], - "description": "Change directory before running command", - "isRepeatable": false, - "args": { - "name": "dir", - "isOptional": false, - "isVariadic": false, - "template": "folders" - } - }, - { - "name": [ - "-P", - "--profile" - ], - "description": "Set the profile (environment)", - "isRepeatable": false, - "args": { - "name": "profile", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-q", - "--quiet" - ], - "description": "Suppress non-error messages", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show extra output (use -vv for even more)", - "isRepeatable": true - }, - { - "name": [ - "-y", - "--yes" - ], - "description": "Answer yes to all confirmation prompts", - "isRepeatable": false - } - ] -}; -export default completionSpec; diff --git a/tsconfig.json b/tsconfig.json index 31ef758243..7132a7b422 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,9 +1,9 @@ { - "extends": "@tsconfig/node18/tsconfig.json", - "include": ["**/*"], - "exclude": ["node_modules"], - "compilerOptions": { - "outDir": "./build", - "types": ["@withfig/autocomplete-types", "node"] - } + "extends": "@tsconfig/node18/tsconfig.json", + "include": ["**/*"], + "exclude": ["node_modules"], + "compilerOptions": { + "outDir": "./build", + "types": ["@withfig/autocomplete-types", "node"] } +} From f0fb52ca6c50b21fe5258f113c750ea1be2fdc8c Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:19:07 +0000 Subject: [PATCH 08/14] [autofix.ci] apply automated fixes --- tasks.md | 2 +- tasks/fig/src/mise.ts | 4361 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 4362 insertions(+), 1 deletion(-) create mode 100644 tasks/fig/src/mise.ts diff --git a/tasks.md b/tasks.md index 1ba43fe48d..0af8a583ad 100644 --- a/tasks.md +++ b/tasks.md @@ -180,7 +180,7 @@ User to run as ## `render:fig` -- Depends: build, render:usage +- Depends: build, render:usage, render:completions - **Usage**: `render:fig` diff --git a/tasks/fig/src/mise.ts b/tasks/fig/src/mise.ts new file mode 100644 index 0000000000..5be619f587 --- /dev/null +++ b/tasks/fig/src/mise.ts @@ -0,0 +1,4361 @@ +const usageGenerateSpec = (cmds: string[]) => { + return async ( + context: string[], + executeCommand: Fig.ExecuteCommandFunction, + ): Promise => { + const promises = cmds.map(async (cmd): Promise => { + try { + const args = cmd.split(" "); + const { + stdout, + stderr: cmdStderr, + status: cmdStatus, + } = await executeCommand({ + command: args[0], + args: args.splice(1), + }); + if (cmdStatus !== 0) { + return [{ name: "error", description: cmdStderr }]; + } + const { + stdout: figSpecOut, + stderr: figSpecStderr, + status: usageFigStatus, + } = await executeCommand({ + command: "usage", + args: ["g", "fig", "--spec", stdout], + }); + if (usageFigStatus !== 0) { + return [{ name: "error", description: figSpecStderr }]; + } + + const start_of_json = figSpecOut.indexOf("{"); + const j = figSpecOut.slice(start_of_json); + return JSON.parse(j).subcommands as Fig.Subcommand[]; + } catch (e) { + return [{ name: "error", description: e }] as Fig.Subcommand[]; + } + }); + + // eslint-disable-next-line compat/compat + const results = await Promise.allSettled(promises); + const subcommands = results + .filter((p) => p.status === "fulfilled") + .map((p) => p.value); + const failed = results + .filter((p) => p.status === "rejected") + .map((p) => ({ name: "error", description: p.reason })); + + return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; + }; +}; + +const completionGeneratorTemplate = ( + argSuggestionBash: string, +): Fig.Generator => { + return { + custom: async (tokens: string[], executeCommand) => { + let arg = argSuggestionBash; + if (tokens.length >= 1) { + arg = argSuggestionBash.replace( + "{{words[CURRENT]}}", + tokens[tokens.length - 1], + ); + } + + if (tokens.length >= 2) { + arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); + } + const { stdout: text } = await executeCommand({ + command: "sh", + args: ["-c", arg], + }); + if (text.trim().length == 0) return []; + return text.split("\n").map((elm) => ({ name: elm })); + }, + }; +}; + +const completionSpec: Fig.Spec = { + name: ["mise"], + subcommands: [ + { + name: ["activate"], + description: "Initializes mise in the current shell session", + options: [ + { + name: ["--shims"], + description: + "Use shims instead of modifying PATH\nEffectively the same as:", + isRepeatable: false, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + ], + args: [ + { + name: "shell_type", + description: "Shell type to generate the script for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + ], + }, + { + name: ["alias", "a"], + description: "Manage aliases", + subcommands: [ + { + name: ["get"], + description: "Show an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to show the alias for", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + { + name: "alias", + description: "The alias to show", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise alias ls {{words[PREV]}} | awk '{print $2}'`, + ), + }, + ], + }, + { + name: ["ls", "list"], + description: + "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + options: [ + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool", + description: "Show aliases for ", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set", "add", "create"], + description: "Add/update an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to set the alias for", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + { + name: "alias", + description: "The alias to set", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise alias ls {{words[PREV]}} | awk '{print $2}'`, + ), + }, + { + name: "value", + description: "The value to set the alias to", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to remove the alias from", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + { + name: "alias", + description: "The alias to remove", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise alias ls {{words[PREV]}} | awk '{print $2}'`, + ), + }, + ], + }, + ], + options: [ + { + name: ["-p", "--plugin"], + description: "filter aliases by plugin", + isRepeatable: false, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + }, + { + name: ["backends", "b"], + description: "Manage backends", + subcommands: [ + { + name: ["ls", "list"], + description: "List built-in backends", + }, + ], + }, + { + name: ["bin-paths"], + description: "List all the active runtime bin paths", + }, + { + name: ["cache"], + description: "Manage the mise cache", + subcommands: [ + { + name: ["clear", "c"], + description: "Deletes all cache files in mise", + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + ], + }, + { + name: ["prune", "p"], + description: "Removes stale mise cache files", + options: [ + { + name: ["--dry-run"], + description: "Just show what would be pruned", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show pruned files", + isRepeatable: true, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + ], + }, + ], + }, + { + name: ["completion"], + description: "Generate shell completions", + args: [ + { + name: "shell", + description: "Shell type to generate completions for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "fish", "zsh"], + }, + ], + }, + { + name: ["config", "cfg"], + description: "Manage config files", + subcommands: [ + { + name: ["generate", "g"], + description: "[experimental] Generate a mise.toml file", + options: [ + { + name: ["-o", "--output"], + description: "Output to file instead of stdout", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + ], + }, + { + name: ["get"], + description: "Display the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["ls"], + description: "List config files currently in use", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["set"], + description: "Set the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-t", "--type"], + isRepeatable: false, + args: { + name: "type", + isOptional: false, + isVariadic: false, + suggestions: [ + "infer", + "string", + "integer", + "float", + "bool", + "list", + ], + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: false, + isVariadic: false, + }, + { + name: "value", + description: "The value to set the key to", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["deactivate"], + description: "Disable mise for current shell session", + }, + { + name: ["direnv"], + description: "Output direnv function to use mise inside direnv", + subcommands: [ + { + name: ["activate"], + description: "Output direnv function to use mise inside direnv", + }, + ], + }, + { + name: ["doctor", "dr"], + description: "Check mise installation for possible problems", + }, + { + name: ["env", "e"], + description: "Exports env vars to activate mise a single time", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-s", "--shell"], + description: "Shell type to generate environment variables for", + isRepeatable: false, + args: { + name: "shell", + isOptional: false, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["exec", "x"], + description: "Execute a command with tool(s) set", + options: [ + { + name: ["-c", "--command"], + description: "Command string to execute", + isRepeatable: false, + args: { + name: "c", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to start e.g.: node@20 python@3.10", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + { + name: "command", + description: "Command string to execute (same as --command)", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["generate", "g"], + description: "[experimental] Generate files for various tools/services", + subcommands: [ + { + name: ["git-pre-commit", "pre-commit"], + description: "[experimental] Generate a git pre-commit hook", + options: [ + { + name: ["--hook"], + description: "Which hook to generate (saves to .git/hooks/$hook)", + isRepeatable: false, + args: { + name: "hook", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: + "The task to run when the pre-commit hook is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + }, + { + name: ["-w", "--write"], + description: + "write to .git/hooks/pre-commit and make it executable", + isRepeatable: false, + }, + ], + }, + { + name: ["github-action"], + description: "[experimental] Generate a GitHub Action workflow file", + options: [ + { + name: ["-n", "--name"], + description: "the name of the workflow to generate", + isRepeatable: false, + args: { + name: "name", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: "The task to run when the workflow is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + }, + { + name: ["-w", "--write"], + description: "write to .github/workflows/$name.yml", + isRepeatable: false, + }, + ], + }, + { + name: ["task-docs"], + description: "Generate documentation for tasks in a project", + options: [ + { + name: ["-I", "--index"], + description: + "write only an index of tasks, intended for use with `--multi`", + isRepeatable: false, + }, + { + name: ["-i", "--inject"], + description: "inserts the documentation into an existing file", + isRepeatable: false, + }, + { + name: ["-m", "--multi"], + description: + "render each task as a separate document, requires `--output` to be a directory", + isRepeatable: false, + }, + { + name: ["-o", "--output"], + description: "writes the generated docs to a file/directory", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--root"], + description: "root directory to search for tasks", + isRepeatable: false, + args: { + name: "root", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-s", "--style"], + isRepeatable: false, + args: { + name: "style", + isOptional: false, + isVariadic: false, + suggestions: ["simple", "detailed"], + }, + }, + ], + }, + ], + }, + { + name: ["implode"], + description: "Removes mise CLI and all related data", + options: [ + { + name: ["--config"], + description: "Also remove config directory", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: + "List directories that would be removed without actually removing them", + isRepeatable: false, + }, + ], + }, + { + name: ["install", "i"], + description: "Install a tool version", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to install e.g.: node@20", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["latest"], + description: "Gets the latest available version for a plugin", + options: [ + { + name: ["-i", "--installed"], + description: "Show latest installed instead of available version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool to get the latest version of", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a tool version into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite an existing tool version if it exists", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool name and version to create a symlink for", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + { + name: "path", + description: + "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed and active tool versions", + options: [ + { + name: ["-c", "--current"], + description: + "Only show tool versions currently specified in a mise.toml", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Only show tool versions currently specified in the global mise.toml", + isRepeatable: false, + }, + { + name: ["-i", "--installed"], + description: + "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", + isRepeatable: false, + }, + { + name: ["-o", "--offline"], + description: "Don't fetch information such as outdated versions", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-m", "--missing"], + description: "Display missing tool versions", + isRepeatable: false, + }, + { + name: ["--prefix"], + description: "Display versions matching this prefix", + isRepeatable: false, + args: { + name: "prefix", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + }, + { + name: ["--no-header"], + description: "Don't display headers", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Only show tool versions from [PLUGIN]", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(`mise plugins --core --user`), + }, + ], + }, + { + name: ["ls-remote"], + description: "List runtime versions available for install.", + options: [ + { + name: ["--all"], + description: "Show all installed plugins and versions", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Plugin to get versions for", + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + { + name: "prefix", + description: + 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + ], + }, + { + name: ["outdated"], + description: "Shows outdated tool versions", + options: [ + { + name: ["-l", "--bump"], + description: + "Compares against the latest versions available, not what matches the current config", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "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", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["plugins", "p"], + description: "Manage plugins", + subcommands: [ + { + name: ["install", "i", "a", "add"], + description: "Install a plugin", + options: [ + { + name: ["-f", "--force"], + description: "Reinstall even if plugin exists", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: + "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "new_plugin", + description: + "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate(`mise plugins --all`), + }, + { + name: "git_url", + description: "The git url of the plugin", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a plugin into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite existing plugin", + isRepeatable: false, + }, + ], + args: [ + { + name: "name", + description: "The name of the plugin\ne.g.: node, ruby", + isOptional: false, + isVariadic: false, + }, + { + name: "path", + description: "The local path to the plugin\ne.g.: ./mise-node", + isOptional: true, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed plugins", + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["ls-remote", "list-remote", "list-all"], + description: "List all available remote plugins", + options: [ + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", + isRepeatable: false, + }, + { + name: ["--only-names"], + description: + 'Only show the name of each plugin by default it will show a "*" next to installed plugins', + isRepeatable: false, + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes a plugin", + options: [ + { + name: ["-p", "--purge"], + description: + "Also remove the plugin's installs, downloads, and cache", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: "Remove all plugins", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to remove", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + ], + }, + { + name: ["update", "up", "upgrade"], + description: "Updates a plugin to the latest version", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\nDefault: 4", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to update", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + ], + }, + ], + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["prune"], + description: "Delete unused versions of tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + { + name: ["--configs"], + description: + "Prune only tracked and trusted configuration links that point to non-existent configurations", + isRepeatable: false, + }, + { + name: ["--tools"], + description: "Prune only unused versions of tools", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Prune only versions from this plugin(s)", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(`mise plugins --core --user`), + }, + ], + }, + { + name: ["registry"], + description: "List available tools to install", + args: [ + { + name: "name", + description: "Show only the specified tool's full name", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["reshim"], + description: + "Creates new shims based on bin paths from currently installed tools.", + options: [ + { + name: ["-f", "--force"], + description: "Removes all shims before reshimming", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + { + name: ["self-update"], + description: "Updates mise itself.", + options: [ + { + name: ["-f", "--force"], + description: "Update even if already up to date", + isRepeatable: false, + }, + { + name: ["--no-plugins"], + description: "Disable auto-updating plugins", + isRepeatable: false, + }, + { + name: ["-y", "--yes"], + description: "Skip confirmation prompt", + isRepeatable: false, + }, + ], + args: [ + { + name: "version", + description: "Update to a specific version", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set"], + description: "Set environment variables in mise.toml", + options: [ + { + name: ["--file"], + description: "The TOML file to update", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Set the environment variable in the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "env_vars", + description: + "Environment variable(s) to set\ne.g.: NODE_ENV=production", + isOptional: true, + isVariadic: true, + generators: envVarGenerator, + }, + ], + }, + { + name: ["settings"], + description: "Manage settings", + subcommands: [ + { + name: ["add"], + description: "Adds a setting to the configuration file", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(`mise settings --keys`), + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["get"], + description: "Show a current setting", + args: [ + { + name: "setting", + description: "The setting to show", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(`mise settings --keys`), + }, + ], + }, + { + name: ["ls", "list"], + description: "Show current settings", + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["set", "create"], + description: "Add/update a setting", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(`mise settings --keys`), + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears a setting", + args: [ + { + name: "setting", + description: "The setting to remove", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(`mise settings --keys`), + }, + ], + }, + ], + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["shell", "sh"], + description: "Sets a tool version for the current session.", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-u", "--unset"], + description: "Removes a previously set version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["sync"], + description: "Add tool versions from external tools to mise", + subcommands: [ + { + name: ["node"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--brew"], + description: "Get tool versions from Homebrew", + isRepeatable: false, + }, + { + name: ["--nvm"], + description: "Get tool versions from nvm", + isRepeatable: false, + }, + { + name: ["--nodenv"], + description: "Get tool versions from nodenv", + isRepeatable: false, + }, + ], + }, + { + name: ["python"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--pyenv"], + description: "Get tool versions from pyenv", + isRepeatable: false, + }, + ], + }, + ], + }, + { + name: ["tasks", "t"], + description: "Manage tasks", + subcommands: [ + { + name: ["deps"], + description: "Display a tree visualization of a dependency graph", + options: [ + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--dot"], + description: "Display dependencies in DOT format", + isRepeatable: false, + }, + ], + args: [ + { + name: "tasks", + description: + "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["edit"], + description: "Edit a tasks with $EDITOR", + options: [ + { + name: ["-p", "--path"], + description: + "Display the path to the tasks instead of editing it", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Tasks to edit", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + ], + }, + { + name: ["info"], + description: "Get information about a task", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Name of the task to get information about", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + ], + }, + { + name: ["ls"], + description: + "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.", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: + "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: + "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: + "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + { + name: "args", + description: + 'Arguments to pass to the tasks. Use ":::" to separate tasks', + isOptional: true, + isVariadic: true, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["trust"], + description: "Marks a config file as trusted", + options: [ + { + name: ["-a", "--all"], + description: + "Trust all config files in the current directory and its parents", + isRepeatable: false, + }, + { + name: ["--untrust"], + description: "No longer trust this config", + isRepeatable: false, + }, + { + name: ["--show"], + description: + "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", + isRepeatable: false, + }, + ], + args: [ + { + name: "config_file", + description: "The config file to trust", + isOptional: true, + isVariadic: false, + template: "filepaths", + generators: completionGeneratorTemplate(``), + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes installed tool versions", + options: [ + { + name: ["-a", "--all"], + description: "Delete all installed versions", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + ], + args: [ + { + name: "installed_tool@version", + description: "Tool(s) to remove", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + if [ ! -z "$prefix" ]; then + prefix="--prefix $prefix" + fi + versions=$(mise ls --installed $tool $prefix | awk '{print $2}' | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise ls --installed | awk '{print $1}' | sed '1!G;h;$!d') + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["unset"], + description: "Remove environment variable(s) from the config file.", + options: [ + { + name: ["-f", "--file"], + description: "Specify a file to use instead of `mise.toml`", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Use the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "keys", + description: "Environment variable(s) to remove\ne.g.: NODE_ENV", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["upgrade", "up"], + description: "Upgrades outdated tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Just print what would be done, don't actually do it", + isRepeatable: false, + }, + { + name: ["-i", "--interactive"], + description: + "Display multiselect menu to choose which tools to upgrade", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-l", "--bump"], + description: + "Upgrades to the latest version available, bumping the version in mise.toml", + isRepeatable: false, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["use", "u"], + description: "Installs a tool and adds the version it to mise.toml.", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["--fuzzy"], + description: "Save fuzzy version to config file", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", + isRepeatable: false, + }, + { + name: ["-e", "--env"], + description: + "Modify an environment-specific config file like .mise..toml", + isRepeatable: false, + args: { + name: "env", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", + isRepeatable: false, + }, + { + name: ["--remove"], + description: "Remove the plugin(s) from config file", + isRepeatable: true, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + }, + { + name: ["-p", "--path"], + description: "Specify a path to a config file or directory", + isRepeatable: false, + args: { + name: "path", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["--pin"], + description: + "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to add to config file", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["version", "v"], + description: "Display the version of mise", + }, + { + name: ["watch", "w"], + description: "Run task(s) and watch for changes to rerun it", + options: [ + { + name: ["-t", "--task"], + description: "Tasks to run", + isRepeatable: true, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + }, + { + name: ["-g", "--glob"], + description: "Files to watch\nDefaults to sources from the tasks(s)", + isRepeatable: true, + args: { + name: "glob", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "args", + description: "Extra arguments", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["where"], + description: "Display the installation path for a tool", + args: [ + { + name: "tool@version", + description: + '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', + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["which"], + description: "Shows the path that a tool's bin points to.", + options: [ + { + name: ["--plugin"], + description: "Show the plugin name instead of the path", + isRepeatable: false, + }, + { + name: ["--version"], + description: "Show the version instead of the path", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: + "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", + isRepeatable: false, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + }, + ], + args: [ + { + name: "bin_name", + description: "The bin to look up", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["-C", "--cd"], + description: "Change directory before running command", + isRepeatable: false, + args: { + name: "dir", + isOptional: false, + isVariadic: false, + template: "folders", + }, + }, + { + name: ["-P", "--profile"], + description: "Set the profile (environment)", + isRepeatable: false, + args: { + name: "profile", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show extra output (use -vv for even more)", + isRepeatable: true, + }, + { + name: ["-y", "--yes"], + description: "Answer yes to all confirmation prompts", + isRepeatable: false, + }, + ], +}; + +export default completionSpec; + +const usageGenerateSpec = (cmds: string[]) => { + return async ( + context: string[], + executeCommand: Fig.ExecuteCommandFunction, + ): Promise => { + const promises = cmds.map(async (cmd): Promise => { + try { + const args = cmd.split(" "); + const { + stdout, + stderr: cmdStderr, + status: cmdStatus, + } = await executeCommand({ + command: args[0], + args: args.splice(1), + }); + if (cmdStatus !== 0) { + return [{ name: "error", description: cmdStderr }]; + } + const { + stdout: figSpecOut, + stderr: figSpecStderr, + status: usageFigStatus, + } = await executeCommand({ + command: "usage", + args: ["g", "fig", "--spec", stdout], + }); + if (usageFigStatus !== 0) { + return [{ name: "error", description: figSpecStderr }]; + } + const start_of_json = figSpecOut.indexOf("{"); + const j = figSpecOut.slice(start_of_json); + return JSON.parse(j).subcommands as Fig.Subcommand[]; + } catch (e) { + return [{ name: "error", description: e }] as Fig.Subcommand[]; + } + }); + // eslint-disable-next-line compat/compat + const results = await Promise.allSettled(promises); + const subcommands = results + .filter((p) => p.status === "fulfilled") + .map((p) => p.value); + const failed = results + .filter((p) => p.status === "rejected") + .map((p) => ({ name: "error", description: p.reason })); + return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; + }; +}; +const completionGeneratorTemplate = ( + argSuggestionBash: string, +): Fig.Generator => { + return { + custom: async (tokens: string[], executeCommand) => { + let arg = argSuggestionBash; + if (tokens.length >= 1) { + arg = argSuggestionBash.replace( + "{{words[CURRENT]}}", + tokens[tokens.length - 1], + ); + } + if (tokens.length >= 2) { + arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); + } + const { stdout: text } = await executeCommand({ + command: "sh", + args: ["-c", arg], + }); + if (text.trim().length == 0) return []; + return text.split("\n").map((elm) => ({ name: elm })); + }, + }; +}; +const completionSpec: Fig.Spec = { + name: ["mise"], + subcommands: [ + { + name: ["activate"], + description: "Initializes mise in the current shell session", + options: [ + { + name: ["--shims"], + description: + "Use shims instead of modifying PATH\nEffectively the same as:", + isRepeatable: false, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + ], + args: [ + { + name: "shell_type", + description: "Shell type to generate the script for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + ], + }, + { + name: ["alias", "a"], + description: "Manage aliases", + subcommands: [ + { + name: ["get"], + description: "Show an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to show the alias for", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + { + name: "alias", + description: "The alias to show", + isOptional: false, + isVariadic: false, + generators: aliasGenerator, + }, + ], + }, + { + name: ["ls", "list"], + description: + "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + options: [ + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool", + description: "Show aliases for ", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set", "add", "create"], + description: "Add/update an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to set the alias for", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + { + name: "alias", + description: "The alias to set", + isOptional: false, + isVariadic: false, + generators: aliasGenerator, + }, + { + name: "value", + description: "The value to set the alias to", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to remove the alias from", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + { + name: "alias", + description: "The alias to remove", + isOptional: false, + isVariadic: false, + generators: aliasGenerator, + }, + ], + }, + ], + options: [ + { + name: ["-p", "--plugin"], + description: "filter aliases by plugin", + isRepeatable: false, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + }, + { + name: ["backends", "b"], + description: "Manage backends", + subcommands: [ + { + name: ["ls", "list"], + description: "List built-in backends", + }, + ], + }, + { + name: ["bin-paths"], + description: "List all the active runtime bin paths", + }, + { + name: ["cache"], + description: "Manage the mise cache", + subcommands: [ + { + name: ["clear", "c"], + description: "Deletes all cache files in mise", + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["prune", "p"], + description: "Removes stale mise cache files", + options: [ + { + name: ["--dry-run"], + description: "Just show what would be pruned", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show pruned files", + isRepeatable: true, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + ], + }, + { + name: ["completion"], + description: "Generate shell completions", + args: [ + { + name: "shell", + description: "Shell type to generate completions for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "fish", "zsh"], + }, + ], + }, + { + name: ["config", "cfg"], + description: "Manage config files", + subcommands: [ + { + name: ["generate", "g"], + description: "[experimental] Generate a mise.toml file", + options: [ + { + name: ["-o", "--output"], + description: "Output to file instead of stdout", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + ], + }, + { + name: ["get"], + description: "Display the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["ls"], + description: "List config files currently in use", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["set"], + description: "Set the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-t", "--type"], + isRepeatable: false, + args: { + name: "type", + isOptional: false, + isVariadic: false, + suggestions: [ + "infer", + "string", + "integer", + "float", + "bool", + "list", + ], + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: false, + isVariadic: false, + }, + { + name: "value", + description: "The value to set the key to", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["deactivate"], + description: "Disable mise for current shell session", + }, + { + name: ["direnv"], + description: "Output direnv function to use mise inside direnv", + subcommands: [ + { + name: ["activate"], + description: "Output direnv function to use mise inside direnv", + }, + ], + }, + { + name: ["doctor", "dr"], + description: "Check mise installation for possible problems", + }, + { + name: ["env", "e"], + description: "Exports env vars to activate mise a single time", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-s", "--shell"], + description: "Shell type to generate environment variables for", + isRepeatable: false, + args: { + name: "shell", + isOptional: false, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["exec", "x"], + description: "Execute a command with tool(s) set", + options: [ + { + name: ["-c", "--command"], + description: "Command string to execute", + isRepeatable: false, + args: { + name: "c", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to start e.g.: node@20 python@3.10", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + { + name: "command", + description: "Command string to execute (same as --command)", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["generate", "g"], + description: "[experimental] Generate files for various tools/services", + subcommands: [ + { + name: ["git-pre-commit", "pre-commit"], + description: "[experimental] Generate a git pre-commit hook", + options: [ + { + name: ["--hook"], + description: "Which hook to generate (saves to .git/hooks/$hook)", + isRepeatable: false, + args: { + name: "hook", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: + "The task to run when the pre-commit hook is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + }, + { + name: ["-w", "--write"], + description: + "write to .git/hooks/pre-commit and make it executable", + isRepeatable: false, + }, + ], + }, + { + name: ["github-action"], + description: "[experimental] Generate a GitHub Action workflow file", + options: [ + { + name: ["-n", "--name"], + description: "the name of the workflow to generate", + isRepeatable: false, + args: { + name: "name", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: "The task to run when the workflow is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + }, + { + name: ["-w", "--write"], + description: "write to .github/workflows/$name.yml", + isRepeatable: false, + }, + ], + }, + { + name: ["task-docs"], + description: "Generate documentation for tasks in a project", + options: [ + { + name: ["-I", "--index"], + description: + "write only an index of tasks, intended for use with `--multi`", + isRepeatable: false, + }, + { + name: ["-i", "--inject"], + description: "inserts the documentation into an existing file", + isRepeatable: false, + }, + { + name: ["-m", "--multi"], + description: + "render each task as a separate document, requires `--output` to be a directory", + isRepeatable: false, + }, + { + name: ["-o", "--output"], + description: "writes the generated docs to a file/directory", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--root"], + description: "root directory to search for tasks", + isRepeatable: false, + args: { + name: "root", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-s", "--style"], + isRepeatable: false, + args: { + name: "style", + isOptional: false, + isVariadic: false, + suggestions: ["simple", "detailed"], + }, + }, + ], + }, + ], + }, + { + name: ["implode"], + description: "Removes mise CLI and all related data", + options: [ + { + name: ["--config"], + description: "Also remove config directory", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: + "List directories that would be removed without actually removing them", + isRepeatable: false, + }, + ], + }, + { + name: ["install", "i"], + description: "Install a tool version", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to install e.g.: node@20", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["latest"], + description: "Gets the latest available version for a plugin", + options: [ + { + name: ["-i", "--installed"], + description: "Show latest installed instead of available version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool to get the latest version of", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a tool version into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite an existing tool version if it exists", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool name and version to create a symlink for", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + { + name: "path", + description: + "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed and active tool versions", + options: [ + { + name: ["-c", "--current"], + description: + "Only show tool versions currently specified in a mise.toml", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Only show tool versions currently specified in the global mise.toml", + isRepeatable: false, + }, + { + name: ["-i", "--installed"], + description: + "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", + isRepeatable: false, + }, + { + name: ["-o", "--offline"], + description: "Don't fetch information such as outdated versions", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-m", "--missing"], + description: "Display missing tool versions", + isRepeatable: false, + }, + { + name: ["--prefix"], + description: "Display versions matching this prefix", + isRepeatable: false, + args: { + name: "prefix", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + }, + { + name: ["--no-header"], + description: "Don't display headers", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Only show tool versions from [PLUGIN]", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["ls-remote"], + description: "List runtime versions available for install.", + options: [ + { + name: ["--all"], + description: "Show all installed plugins and versions", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Plugin to get versions for", + isOptional: true, + isVariadic: false, + generators: toolVersionGenerator, + }, + { + name: "prefix", + description: + 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + ], + }, + { + name: ["outdated"], + description: "Shows outdated tool versions", + options: [ + { + name: ["-l", "--bump"], + description: + "Compares against the latest versions available, not what matches the current config", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "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", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["plugins", "p"], + description: "Manage plugins", + subcommands: [ + { + name: ["install", "i", "a", "add"], + description: "Install a plugin", + options: [ + { + name: ["-f", "--force"], + description: "Reinstall even if plugin exists", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: + "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "new_plugin", + description: + "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate(`mise plugins --all`), + }, + { + name: "git_url", + description: "The git url of the plugin", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a plugin into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite existing plugin", + isRepeatable: false, + }, + ], + args: [ + { + name: "name", + description: "The name of the plugin\ne.g.: node, ruby", + isOptional: false, + isVariadic: false, + }, + { + name: "path", + description: "The local path to the plugin\ne.g.: ./mise-node", + isOptional: true, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed plugins", + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["ls-remote", "list-remote", "list-all"], + description: "List all available remote plugins", + options: [ + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", + isRepeatable: false, + }, + { + name: ["--only-names"], + description: + 'Only show the name of each plugin by default it will show a "*" next to installed plugins', + isRepeatable: false, + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes a plugin", + options: [ + { + name: ["-p", "--purge"], + description: + "Also remove the plugin's installs, downloads, and cache", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: "Remove all plugins", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to remove", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["update", "up", "upgrade"], + description: "Updates a plugin to the latest version", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\nDefault: 4", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to update", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + ], + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["prune"], + description: "Delete unused versions of tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + { + name: ["--configs"], + description: + "Prune only tracked and trusted configuration links that point to non-existent configurations", + isRepeatable: false, + }, + { + name: ["--tools"], + description: "Prune only unused versions of tools", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Prune only versions from this plugin(s)", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["registry"], + description: "List available tools to install", + args: [ + { + name: "name", + description: "Show only the specified tool's full name", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["reshim"], + description: + "Creates new shims based on bin paths from currently installed tools.", + options: [ + { + name: ["-f", "--force"], + description: "Removes all shims before reshimming", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + { + name: ["self-update"], + description: "Updates mise itself.", + options: [ + { + name: ["-f", "--force"], + description: "Update even if already up to date", + isRepeatable: false, + }, + { + name: ["--no-plugins"], + description: "Disable auto-updating plugins", + isRepeatable: false, + }, + { + name: ["-y", "--yes"], + description: "Skip confirmation prompt", + isRepeatable: false, + }, + ], + args: [ + { + name: "version", + description: "Update to a specific version", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set"], + description: "Set environment variables in mise.toml", + options: [ + { + name: ["--file"], + description: "The TOML file to update", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Set the environment variable in the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "env_vars", + description: + "Environment variable(s) to set\ne.g.: NODE_ENV=production", + isOptional: true, + isVariadic: true, + generators: envVarGenerator, + }, + ], + }, + { + name: ["settings"], + description: "Manage settings", + subcommands: [ + { + name: ["add"], + description: "Adds a setting to the configuration file", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["get"], + description: "Show a current setting", + args: [ + { + name: "setting", + description: "The setting to show", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + ], + }, + { + name: ["ls", "list"], + description: "Show current settings", + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["set", "create"], + description: "Add/update a setting", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears a setting", + args: [ + { + name: "setting", + description: "The setting to remove", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + ], + }, + ], + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["shell", "sh"], + description: "Sets a tool version for the current session.", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-u", "--unset"], + description: "Removes a previously set version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["sync"], + description: "Add tool versions from external tools to mise", + subcommands: [ + { + name: ["node"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--brew"], + description: "Get tool versions from Homebrew", + isRepeatable: false, + }, + { + name: ["--nvm"], + description: "Get tool versions from nvm", + isRepeatable: false, + }, + { + name: ["--nodenv"], + description: "Get tool versions from nodenv", + isRepeatable: false, + }, + ], + }, + { + name: ["python"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--pyenv"], + description: "Get tool versions from pyenv", + isRepeatable: false, + }, + ], + }, + ], + }, + { + name: ["tasks", "t"], + description: "Manage tasks", + subcommands: [ + { + name: ["deps"], + description: "Display a tree visualization of a dependency graph", + options: [ + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--dot"], + description: "Display dependencies in DOT format", + isRepeatable: false, + }, + ], + args: [ + { + name: "tasks", + description: + "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["edit"], + description: "Edit a tasks with $EDITOR", + options: [ + { + name: ["-p", "--path"], + description: + "Display the path to the tasks instead of editing it", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Tasks to edit", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + ], + }, + { + name: ["info"], + description: "Get information about a task", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Name of the task to get information about", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + ], + }, + { + name: ["ls"], + description: + "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.", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: + "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: + "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: + "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", + isOptional: true, + isVariadic: false, + generators: simpleTaskGenerator, + }, + { + name: "args", + description: + 'Arguments to pass to the tasks. Use ":::" to separate tasks', + isOptional: true, + isVariadic: true, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["trust"], + description: "Marks a config file as trusted", + options: [ + { + name: ["-a", "--all"], + description: + "Trust all config files in the current directory and its parents", + isRepeatable: false, + }, + { + name: ["--untrust"], + description: "No longer trust this config", + isRepeatable: false, + }, + { + name: ["--show"], + description: + "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", + isRepeatable: false, + }, + ], + args: [ + { + name: "config_file", + description: "The config file to trust", + isOptional: true, + isVariadic: false, + template: "filepaths", + generators: configPathGenerator, + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes installed tool versions", + options: [ + { + name: ["-a", "--all"], + description: "Delete all installed versions", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + ], + args: [ + { + name: "installed_tool@version", + description: "Tool(s) to remove", + isOptional: true, + isVariadic: true, + generators: installedToolVersionGenerator, + }, + ], + }, + { + name: ["unset"], + description: "Remove environment variable(s) from the config file.", + options: [ + { + name: ["-f", "--file"], + description: "Specify a file to use instead of `mise.toml`", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Use the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "keys", + description: "Environment variable(s) to remove\ne.g.: NODE_ENV", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["upgrade", "up"], + description: "Upgrades outdated tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Just print what would be done, don't actually do it", + isRepeatable: false, + }, + { + name: ["-i", "--interactive"], + description: + "Display multiselect menu to choose which tools to upgrade", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-l", "--bump"], + description: + "Upgrades to the latest version available, bumping the version in mise.toml", + isRepeatable: false, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["use", "u"], + description: "Installs a tool and adds the version it to mise.toml.", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["--fuzzy"], + description: "Save fuzzy version to config file", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", + isRepeatable: false, + }, + { + name: ["-e", "--env"], + description: + "Modify an environment-specific config file like .mise..toml", + isRepeatable: false, + args: { + name: "env", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", + isRepeatable: false, + }, + { + name: ["--remove"], + description: "Remove the plugin(s) from config file", + isRepeatable: true, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + }, + { + name: ["-p", "--path"], + description: "Specify a path to a config file or directory", + isRepeatable: false, + args: { + name: "path", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["--pin"], + description: + "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to add to config file", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["version", "v"], + description: "Display the version of mise", + }, + { + name: ["watch", "w"], + description: "Run task(s) and watch for changes to rerun it", + options: [ + { + name: ["-t", "--task"], + description: "Tasks to run", + isRepeatable: true, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + }, + { + name: ["-g", "--glob"], + description: "Files to watch\nDefaults to sources from the tasks(s)", + isRepeatable: true, + args: { + name: "glob", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "args", + description: "Extra arguments", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["where"], + description: "Display the installation path for a tool", + args: [ + { + name: "tool@version", + description: + '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', + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["which"], + description: "Shows the path that a tool's bin points to.", + options: [ + { + name: ["--plugin"], + description: "Show the plugin name instead of the path", + isRepeatable: false, + }, + { + name: ["--version"], + description: "Show the version instead of the path", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: + "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", + isRepeatable: false, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + }, + ], + args: [ + { + name: "bin_name", + description: "The bin to look up", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["-C", "--cd"], + description: "Change directory before running command", + isRepeatable: false, + args: { + name: "dir", + isOptional: false, + isVariadic: false, + template: "folders", + }, + }, + { + name: ["-P", "--profile"], + description: "Set the profile (environment)", + isRepeatable: false, + args: { + name: "profile", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show extra output (use -vv for even more)", + isRepeatable: true, + }, + { + name: ["-y", "--yes"], + description: "Answer yes to all confirmation prompts", + isRepeatable: false, + }, + ], +}; +export default completionSpec; From 8a00b889996fc72f3eda5f40b912a5ce24531f0d Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Sun, 10 Nov 2024 20:37:56 +0000 Subject: [PATCH 09/14] Remove autogenerated file --- tasks/fig/src/mise.ts | 4361 ----------------------------------------- 1 file changed, 4361 deletions(-) delete mode 100644 tasks/fig/src/mise.ts diff --git a/tasks/fig/src/mise.ts b/tasks/fig/src/mise.ts deleted file mode 100644 index 5be619f587..0000000000 --- a/tasks/fig/src/mise.ts +++ /dev/null @@ -1,4361 +0,0 @@ -const usageGenerateSpec = (cmds: string[]) => { - return async ( - context: string[], - executeCommand: Fig.ExecuteCommandFunction, - ): Promise => { - const promises = cmds.map(async (cmd): Promise => { - try { - const args = cmd.split(" "); - const { - stdout, - stderr: cmdStderr, - status: cmdStatus, - } = await executeCommand({ - command: args[0], - args: args.splice(1), - }); - if (cmdStatus !== 0) { - return [{ name: "error", description: cmdStderr }]; - } - const { - stdout: figSpecOut, - stderr: figSpecStderr, - status: usageFigStatus, - } = await executeCommand({ - command: "usage", - args: ["g", "fig", "--spec", stdout], - }); - if (usageFigStatus !== 0) { - return [{ name: "error", description: figSpecStderr }]; - } - - const start_of_json = figSpecOut.indexOf("{"); - const j = figSpecOut.slice(start_of_json); - return JSON.parse(j).subcommands as Fig.Subcommand[]; - } catch (e) { - return [{ name: "error", description: e }] as Fig.Subcommand[]; - } - }); - - // eslint-disable-next-line compat/compat - const results = await Promise.allSettled(promises); - const subcommands = results - .filter((p) => p.status === "fulfilled") - .map((p) => p.value); - const failed = results - .filter((p) => p.status === "rejected") - .map((p) => ({ name: "error", description: p.reason })); - - return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; - }; -}; - -const completionGeneratorTemplate = ( - argSuggestionBash: string, -): Fig.Generator => { - return { - custom: async (tokens: string[], executeCommand) => { - let arg = argSuggestionBash; - if (tokens.length >= 1) { - arg = argSuggestionBash.replace( - "{{words[CURRENT]}}", - tokens[tokens.length - 1], - ); - } - - if (tokens.length >= 2) { - arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); - } - const { stdout: text } = await executeCommand({ - command: "sh", - args: ["-c", arg], - }); - if (text.trim().length == 0) return []; - return text.split("\n").map((elm) => ({ name: elm })); - }, - }; -}; - -const completionSpec: Fig.Spec = { - name: ["mise"], - subcommands: [ - { - name: ["activate"], - description: "Initializes mise in the current shell session", - options: [ - { - name: ["--shims"], - description: - "Use shims instead of modifying PATH\nEffectively the same as:", - isRepeatable: false, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - ], - args: [ - { - name: "shell_type", - description: "Shell type to generate the script for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - ], - }, - { - name: ["alias", "a"], - description: "Manage aliases", - subcommands: [ - { - name: ["get"], - description: "Show an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to show the alias for", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - { - name: "alias", - description: "The alias to show", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise alias ls {{words[PREV]}} | awk '{print $2}'`, - ), - }, - ], - }, - { - name: ["ls", "list"], - description: - "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", - options: [ - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool", - description: "Show aliases for ", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set", "add", "create"], - description: "Add/update an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to set the alias for", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - { - name: "alias", - description: "The alias to set", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise alias ls {{words[PREV]}} | awk '{print $2}'`, - ), - }, - { - name: "value", - description: "The value to set the alias to", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to remove the alias from", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - { - name: "alias", - description: "The alias to remove", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise alias ls {{words[PREV]}} | awk '{print $2}'`, - ), - }, - ], - }, - ], - options: [ - { - name: ["-p", "--plugin"], - description: "filter aliases by plugin", - isRepeatable: false, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - }, - { - name: ["backends", "b"], - description: "Manage backends", - subcommands: [ - { - name: ["ls", "list"], - description: "List built-in backends", - }, - ], - }, - { - name: ["bin-paths"], - description: "List all the active runtime bin paths", - }, - { - name: ["cache"], - description: "Manage the mise cache", - subcommands: [ - { - name: ["clear", "c"], - description: "Deletes all cache files in mise", - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - ], - }, - { - name: ["prune", "p"], - description: "Removes stale mise cache files", - options: [ - { - name: ["--dry-run"], - description: "Just show what would be pruned", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show pruned files", - isRepeatable: true, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - ], - }, - ], - }, - { - name: ["completion"], - description: "Generate shell completions", - args: [ - { - name: "shell", - description: "Shell type to generate completions for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "fish", "zsh"], - }, - ], - }, - { - name: ["config", "cfg"], - description: "Manage config files", - subcommands: [ - { - name: ["generate", "g"], - description: "[experimental] Generate a mise.toml file", - options: [ - { - name: ["-o", "--output"], - description: "Output to file instead of stdout", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - ], - }, - { - name: ["get"], - description: "Display the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["ls"], - description: "List config files currently in use", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["set"], - description: "Set the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-t", "--type"], - isRepeatable: false, - args: { - name: "type", - isOptional: false, - isVariadic: false, - suggestions: [ - "infer", - "string", - "integer", - "float", - "bool", - "list", - ], - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: false, - isVariadic: false, - }, - { - name: "value", - description: "The value to set the key to", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["deactivate"], - description: "Disable mise for current shell session", - }, - { - name: ["direnv"], - description: "Output direnv function to use mise inside direnv", - subcommands: [ - { - name: ["activate"], - description: "Output direnv function to use mise inside direnv", - }, - ], - }, - { - name: ["doctor", "dr"], - description: "Check mise installation for possible problems", - }, - { - name: ["env", "e"], - description: "Exports env vars to activate mise a single time", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-s", "--shell"], - description: "Shell type to generate environment variables for", - isRepeatable: false, - args: { - name: "shell", - isOptional: false, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["exec", "x"], - description: "Execute a command with tool(s) set", - options: [ - { - name: ["-c", "--command"], - description: "Command string to execute", - isRepeatable: false, - args: { - name: "c", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to start e.g.: node@20 python@3.10", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - { - name: "command", - description: "Command string to execute (same as --command)", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["generate", "g"], - description: "[experimental] Generate files for various tools/services", - subcommands: [ - { - name: ["git-pre-commit", "pre-commit"], - description: "[experimental] Generate a git pre-commit hook", - options: [ - { - name: ["--hook"], - description: "Which hook to generate (saves to .git/hooks/$hook)", - isRepeatable: false, - args: { - name: "hook", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: - "The task to run when the pre-commit hook is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - }, - { - name: ["-w", "--write"], - description: - "write to .git/hooks/pre-commit and make it executable", - isRepeatable: false, - }, - ], - }, - { - name: ["github-action"], - description: "[experimental] Generate a GitHub Action workflow file", - options: [ - { - name: ["-n", "--name"], - description: "the name of the workflow to generate", - isRepeatable: false, - args: { - name: "name", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: "The task to run when the workflow is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - }, - { - name: ["-w", "--write"], - description: "write to .github/workflows/$name.yml", - isRepeatable: false, - }, - ], - }, - { - name: ["task-docs"], - description: "Generate documentation for tasks in a project", - options: [ - { - name: ["-I", "--index"], - description: - "write only an index of tasks, intended for use with `--multi`", - isRepeatable: false, - }, - { - name: ["-i", "--inject"], - description: "inserts the documentation into an existing file", - isRepeatable: false, - }, - { - name: ["-m", "--multi"], - description: - "render each task as a separate document, requires `--output` to be a directory", - isRepeatable: false, - }, - { - name: ["-o", "--output"], - description: "writes the generated docs to a file/directory", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--root"], - description: "root directory to search for tasks", - isRepeatable: false, - args: { - name: "root", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-s", "--style"], - isRepeatable: false, - args: { - name: "style", - isOptional: false, - isVariadic: false, - suggestions: ["simple", "detailed"], - }, - }, - ], - }, - ], - }, - { - name: ["implode"], - description: "Removes mise CLI and all related data", - options: [ - { - name: ["--config"], - description: "Also remove config directory", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: - "List directories that would be removed without actually removing them", - isRepeatable: false, - }, - ], - }, - { - name: ["install", "i"], - description: "Install a tool version", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to install e.g.: node@20", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["latest"], - description: "Gets the latest available version for a plugin", - options: [ - { - name: ["-i", "--installed"], - description: "Show latest installed instead of available version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool to get the latest version of", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a tool version into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite an existing tool version if it exists", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool name and version to create a symlink for", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - { - name: "path", - description: - "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed and active tool versions", - options: [ - { - name: ["-c", "--current"], - description: - "Only show tool versions currently specified in a mise.toml", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Only show tool versions currently specified in the global mise.toml", - isRepeatable: false, - }, - { - name: ["-i", "--installed"], - description: - "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", - isRepeatable: false, - }, - { - name: ["-o", "--offline"], - description: "Don't fetch information such as outdated versions", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-m", "--missing"], - description: "Display missing tool versions", - isRepeatable: false, - }, - { - name: ["--prefix"], - description: "Display versions matching this prefix", - isRepeatable: false, - args: { - name: "prefix", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - }, - { - name: ["--no-header"], - description: "Don't display headers", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Only show tool versions from [PLUGIN]", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(`mise plugins --core --user`), - }, - ], - }, - { - name: ["ls-remote"], - description: "List runtime versions available for install.", - options: [ - { - name: ["--all"], - description: "Show all installed plugins and versions", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Plugin to get versions for", - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - { - name: "prefix", - description: - 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - ], - }, - { - name: ["outdated"], - description: "Shows outdated tool versions", - options: [ - { - name: ["-l", "--bump"], - description: - "Compares against the latest versions available, not what matches the current config", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "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", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["plugins", "p"], - description: "Manage plugins", - subcommands: [ - { - name: ["install", "i", "a", "add"], - description: "Install a plugin", - options: [ - { - name: ["-f", "--force"], - description: "Reinstall even if plugin exists", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: - "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "new_plugin", - description: - "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate(`mise plugins --all`), - }, - { - name: "git_url", - description: "The git url of the plugin", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a plugin into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite existing plugin", - isRepeatable: false, - }, - ], - args: [ - { - name: "name", - description: "The name of the plugin\ne.g.: node, ruby", - isOptional: false, - isVariadic: false, - }, - { - name: "path", - description: "The local path to the plugin\ne.g.: ./mise-node", - isOptional: true, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed plugins", - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["ls-remote", "list-remote", "list-all"], - description: "List all available remote plugins", - options: [ - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", - isRepeatable: false, - }, - { - name: ["--only-names"], - description: - 'Only show the name of each plugin by default it will show a "*" next to installed plugins', - isRepeatable: false, - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes a plugin", - options: [ - { - name: ["-p", "--purge"], - description: - "Also remove the plugin's installs, downloads, and cache", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: "Remove all plugins", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to remove", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - ], - }, - { - name: ["update", "up", "upgrade"], - description: "Updates a plugin to the latest version", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\nDefault: 4", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to update", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - ], - }, - ], - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["prune"], - description: "Delete unused versions of tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - { - name: ["--configs"], - description: - "Prune only tracked and trusted configuration links that point to non-existent configurations", - isRepeatable: false, - }, - { - name: ["--tools"], - description: "Prune only unused versions of tools", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Prune only versions from this plugin(s)", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(`mise plugins --core --user`), - }, - ], - }, - { - name: ["registry"], - description: "List available tools to install", - args: [ - { - name: "name", - description: "Show only the specified tool's full name", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["reshim"], - description: - "Creates new shims based on bin paths from currently installed tools.", - options: [ - { - name: ["-f", "--force"], - description: "Removes all shims before reshimming", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - { - name: ["self-update"], - description: "Updates mise itself.", - options: [ - { - name: ["-f", "--force"], - description: "Update even if already up to date", - isRepeatable: false, - }, - { - name: ["--no-plugins"], - description: "Disable auto-updating plugins", - isRepeatable: false, - }, - { - name: ["-y", "--yes"], - description: "Skip confirmation prompt", - isRepeatable: false, - }, - ], - args: [ - { - name: "version", - description: "Update to a specific version", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set"], - description: "Set environment variables in mise.toml", - options: [ - { - name: ["--file"], - description: "The TOML file to update", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Set the environment variable in the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "env_vars", - description: - "Environment variable(s) to set\ne.g.: NODE_ENV=production", - isOptional: true, - isVariadic: true, - generators: envVarGenerator, - }, - ], - }, - { - name: ["settings"], - description: "Manage settings", - subcommands: [ - { - name: ["add"], - description: "Adds a setting to the configuration file", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(`mise settings --keys`), - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["get"], - description: "Show a current setting", - args: [ - { - name: "setting", - description: "The setting to show", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(`mise settings --keys`), - }, - ], - }, - { - name: ["ls", "list"], - description: "Show current settings", - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["set", "create"], - description: "Add/update a setting", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(`mise settings --keys`), - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears a setting", - args: [ - { - name: "setting", - description: "The setting to remove", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(`mise settings --keys`), - }, - ], - }, - ], - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["shell", "sh"], - description: "Sets a tool version for the current session.", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-u", "--unset"], - description: "Removes a previously set version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["sync"], - description: "Add tool versions from external tools to mise", - subcommands: [ - { - name: ["node"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--brew"], - description: "Get tool versions from Homebrew", - isRepeatable: false, - }, - { - name: ["--nvm"], - description: "Get tool versions from nvm", - isRepeatable: false, - }, - { - name: ["--nodenv"], - description: "Get tool versions from nodenv", - isRepeatable: false, - }, - ], - }, - { - name: ["python"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--pyenv"], - description: "Get tool versions from pyenv", - isRepeatable: false, - }, - ], - }, - ], - }, - { - name: ["tasks", "t"], - description: "Manage tasks", - subcommands: [ - { - name: ["deps"], - description: "Display a tree visualization of a dependency graph", - options: [ - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--dot"], - description: "Display dependencies in DOT format", - isRepeatable: false, - }, - ], - args: [ - { - name: "tasks", - description: - "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["edit"], - description: "Edit a tasks with $EDITOR", - options: [ - { - name: ["-p", "--path"], - description: - "Display the path to the tasks instead of editing it", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Tasks to edit", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - ], - }, - { - name: ["info"], - description: "Get information about a task", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Name of the task to get information about", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - ], - }, - { - name: ["ls"], - description: - "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.", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: - "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: - "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: - "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - { - name: "args", - description: - 'Arguments to pass to the tasks. Use ":::" to separate tasks', - isOptional: true, - isVariadic: true, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["trust"], - description: "Marks a config file as trusted", - options: [ - { - name: ["-a", "--all"], - description: - "Trust all config files in the current directory and its parents", - isRepeatable: false, - }, - { - name: ["--untrust"], - description: "No longer trust this config", - isRepeatable: false, - }, - { - name: ["--show"], - description: - "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", - isRepeatable: false, - }, - ], - args: [ - { - name: "config_file", - description: "The config file to trust", - isOptional: true, - isVariadic: false, - template: "filepaths", - generators: completionGeneratorTemplate(``), - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes installed tool versions", - options: [ - { - name: ["-a", "--all"], - description: "Delete all installed versions", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - ], - args: [ - { - name: "installed_tool@version", - description: "Tool(s) to remove", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - if [ ! -z "$prefix" ]; then - prefix="--prefix $prefix" - fi - versions=$(mise ls --installed $tool $prefix | awk '{print $2}' | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise ls --installed | awk '{print $1}' | sed '1!G;h;$!d') - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["unset"], - description: "Remove environment variable(s) from the config file.", - options: [ - { - name: ["-f", "--file"], - description: "Specify a file to use instead of `mise.toml`", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Use the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "keys", - description: "Environment variable(s) to remove\ne.g.: NODE_ENV", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["upgrade", "up"], - description: "Upgrades outdated tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Just print what would be done, don't actually do it", - isRepeatable: false, - }, - { - name: ["-i", "--interactive"], - description: - "Display multiselect menu to choose which tools to upgrade", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-l", "--bump"], - description: - "Upgrades to the latest version available, bumping the version in mise.toml", - isRepeatable: false, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["use", "u"], - description: "Installs a tool and adds the version it to mise.toml.", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["--fuzzy"], - description: "Save fuzzy version to config file", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", - isRepeatable: false, - }, - { - name: ["-e", "--env"], - description: - "Modify an environment-specific config file like .mise..toml", - isRepeatable: false, - args: { - name: "env", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", - isRepeatable: false, - }, - { - name: ["--remove"], - description: "Remove the plugin(s) from config file", - isRepeatable: true, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - }, - { - name: ["-p", "--path"], - description: "Specify a path to a config file or directory", - isRepeatable: false, - args: { - name: "path", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["--pin"], - description: - "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to add to config file", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["version", "v"], - description: "Display the version of mise", - }, - { - name: ["watch", "w"], - description: "Run task(s) and watch for changes to rerun it", - options: [ - { - name: ["-t", "--task"], - description: "Tasks to run", - isRepeatable: true, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - }, - { - name: ["-g", "--glob"], - description: "Files to watch\nDefaults to sources from the tasks(s)", - isRepeatable: true, - args: { - name: "glob", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "args", - description: "Extra arguments", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["where"], - description: "Display the installation path for a tool", - args: [ - { - name: "tool@version", - description: - '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', - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["which"], - description: "Shows the path that a tool's bin points to.", - options: [ - { - name: ["--plugin"], - description: "Show the plugin name instead of the path", - isRepeatable: false, - }, - { - name: ["--version"], - description: "Show the version instead of the path", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: - "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", - isRepeatable: false, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - }, - ], - args: [ - { - name: "bin_name", - description: "The bin to look up", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["-C", "--cd"], - description: "Change directory before running command", - isRepeatable: false, - args: { - name: "dir", - isOptional: false, - isVariadic: false, - template: "folders", - }, - }, - { - name: ["-P", "--profile"], - description: "Set the profile (environment)", - isRepeatable: false, - args: { - name: "profile", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show extra output (use -vv for even more)", - isRepeatable: true, - }, - { - name: ["-y", "--yes"], - description: "Answer yes to all confirmation prompts", - isRepeatable: false, - }, - ], -}; - -export default completionSpec; - -const usageGenerateSpec = (cmds: string[]) => { - return async ( - context: string[], - executeCommand: Fig.ExecuteCommandFunction, - ): Promise => { - const promises = cmds.map(async (cmd): Promise => { - try { - const args = cmd.split(" "); - const { - stdout, - stderr: cmdStderr, - status: cmdStatus, - } = await executeCommand({ - command: args[0], - args: args.splice(1), - }); - if (cmdStatus !== 0) { - return [{ name: "error", description: cmdStderr }]; - } - const { - stdout: figSpecOut, - stderr: figSpecStderr, - status: usageFigStatus, - } = await executeCommand({ - command: "usage", - args: ["g", "fig", "--spec", stdout], - }); - if (usageFigStatus !== 0) { - return [{ name: "error", description: figSpecStderr }]; - } - const start_of_json = figSpecOut.indexOf("{"); - const j = figSpecOut.slice(start_of_json); - return JSON.parse(j).subcommands as Fig.Subcommand[]; - } catch (e) { - return [{ name: "error", description: e }] as Fig.Subcommand[]; - } - }); - // eslint-disable-next-line compat/compat - const results = await Promise.allSettled(promises); - const subcommands = results - .filter((p) => p.status === "fulfilled") - .map((p) => p.value); - const failed = results - .filter((p) => p.status === "rejected") - .map((p) => ({ name: "error", description: p.reason })); - return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; - }; -}; -const completionGeneratorTemplate = ( - argSuggestionBash: string, -): Fig.Generator => { - return { - custom: async (tokens: string[], executeCommand) => { - let arg = argSuggestionBash; - if (tokens.length >= 1) { - arg = argSuggestionBash.replace( - "{{words[CURRENT]}}", - tokens[tokens.length - 1], - ); - } - if (tokens.length >= 2) { - arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); - } - const { stdout: text } = await executeCommand({ - command: "sh", - args: ["-c", arg], - }); - if (text.trim().length == 0) return []; - return text.split("\n").map((elm) => ({ name: elm })); - }, - }; -}; -const completionSpec: Fig.Spec = { - name: ["mise"], - subcommands: [ - { - name: ["activate"], - description: "Initializes mise in the current shell session", - options: [ - { - name: ["--shims"], - description: - "Use shims instead of modifying PATH\nEffectively the same as:", - isRepeatable: false, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - ], - args: [ - { - name: "shell_type", - description: "Shell type to generate the script for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - ], - }, - { - name: ["alias", "a"], - description: "Manage aliases", - subcommands: [ - { - name: ["get"], - description: "Show an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to show the alias for", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - { - name: "alias", - description: "The alias to show", - isOptional: false, - isVariadic: false, - generators: aliasGenerator, - }, - ], - }, - { - name: ["ls", "list"], - description: - "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", - options: [ - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool", - description: "Show aliases for ", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set", "add", "create"], - description: "Add/update an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to set the alias for", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - { - name: "alias", - description: "The alias to set", - isOptional: false, - isVariadic: false, - generators: aliasGenerator, - }, - { - name: "value", - description: "The value to set the alias to", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to remove the alias from", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - { - name: "alias", - description: "The alias to remove", - isOptional: false, - isVariadic: false, - generators: aliasGenerator, - }, - ], - }, - ], - options: [ - { - name: ["-p", "--plugin"], - description: "filter aliases by plugin", - isRepeatable: false, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - }, - { - name: ["backends", "b"], - description: "Manage backends", - subcommands: [ - { - name: ["ls", "list"], - description: "List built-in backends", - }, - ], - }, - { - name: ["bin-paths"], - description: "List all the active runtime bin paths", - }, - { - name: ["cache"], - description: "Manage the mise cache", - subcommands: [ - { - name: ["clear", "c"], - description: "Deletes all cache files in mise", - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["prune", "p"], - description: "Removes stale mise cache files", - options: [ - { - name: ["--dry-run"], - description: "Just show what would be pruned", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show pruned files", - isRepeatable: true, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - ], - }, - { - name: ["completion"], - description: "Generate shell completions", - args: [ - { - name: "shell", - description: "Shell type to generate completions for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "fish", "zsh"], - }, - ], - }, - { - name: ["config", "cfg"], - description: "Manage config files", - subcommands: [ - { - name: ["generate", "g"], - description: "[experimental] Generate a mise.toml file", - options: [ - { - name: ["-o", "--output"], - description: "Output to file instead of stdout", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - ], - }, - { - name: ["get"], - description: "Display the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["ls"], - description: "List config files currently in use", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["set"], - description: "Set the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-t", "--type"], - isRepeatable: false, - args: { - name: "type", - isOptional: false, - isVariadic: false, - suggestions: [ - "infer", - "string", - "integer", - "float", - "bool", - "list", - ], - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: false, - isVariadic: false, - }, - { - name: "value", - description: "The value to set the key to", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["deactivate"], - description: "Disable mise for current shell session", - }, - { - name: ["direnv"], - description: "Output direnv function to use mise inside direnv", - subcommands: [ - { - name: ["activate"], - description: "Output direnv function to use mise inside direnv", - }, - ], - }, - { - name: ["doctor", "dr"], - description: "Check mise installation for possible problems", - }, - { - name: ["env", "e"], - description: "Exports env vars to activate mise a single time", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-s", "--shell"], - description: "Shell type to generate environment variables for", - isRepeatable: false, - args: { - name: "shell", - isOptional: false, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["exec", "x"], - description: "Execute a command with tool(s) set", - options: [ - { - name: ["-c", "--command"], - description: "Command string to execute", - isRepeatable: false, - args: { - name: "c", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to start e.g.: node@20 python@3.10", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - { - name: "command", - description: "Command string to execute (same as --command)", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["generate", "g"], - description: "[experimental] Generate files for various tools/services", - subcommands: [ - { - name: ["git-pre-commit", "pre-commit"], - description: "[experimental] Generate a git pre-commit hook", - options: [ - { - name: ["--hook"], - description: "Which hook to generate (saves to .git/hooks/$hook)", - isRepeatable: false, - args: { - name: "hook", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: - "The task to run when the pre-commit hook is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - }, - { - name: ["-w", "--write"], - description: - "write to .git/hooks/pre-commit and make it executable", - isRepeatable: false, - }, - ], - }, - { - name: ["github-action"], - description: "[experimental] Generate a GitHub Action workflow file", - options: [ - { - name: ["-n", "--name"], - description: "the name of the workflow to generate", - isRepeatable: false, - args: { - name: "name", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: "The task to run when the workflow is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - }, - { - name: ["-w", "--write"], - description: "write to .github/workflows/$name.yml", - isRepeatable: false, - }, - ], - }, - { - name: ["task-docs"], - description: "Generate documentation for tasks in a project", - options: [ - { - name: ["-I", "--index"], - description: - "write only an index of tasks, intended for use with `--multi`", - isRepeatable: false, - }, - { - name: ["-i", "--inject"], - description: "inserts the documentation into an existing file", - isRepeatable: false, - }, - { - name: ["-m", "--multi"], - description: - "render each task as a separate document, requires `--output` to be a directory", - isRepeatable: false, - }, - { - name: ["-o", "--output"], - description: "writes the generated docs to a file/directory", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--root"], - description: "root directory to search for tasks", - isRepeatable: false, - args: { - name: "root", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-s", "--style"], - isRepeatable: false, - args: { - name: "style", - isOptional: false, - isVariadic: false, - suggestions: ["simple", "detailed"], - }, - }, - ], - }, - ], - }, - { - name: ["implode"], - description: "Removes mise CLI and all related data", - options: [ - { - name: ["--config"], - description: "Also remove config directory", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: - "List directories that would be removed without actually removing them", - isRepeatable: false, - }, - ], - }, - { - name: ["install", "i"], - description: "Install a tool version", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to install e.g.: node@20", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["latest"], - description: "Gets the latest available version for a plugin", - options: [ - { - name: ["-i", "--installed"], - description: "Show latest installed instead of available version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool to get the latest version of", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a tool version into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite an existing tool version if it exists", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool name and version to create a symlink for", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - { - name: "path", - description: - "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed and active tool versions", - options: [ - { - name: ["-c", "--current"], - description: - "Only show tool versions currently specified in a mise.toml", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Only show tool versions currently specified in the global mise.toml", - isRepeatable: false, - }, - { - name: ["-i", "--installed"], - description: - "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", - isRepeatable: false, - }, - { - name: ["-o", "--offline"], - description: "Don't fetch information such as outdated versions", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-m", "--missing"], - description: "Display missing tool versions", - isRepeatable: false, - }, - { - name: ["--prefix"], - description: "Display versions matching this prefix", - isRepeatable: false, - args: { - name: "prefix", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - }, - { - name: ["--no-header"], - description: "Don't display headers", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Only show tool versions from [PLUGIN]", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["ls-remote"], - description: "List runtime versions available for install.", - options: [ - { - name: ["--all"], - description: "Show all installed plugins and versions", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Plugin to get versions for", - isOptional: true, - isVariadic: false, - generators: toolVersionGenerator, - }, - { - name: "prefix", - description: - 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - ], - }, - { - name: ["outdated"], - description: "Shows outdated tool versions", - options: [ - { - name: ["-l", "--bump"], - description: - "Compares against the latest versions available, not what matches the current config", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "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", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["plugins", "p"], - description: "Manage plugins", - subcommands: [ - { - name: ["install", "i", "a", "add"], - description: "Install a plugin", - options: [ - { - name: ["-f", "--force"], - description: "Reinstall even if plugin exists", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: - "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "new_plugin", - description: - "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate(`mise plugins --all`), - }, - { - name: "git_url", - description: "The git url of the plugin", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a plugin into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite existing plugin", - isRepeatable: false, - }, - ], - args: [ - { - name: "name", - description: "The name of the plugin\ne.g.: node, ruby", - isOptional: false, - isVariadic: false, - }, - { - name: "path", - description: "The local path to the plugin\ne.g.: ./mise-node", - isOptional: true, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed plugins", - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["ls-remote", "list-remote", "list-all"], - description: "List all available remote plugins", - options: [ - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", - isRepeatable: false, - }, - { - name: ["--only-names"], - description: - 'Only show the name of each plugin by default it will show a "*" next to installed plugins', - isRepeatable: false, - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes a plugin", - options: [ - { - name: ["-p", "--purge"], - description: - "Also remove the plugin's installs, downloads, and cache", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: "Remove all plugins", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to remove", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["update", "up", "upgrade"], - description: "Updates a plugin to the latest version", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\nDefault: 4", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to update", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - ], - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["prune"], - description: "Delete unused versions of tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - { - name: ["--configs"], - description: - "Prune only tracked and trusted configuration links that point to non-existent configurations", - isRepeatable: false, - }, - { - name: ["--tools"], - description: "Prune only unused versions of tools", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Prune only versions from this plugin(s)", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["registry"], - description: "List available tools to install", - args: [ - { - name: "name", - description: "Show only the specified tool's full name", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["reshim"], - description: - "Creates new shims based on bin paths from currently installed tools.", - options: [ - { - name: ["-f", "--force"], - description: "Removes all shims before reshimming", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - { - name: ["self-update"], - description: "Updates mise itself.", - options: [ - { - name: ["-f", "--force"], - description: "Update even if already up to date", - isRepeatable: false, - }, - { - name: ["--no-plugins"], - description: "Disable auto-updating plugins", - isRepeatable: false, - }, - { - name: ["-y", "--yes"], - description: "Skip confirmation prompt", - isRepeatable: false, - }, - ], - args: [ - { - name: "version", - description: "Update to a specific version", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set"], - description: "Set environment variables in mise.toml", - options: [ - { - name: ["--file"], - description: "The TOML file to update", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Set the environment variable in the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "env_vars", - description: - "Environment variable(s) to set\ne.g.: NODE_ENV=production", - isOptional: true, - isVariadic: true, - generators: envVarGenerator, - }, - ], - }, - { - name: ["settings"], - description: "Manage settings", - subcommands: [ - { - name: ["add"], - description: "Adds a setting to the configuration file", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["get"], - description: "Show a current setting", - args: [ - { - name: "setting", - description: "The setting to show", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - ], - }, - { - name: ["ls", "list"], - description: "Show current settings", - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["set", "create"], - description: "Add/update a setting", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears a setting", - args: [ - { - name: "setting", - description: "The setting to remove", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - ], - }, - ], - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["shell", "sh"], - description: "Sets a tool version for the current session.", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-u", "--unset"], - description: "Removes a previously set version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["sync"], - description: "Add tool versions from external tools to mise", - subcommands: [ - { - name: ["node"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--brew"], - description: "Get tool versions from Homebrew", - isRepeatable: false, - }, - { - name: ["--nvm"], - description: "Get tool versions from nvm", - isRepeatable: false, - }, - { - name: ["--nodenv"], - description: "Get tool versions from nodenv", - isRepeatable: false, - }, - ], - }, - { - name: ["python"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--pyenv"], - description: "Get tool versions from pyenv", - isRepeatable: false, - }, - ], - }, - ], - }, - { - name: ["tasks", "t"], - description: "Manage tasks", - subcommands: [ - { - name: ["deps"], - description: "Display a tree visualization of a dependency graph", - options: [ - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--dot"], - description: "Display dependencies in DOT format", - isRepeatable: false, - }, - ], - args: [ - { - name: "tasks", - description: - "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["edit"], - description: "Edit a tasks with $EDITOR", - options: [ - { - name: ["-p", "--path"], - description: - "Display the path to the tasks instead of editing it", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Tasks to edit", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - ], - }, - { - name: ["info"], - description: "Get information about a task", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Name of the task to get information about", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - ], - }, - { - name: ["ls"], - description: - "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.", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: - "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: - "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: - "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", - isOptional: true, - isVariadic: false, - generators: simpleTaskGenerator, - }, - { - name: "args", - description: - 'Arguments to pass to the tasks. Use ":::" to separate tasks', - isOptional: true, - isVariadic: true, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["trust"], - description: "Marks a config file as trusted", - options: [ - { - name: ["-a", "--all"], - description: - "Trust all config files in the current directory and its parents", - isRepeatable: false, - }, - { - name: ["--untrust"], - description: "No longer trust this config", - isRepeatable: false, - }, - { - name: ["--show"], - description: - "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", - isRepeatable: false, - }, - ], - args: [ - { - name: "config_file", - description: "The config file to trust", - isOptional: true, - isVariadic: false, - template: "filepaths", - generators: configPathGenerator, - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes installed tool versions", - options: [ - { - name: ["-a", "--all"], - description: "Delete all installed versions", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - ], - args: [ - { - name: "installed_tool@version", - description: "Tool(s) to remove", - isOptional: true, - isVariadic: true, - generators: installedToolVersionGenerator, - }, - ], - }, - { - name: ["unset"], - description: "Remove environment variable(s) from the config file.", - options: [ - { - name: ["-f", "--file"], - description: "Specify a file to use instead of `mise.toml`", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Use the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "keys", - description: "Environment variable(s) to remove\ne.g.: NODE_ENV", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["upgrade", "up"], - description: "Upgrades outdated tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Just print what would be done, don't actually do it", - isRepeatable: false, - }, - { - name: ["-i", "--interactive"], - description: - "Display multiselect menu to choose which tools to upgrade", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-l", "--bump"], - description: - "Upgrades to the latest version available, bumping the version in mise.toml", - isRepeatable: false, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["use", "u"], - description: "Installs a tool and adds the version it to mise.toml.", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["--fuzzy"], - description: "Save fuzzy version to config file", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", - isRepeatable: false, - }, - { - name: ["-e", "--env"], - description: - "Modify an environment-specific config file like .mise..toml", - isRepeatable: false, - args: { - name: "env", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", - isRepeatable: false, - }, - { - name: ["--remove"], - description: "Remove the plugin(s) from config file", - isRepeatable: true, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - }, - { - name: ["-p", "--path"], - description: "Specify a path to a config file or directory", - isRepeatable: false, - args: { - name: "path", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["--pin"], - description: - "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to add to config file", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["version", "v"], - description: "Display the version of mise", - }, - { - name: ["watch", "w"], - description: "Run task(s) and watch for changes to rerun it", - options: [ - { - name: ["-t", "--task"], - description: "Tasks to run", - isRepeatable: true, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - }, - { - name: ["-g", "--glob"], - description: "Files to watch\nDefaults to sources from the tasks(s)", - isRepeatable: true, - args: { - name: "glob", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "args", - description: "Extra arguments", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["where"], - description: "Display the installation path for a tool", - args: [ - { - name: "tool@version", - description: - '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', - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["which"], - description: "Shows the path that a tool's bin points to.", - options: [ - { - name: ["--plugin"], - description: "Show the plugin name instead of the path", - isRepeatable: false, - }, - { - name: ["--version"], - description: "Show the version instead of the path", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: - "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", - isRepeatable: false, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - }, - ], - args: [ - { - name: "bin_name", - description: "The bin to look up", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["-C", "--cd"], - description: "Change directory before running command", - isRepeatable: false, - args: { - name: "dir", - isOptional: false, - isVariadic: false, - template: "folders", - }, - }, - { - name: ["-P", "--profile"], - description: "Set the profile (environment)", - isRepeatable: false, - args: { - name: "profile", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show extra output (use -vv for even more)", - isRepeatable: true, - }, - { - name: ["-y", "--yes"], - description: "Answer yes to all confirmation prompts", - isRepeatable: false, - }, - ], -}; -export default completionSpec; From d00ef833983b3fa942198962aab855025e955001 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 20:41:57 +0000 Subject: [PATCH 10/14] [autofix.ci] apply automated fixes --- tasks/fig/src/mise.ts | 4361 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4361 insertions(+) create mode 100644 tasks/fig/src/mise.ts diff --git a/tasks/fig/src/mise.ts b/tasks/fig/src/mise.ts new file mode 100644 index 0000000000..5be619f587 --- /dev/null +++ b/tasks/fig/src/mise.ts @@ -0,0 +1,4361 @@ +const usageGenerateSpec = (cmds: string[]) => { + return async ( + context: string[], + executeCommand: Fig.ExecuteCommandFunction, + ): Promise => { + const promises = cmds.map(async (cmd): Promise => { + try { + const args = cmd.split(" "); + const { + stdout, + stderr: cmdStderr, + status: cmdStatus, + } = await executeCommand({ + command: args[0], + args: args.splice(1), + }); + if (cmdStatus !== 0) { + return [{ name: "error", description: cmdStderr }]; + } + const { + stdout: figSpecOut, + stderr: figSpecStderr, + status: usageFigStatus, + } = await executeCommand({ + command: "usage", + args: ["g", "fig", "--spec", stdout], + }); + if (usageFigStatus !== 0) { + return [{ name: "error", description: figSpecStderr }]; + } + + const start_of_json = figSpecOut.indexOf("{"); + const j = figSpecOut.slice(start_of_json); + return JSON.parse(j).subcommands as Fig.Subcommand[]; + } catch (e) { + return [{ name: "error", description: e }] as Fig.Subcommand[]; + } + }); + + // eslint-disable-next-line compat/compat + const results = await Promise.allSettled(promises); + const subcommands = results + .filter((p) => p.status === "fulfilled") + .map((p) => p.value); + const failed = results + .filter((p) => p.status === "rejected") + .map((p) => ({ name: "error", description: p.reason })); + + return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; + }; +}; + +const completionGeneratorTemplate = ( + argSuggestionBash: string, +): Fig.Generator => { + return { + custom: async (tokens: string[], executeCommand) => { + let arg = argSuggestionBash; + if (tokens.length >= 1) { + arg = argSuggestionBash.replace( + "{{words[CURRENT]}}", + tokens[tokens.length - 1], + ); + } + + if (tokens.length >= 2) { + arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); + } + const { stdout: text } = await executeCommand({ + command: "sh", + args: ["-c", arg], + }); + if (text.trim().length == 0) return []; + return text.split("\n").map((elm) => ({ name: elm })); + }, + }; +}; + +const completionSpec: Fig.Spec = { + name: ["mise"], + subcommands: [ + { + name: ["activate"], + description: "Initializes mise in the current shell session", + options: [ + { + name: ["--shims"], + description: + "Use shims instead of modifying PATH\nEffectively the same as:", + isRepeatable: false, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + ], + args: [ + { + name: "shell_type", + description: "Shell type to generate the script for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + ], + }, + { + name: ["alias", "a"], + description: "Manage aliases", + subcommands: [ + { + name: ["get"], + description: "Show an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to show the alias for", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + { + name: "alias", + description: "The alias to show", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise alias ls {{words[PREV]}} | awk '{print $2}'`, + ), + }, + ], + }, + { + name: ["ls", "list"], + description: + "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + options: [ + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool", + description: "Show aliases for ", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set", "add", "create"], + description: "Add/update an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to set the alias for", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + { + name: "alias", + description: "The alias to set", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise alias ls {{words[PREV]}} | awk '{print $2}'`, + ), + }, + { + name: "value", + description: "The value to set the alias to", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to remove the alias from", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + { + name: "alias", + description: "The alias to remove", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise alias ls {{words[PREV]}} | awk '{print $2}'`, + ), + }, + ], + }, + ], + options: [ + { + name: ["-p", "--plugin"], + description: "filter aliases by plugin", + isRepeatable: false, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + }, + { + name: ["backends", "b"], + description: "Manage backends", + subcommands: [ + { + name: ["ls", "list"], + description: "List built-in backends", + }, + ], + }, + { + name: ["bin-paths"], + description: "List all the active runtime bin paths", + }, + { + name: ["cache"], + description: "Manage the mise cache", + subcommands: [ + { + name: ["clear", "c"], + description: "Deletes all cache files in mise", + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + ], + }, + { + name: ["prune", "p"], + description: "Removes stale mise cache files", + options: [ + { + name: ["--dry-run"], + description: "Just show what would be pruned", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show pruned files", + isRepeatable: true, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + ], + }, + ], + }, + { + name: ["completion"], + description: "Generate shell completions", + args: [ + { + name: "shell", + description: "Shell type to generate completions for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "fish", "zsh"], + }, + ], + }, + { + name: ["config", "cfg"], + description: "Manage config files", + subcommands: [ + { + name: ["generate", "g"], + description: "[experimental] Generate a mise.toml file", + options: [ + { + name: ["-o", "--output"], + description: "Output to file instead of stdout", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + ], + }, + { + name: ["get"], + description: "Display the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["ls"], + description: "List config files currently in use", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["set"], + description: "Set the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-t", "--type"], + isRepeatable: false, + args: { + name: "type", + isOptional: false, + isVariadic: false, + suggestions: [ + "infer", + "string", + "integer", + "float", + "bool", + "list", + ], + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: false, + isVariadic: false, + }, + { + name: "value", + description: "The value to set the key to", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["deactivate"], + description: "Disable mise for current shell session", + }, + { + name: ["direnv"], + description: "Output direnv function to use mise inside direnv", + subcommands: [ + { + name: ["activate"], + description: "Output direnv function to use mise inside direnv", + }, + ], + }, + { + name: ["doctor", "dr"], + description: "Check mise installation for possible problems", + }, + { + name: ["env", "e"], + description: "Exports env vars to activate mise a single time", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-s", "--shell"], + description: "Shell type to generate environment variables for", + isRepeatable: false, + args: { + name: "shell", + isOptional: false, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["exec", "x"], + description: "Execute a command with tool(s) set", + options: [ + { + name: ["-c", "--command"], + description: "Command string to execute", + isRepeatable: false, + args: { + name: "c", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to start e.g.: node@20 python@3.10", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + { + name: "command", + description: "Command string to execute (same as --command)", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["generate", "g"], + description: "[experimental] Generate files for various tools/services", + subcommands: [ + { + name: ["git-pre-commit", "pre-commit"], + description: "[experimental] Generate a git pre-commit hook", + options: [ + { + name: ["--hook"], + description: "Which hook to generate (saves to .git/hooks/$hook)", + isRepeatable: false, + args: { + name: "hook", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: + "The task to run when the pre-commit hook is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + }, + { + name: ["-w", "--write"], + description: + "write to .git/hooks/pre-commit and make it executable", + isRepeatable: false, + }, + ], + }, + { + name: ["github-action"], + description: "[experimental] Generate a GitHub Action workflow file", + options: [ + { + name: ["-n", "--name"], + description: "the name of the workflow to generate", + isRepeatable: false, + args: { + name: "name", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: "The task to run when the workflow is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + }, + { + name: ["-w", "--write"], + description: "write to .github/workflows/$name.yml", + isRepeatable: false, + }, + ], + }, + { + name: ["task-docs"], + description: "Generate documentation for tasks in a project", + options: [ + { + name: ["-I", "--index"], + description: + "write only an index of tasks, intended for use with `--multi`", + isRepeatable: false, + }, + { + name: ["-i", "--inject"], + description: "inserts the documentation into an existing file", + isRepeatable: false, + }, + { + name: ["-m", "--multi"], + description: + "render each task as a separate document, requires `--output` to be a directory", + isRepeatable: false, + }, + { + name: ["-o", "--output"], + description: "writes the generated docs to a file/directory", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--root"], + description: "root directory to search for tasks", + isRepeatable: false, + args: { + name: "root", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-s", "--style"], + isRepeatable: false, + args: { + name: "style", + isOptional: false, + isVariadic: false, + suggestions: ["simple", "detailed"], + }, + }, + ], + }, + ], + }, + { + name: ["implode"], + description: "Removes mise CLI and all related data", + options: [ + { + name: ["--config"], + description: "Also remove config directory", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: + "List directories that would be removed without actually removing them", + isRepeatable: false, + }, + ], + }, + { + name: ["install", "i"], + description: "Install a tool version", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to install e.g.: node@20", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["latest"], + description: "Gets the latest available version for a plugin", + options: [ + { + name: ["-i", "--installed"], + description: "Show latest installed instead of available version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool to get the latest version of", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a tool version into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite an existing tool version if it exists", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool name and version to create a symlink for", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + { + name: "path", + description: + "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed and active tool versions", + options: [ + { + name: ["-c", "--current"], + description: + "Only show tool versions currently specified in a mise.toml", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Only show tool versions currently specified in the global mise.toml", + isRepeatable: false, + }, + { + name: ["-i", "--installed"], + description: + "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", + isRepeatable: false, + }, + { + name: ["-o", "--offline"], + description: "Don't fetch information such as outdated versions", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-m", "--missing"], + description: "Display missing tool versions", + isRepeatable: false, + }, + { + name: ["--prefix"], + description: "Display versions matching this prefix", + isRepeatable: false, + args: { + name: "prefix", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + }, + { + name: ["--no-header"], + description: "Don't display headers", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Only show tool versions from [PLUGIN]", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(`mise plugins --core --user`), + }, + ], + }, + { + name: ["ls-remote"], + description: "List runtime versions available for install.", + options: [ + { + name: ["--all"], + description: "Show all installed plugins and versions", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Plugin to get versions for", + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + { + name: "prefix", + description: + 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + ], + }, + { + name: ["outdated"], + description: "Shows outdated tool versions", + options: [ + { + name: ["-l", "--bump"], + description: + "Compares against the latest versions available, not what matches the current config", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "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", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["plugins", "p"], + description: "Manage plugins", + subcommands: [ + { + name: ["install", "i", "a", "add"], + description: "Install a plugin", + options: [ + { + name: ["-f", "--force"], + description: "Reinstall even if plugin exists", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: + "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "new_plugin", + description: + "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate(`mise plugins --all`), + }, + { + name: "git_url", + description: "The git url of the plugin", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a plugin into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite existing plugin", + isRepeatable: false, + }, + ], + args: [ + { + name: "name", + description: "The name of the plugin\ne.g.: node, ruby", + isOptional: false, + isVariadic: false, + }, + { + name: "path", + description: "The local path to the plugin\ne.g.: ./mise-node", + isOptional: true, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed plugins", + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["ls-remote", "list-remote", "list-all"], + description: "List all available remote plugins", + options: [ + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", + isRepeatable: false, + }, + { + name: ["--only-names"], + description: + 'Only show the name of each plugin by default it will show a "*" next to installed plugins', + isRepeatable: false, + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes a plugin", + options: [ + { + name: ["-p", "--purge"], + description: + "Also remove the plugin's installs, downloads, and cache", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: "Remove all plugins", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to remove", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + ], + }, + { + name: ["update", "up", "upgrade"], + description: "Updates a plugin to the latest version", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\nDefault: 4", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to update", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + ], + }, + ], + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["prune"], + description: "Delete unused versions of tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + { + name: ["--configs"], + description: + "Prune only tracked and trusted configuration links that point to non-existent configurations", + isRepeatable: false, + }, + { + name: ["--tools"], + description: "Prune only unused versions of tools", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Prune only versions from this plugin(s)", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(`mise plugins --core --user`), + }, + ], + }, + { + name: ["registry"], + description: "List available tools to install", + args: [ + { + name: "name", + description: "Show only the specified tool's full name", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["reshim"], + description: + "Creates new shims based on bin paths from currently installed tools.", + options: [ + { + name: ["-f", "--force"], + description: "Removes all shims before reshimming", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + { + name: ["self-update"], + description: "Updates mise itself.", + options: [ + { + name: ["-f", "--force"], + description: "Update even if already up to date", + isRepeatable: false, + }, + { + name: ["--no-plugins"], + description: "Disable auto-updating plugins", + isRepeatable: false, + }, + { + name: ["-y", "--yes"], + description: "Skip confirmation prompt", + isRepeatable: false, + }, + ], + args: [ + { + name: "version", + description: "Update to a specific version", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set"], + description: "Set environment variables in mise.toml", + options: [ + { + name: ["--file"], + description: "The TOML file to update", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Set the environment variable in the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "env_vars", + description: + "Environment variable(s) to set\ne.g.: NODE_ENV=production", + isOptional: true, + isVariadic: true, + generators: envVarGenerator, + }, + ], + }, + { + name: ["settings"], + description: "Manage settings", + subcommands: [ + { + name: ["add"], + description: "Adds a setting to the configuration file", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(`mise settings --keys`), + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["get"], + description: "Show a current setting", + args: [ + { + name: "setting", + description: "The setting to show", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(`mise settings --keys`), + }, + ], + }, + { + name: ["ls", "list"], + description: "Show current settings", + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["set", "create"], + description: "Add/update a setting", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(`mise settings --keys`), + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears a setting", + args: [ + { + name: "setting", + description: "The setting to remove", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(`mise settings --keys`), + }, + ], + }, + ], + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["shell", "sh"], + description: "Sets a tool version for the current session.", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-u", "--unset"], + description: "Removes a previously set version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["sync"], + description: "Add tool versions from external tools to mise", + subcommands: [ + { + name: ["node"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--brew"], + description: "Get tool versions from Homebrew", + isRepeatable: false, + }, + { + name: ["--nvm"], + description: "Get tool versions from nvm", + isRepeatable: false, + }, + { + name: ["--nodenv"], + description: "Get tool versions from nodenv", + isRepeatable: false, + }, + ], + }, + { + name: ["python"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--pyenv"], + description: "Get tool versions from pyenv", + isRepeatable: false, + }, + ], + }, + ], + }, + { + name: ["tasks", "t"], + description: "Manage tasks", + subcommands: [ + { + name: ["deps"], + description: "Display a tree visualization of a dependency graph", + options: [ + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--dot"], + description: "Display dependencies in DOT format", + isRepeatable: false, + }, + ], + args: [ + { + name: "tasks", + description: + "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["edit"], + description: "Edit a tasks with $EDITOR", + options: [ + { + name: ["-p", "--path"], + description: + "Display the path to the tasks instead of editing it", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Tasks to edit", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + ], + }, + { + name: ["info"], + description: "Get information about a task", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Name of the task to get information about", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + ], + }, + { + name: ["ls"], + description: + "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.", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: + "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: + "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: + "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + { + name: "args", + description: + 'Arguments to pass to the tasks. Use ":::" to separate tasks', + isOptional: true, + isVariadic: true, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["trust"], + description: "Marks a config file as trusted", + options: [ + { + name: ["-a", "--all"], + description: + "Trust all config files in the current directory and its parents", + isRepeatable: false, + }, + { + name: ["--untrust"], + description: "No longer trust this config", + isRepeatable: false, + }, + { + name: ["--show"], + description: + "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", + isRepeatable: false, + }, + ], + args: [ + { + name: "config_file", + description: "The config file to trust", + isOptional: true, + isVariadic: false, + template: "filepaths", + generators: completionGeneratorTemplate(``), + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes installed tool versions", + options: [ + { + name: ["-a", "--all"], + description: "Delete all installed versions", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + ], + args: [ + { + name: "installed_tool@version", + description: "Tool(s) to remove", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + if [ ! -z "$prefix" ]; then + prefix="--prefix $prefix" + fi + versions=$(mise ls --installed $tool $prefix | awk '{print $2}' | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise ls --installed | awk '{print $1}' | sed '1!G;h;$!d') + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["unset"], + description: "Remove environment variable(s) from the config file.", + options: [ + { + name: ["-f", "--file"], + description: "Specify a file to use instead of `mise.toml`", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Use the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "keys", + description: "Environment variable(s) to remove\ne.g.: NODE_ENV", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["upgrade", "up"], + description: "Upgrades outdated tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Just print what would be done, don't actually do it", + isRepeatable: false, + }, + { + name: ["-i", "--interactive"], + description: + "Display multiselect menu to choose which tools to upgrade", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-l", "--bump"], + description: + "Upgrades to the latest version available, bumping the version in mise.toml", + isRepeatable: false, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["use", "u"], + description: "Installs a tool and adds the version it to mise.toml.", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["--fuzzy"], + description: "Save fuzzy version to config file", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", + isRepeatable: false, + }, + { + name: ["-e", "--env"], + description: + "Modify an environment-specific config file like .mise..toml", + isRepeatable: false, + args: { + name: "env", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", + isRepeatable: false, + }, + { + name: ["--remove"], + description: "Remove the plugin(s) from config file", + isRepeatable: true, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise plugins --core --user`, + ), + }, + }, + { + name: ["-p", "--path"], + description: "Specify a path to a config file or directory", + isRepeatable: false, + args: { + name: "path", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["--pin"], + description: + "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to add to config file", + isOptional: true, + isVariadic: true, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["version", "v"], + description: "Display the version of mise", + }, + { + name: ["watch", "w"], + description: "Run task(s) and watch for changes to rerun it", + options: [ + { + name: ["-t", "--task"], + description: "Tasks to run", + isRepeatable: true, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise tasks | awk '{print $1}'`, + ), + }, + }, + { + name: ["-g", "--glob"], + description: "Files to watch\nDefaults to sources from the tasks(s)", + isRepeatable: true, + args: { + name: "glob", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "args", + description: "Extra arguments", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["where"], + description: "Display the installation path for a tool", + args: [ + { + name: "tool@version", + description: + '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', + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + ], + }, + { + name: ["which"], + description: "Shows the path that a tool's bin points to.", + options: [ + { + name: ["--plugin"], + description: "Show the plugin name instead of the path", + isRepeatable: false, + }, + { + name: ["--version"], + description: "Show the version instead of the path", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: + "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", + isRepeatable: false, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate(` +cur="{{words[CURRENT]}}" +case $cur in + *@*) + tool="$(echo "$cur" | cut -d'@' -f1)" + prefix="$(echo "$cur" | cut -d'@' -f2)" + + versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + + for version in $versions; do + echo "$tool@$version" + done + ;; + *) + plugins=$(mise plugins --all) + for plugin in $plugins; do + echo "$plugin@" + done + ;; +esac +`), + }, + }, + ], + args: [ + { + name: "bin_name", + description: "The bin to look up", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["-C", "--cd"], + description: "Change directory before running command", + isRepeatable: false, + args: { + name: "dir", + isOptional: false, + isVariadic: false, + template: "folders", + }, + }, + { + name: ["-P", "--profile"], + description: "Set the profile (environment)", + isRepeatable: false, + args: { + name: "profile", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show extra output (use -vv for even more)", + isRepeatable: true, + }, + { + name: ["-y", "--yes"], + description: "Answer yes to all confirmation prompts", + isRepeatable: false, + }, + ], +}; + +export default completionSpec; + +const usageGenerateSpec = (cmds: string[]) => { + return async ( + context: string[], + executeCommand: Fig.ExecuteCommandFunction, + ): Promise => { + const promises = cmds.map(async (cmd): Promise => { + try { + const args = cmd.split(" "); + const { + stdout, + stderr: cmdStderr, + status: cmdStatus, + } = await executeCommand({ + command: args[0], + args: args.splice(1), + }); + if (cmdStatus !== 0) { + return [{ name: "error", description: cmdStderr }]; + } + const { + stdout: figSpecOut, + stderr: figSpecStderr, + status: usageFigStatus, + } = await executeCommand({ + command: "usage", + args: ["g", "fig", "--spec", stdout], + }); + if (usageFigStatus !== 0) { + return [{ name: "error", description: figSpecStderr }]; + } + const start_of_json = figSpecOut.indexOf("{"); + const j = figSpecOut.slice(start_of_json); + return JSON.parse(j).subcommands as Fig.Subcommand[]; + } catch (e) { + return [{ name: "error", description: e }] as Fig.Subcommand[]; + } + }); + // eslint-disable-next-line compat/compat + const results = await Promise.allSettled(promises); + const subcommands = results + .filter((p) => p.status === "fulfilled") + .map((p) => p.value); + const failed = results + .filter((p) => p.status === "rejected") + .map((p) => ({ name: "error", description: p.reason })); + return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; + }; +}; +const completionGeneratorTemplate = ( + argSuggestionBash: string, +): Fig.Generator => { + return { + custom: async (tokens: string[], executeCommand) => { + let arg = argSuggestionBash; + if (tokens.length >= 1) { + arg = argSuggestionBash.replace( + "{{words[CURRENT]}}", + tokens[tokens.length - 1], + ); + } + if (tokens.length >= 2) { + arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); + } + const { stdout: text } = await executeCommand({ + command: "sh", + args: ["-c", arg], + }); + if (text.trim().length == 0) return []; + return text.split("\n").map((elm) => ({ name: elm })); + }, + }; +}; +const completionSpec: Fig.Spec = { + name: ["mise"], + subcommands: [ + { + name: ["activate"], + description: "Initializes mise in the current shell session", + options: [ + { + name: ["--shims"], + description: + "Use shims instead of modifying PATH\nEffectively the same as:", + isRepeatable: false, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + ], + args: [ + { + name: "shell_type", + description: "Shell type to generate the script for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + ], + }, + { + name: ["alias", "a"], + description: "Manage aliases", + subcommands: [ + { + name: ["get"], + description: "Show an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to show the alias for", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + { + name: "alias", + description: "The alias to show", + isOptional: false, + isVariadic: false, + generators: aliasGenerator, + }, + ], + }, + { + name: ["ls", "list"], + description: + "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + options: [ + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool", + description: "Show aliases for ", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set", "add", "create"], + description: "Add/update an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to set the alias for", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + { + name: "alias", + description: "The alias to set", + isOptional: false, + isVariadic: false, + generators: aliasGenerator, + }, + { + name: "value", + description: "The value to set the alias to", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to remove the alias from", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + { + name: "alias", + description: "The alias to remove", + isOptional: false, + isVariadic: false, + generators: aliasGenerator, + }, + ], + }, + ], + options: [ + { + name: ["-p", "--plugin"], + description: "filter aliases by plugin", + isRepeatable: false, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + }, + { + name: ["backends", "b"], + description: "Manage backends", + subcommands: [ + { + name: ["ls", "list"], + description: "List built-in backends", + }, + ], + }, + { + name: ["bin-paths"], + description: "List all the active runtime bin paths", + }, + { + name: ["cache"], + description: "Manage the mise cache", + subcommands: [ + { + name: ["clear", "c"], + description: "Deletes all cache files in mise", + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["prune", "p"], + description: "Removes stale mise cache files", + options: [ + { + name: ["--dry-run"], + description: "Just show what would be pruned", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show pruned files", + isRepeatable: true, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + ], + }, + { + name: ["completion"], + description: "Generate shell completions", + args: [ + { + name: "shell", + description: "Shell type to generate completions for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "fish", "zsh"], + }, + ], + }, + { + name: ["config", "cfg"], + description: "Manage config files", + subcommands: [ + { + name: ["generate", "g"], + description: "[experimental] Generate a mise.toml file", + options: [ + { + name: ["-o", "--output"], + description: "Output to file instead of stdout", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + ], + }, + { + name: ["get"], + description: "Display the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["ls"], + description: "List config files currently in use", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["set"], + description: "Set the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-t", "--type"], + isRepeatable: false, + args: { + name: "type", + isOptional: false, + isVariadic: false, + suggestions: [ + "infer", + "string", + "integer", + "float", + "bool", + "list", + ], + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: false, + isVariadic: false, + }, + { + name: "value", + description: "The value to set the key to", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["deactivate"], + description: "Disable mise for current shell session", + }, + { + name: ["direnv"], + description: "Output direnv function to use mise inside direnv", + subcommands: [ + { + name: ["activate"], + description: "Output direnv function to use mise inside direnv", + }, + ], + }, + { + name: ["doctor", "dr"], + description: "Check mise installation for possible problems", + }, + { + name: ["env", "e"], + description: "Exports env vars to activate mise a single time", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-s", "--shell"], + description: "Shell type to generate environment variables for", + isRepeatable: false, + args: { + name: "shell", + isOptional: false, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["exec", "x"], + description: "Execute a command with tool(s) set", + options: [ + { + name: ["-c", "--command"], + description: "Command string to execute", + isRepeatable: false, + args: { + name: "c", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to start e.g.: node@20 python@3.10", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + { + name: "command", + description: "Command string to execute (same as --command)", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["generate", "g"], + description: "[experimental] Generate files for various tools/services", + subcommands: [ + { + name: ["git-pre-commit", "pre-commit"], + description: "[experimental] Generate a git pre-commit hook", + options: [ + { + name: ["--hook"], + description: "Which hook to generate (saves to .git/hooks/$hook)", + isRepeatable: false, + args: { + name: "hook", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: + "The task to run when the pre-commit hook is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + }, + { + name: ["-w", "--write"], + description: + "write to .git/hooks/pre-commit and make it executable", + isRepeatable: false, + }, + ], + }, + { + name: ["github-action"], + description: "[experimental] Generate a GitHub Action workflow file", + options: [ + { + name: ["-n", "--name"], + description: "the name of the workflow to generate", + isRepeatable: false, + args: { + name: "name", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: "The task to run when the workflow is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + }, + { + name: ["-w", "--write"], + description: "write to .github/workflows/$name.yml", + isRepeatable: false, + }, + ], + }, + { + name: ["task-docs"], + description: "Generate documentation for tasks in a project", + options: [ + { + name: ["-I", "--index"], + description: + "write only an index of tasks, intended for use with `--multi`", + isRepeatable: false, + }, + { + name: ["-i", "--inject"], + description: "inserts the documentation into an existing file", + isRepeatable: false, + }, + { + name: ["-m", "--multi"], + description: + "render each task as a separate document, requires `--output` to be a directory", + isRepeatable: false, + }, + { + name: ["-o", "--output"], + description: "writes the generated docs to a file/directory", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--root"], + description: "root directory to search for tasks", + isRepeatable: false, + args: { + name: "root", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-s", "--style"], + isRepeatable: false, + args: { + name: "style", + isOptional: false, + isVariadic: false, + suggestions: ["simple", "detailed"], + }, + }, + ], + }, + ], + }, + { + name: ["implode"], + description: "Removes mise CLI and all related data", + options: [ + { + name: ["--config"], + description: "Also remove config directory", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: + "List directories that would be removed without actually removing them", + isRepeatable: false, + }, + ], + }, + { + name: ["install", "i"], + description: "Install a tool version", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to install e.g.: node@20", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["latest"], + description: "Gets the latest available version for a plugin", + options: [ + { + name: ["-i", "--installed"], + description: "Show latest installed instead of available version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool to get the latest version of", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a tool version into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite an existing tool version if it exists", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool name and version to create a symlink for", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + { + name: "path", + description: + "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed and active tool versions", + options: [ + { + name: ["-c", "--current"], + description: + "Only show tool versions currently specified in a mise.toml", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Only show tool versions currently specified in the global mise.toml", + isRepeatable: false, + }, + { + name: ["-i", "--installed"], + description: + "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", + isRepeatable: false, + }, + { + name: ["-o", "--offline"], + description: "Don't fetch information such as outdated versions", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-m", "--missing"], + description: "Display missing tool versions", + isRepeatable: false, + }, + { + name: ["--prefix"], + description: "Display versions matching this prefix", + isRepeatable: false, + args: { + name: "prefix", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + }, + { + name: ["--no-header"], + description: "Don't display headers", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Only show tool versions from [PLUGIN]", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["ls-remote"], + description: "List runtime versions available for install.", + options: [ + { + name: ["--all"], + description: "Show all installed plugins and versions", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Plugin to get versions for", + isOptional: true, + isVariadic: false, + generators: toolVersionGenerator, + }, + { + name: "prefix", + description: + 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + ], + }, + { + name: ["outdated"], + description: "Shows outdated tool versions", + options: [ + { + name: ["-l", "--bump"], + description: + "Compares against the latest versions available, not what matches the current config", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "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", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["plugins", "p"], + description: "Manage plugins", + subcommands: [ + { + name: ["install", "i", "a", "add"], + description: "Install a plugin", + options: [ + { + name: ["-f", "--force"], + description: "Reinstall even if plugin exists", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: + "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "new_plugin", + description: + "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate(`mise plugins --all`), + }, + { + name: "git_url", + description: "The git url of the plugin", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a plugin into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite existing plugin", + isRepeatable: false, + }, + ], + args: [ + { + name: "name", + description: "The name of the plugin\ne.g.: node, ruby", + isOptional: false, + isVariadic: false, + }, + { + name: "path", + description: "The local path to the plugin\ne.g.: ./mise-node", + isOptional: true, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed plugins", + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["ls-remote", "list-remote", "list-all"], + description: "List all available remote plugins", + options: [ + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", + isRepeatable: false, + }, + { + name: ["--only-names"], + description: + 'Only show the name of each plugin by default it will show a "*" next to installed plugins', + isRepeatable: false, + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes a plugin", + options: [ + { + name: ["-p", "--purge"], + description: + "Also remove the plugin's installs, downloads, and cache", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: "Remove all plugins", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to remove", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["update", "up", "upgrade"], + description: "Updates a plugin to the latest version", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\nDefault: 4", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to update", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + ], + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["prune"], + description: "Delete unused versions of tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + { + name: ["--configs"], + description: + "Prune only tracked and trusted configuration links that point to non-existent configurations", + isRepeatable: false, + }, + { + name: ["--tools"], + description: "Prune only unused versions of tools", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Prune only versions from this plugin(s)", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["registry"], + description: "List available tools to install", + args: [ + { + name: "name", + description: "Show only the specified tool's full name", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["reshim"], + description: + "Creates new shims based on bin paths from currently installed tools.", + options: [ + { + name: ["-f", "--force"], + description: "Removes all shims before reshimming", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + { + name: ["self-update"], + description: "Updates mise itself.", + options: [ + { + name: ["-f", "--force"], + description: "Update even if already up to date", + isRepeatable: false, + }, + { + name: ["--no-plugins"], + description: "Disable auto-updating plugins", + isRepeatable: false, + }, + { + name: ["-y", "--yes"], + description: "Skip confirmation prompt", + isRepeatable: false, + }, + ], + args: [ + { + name: "version", + description: "Update to a specific version", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set"], + description: "Set environment variables in mise.toml", + options: [ + { + name: ["--file"], + description: "The TOML file to update", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Set the environment variable in the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "env_vars", + description: + "Environment variable(s) to set\ne.g.: NODE_ENV=production", + isOptional: true, + isVariadic: true, + generators: envVarGenerator, + }, + ], + }, + { + name: ["settings"], + description: "Manage settings", + subcommands: [ + { + name: ["add"], + description: "Adds a setting to the configuration file", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["get"], + description: "Show a current setting", + args: [ + { + name: "setting", + description: "The setting to show", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + ], + }, + { + name: ["ls", "list"], + description: "Show current settings", + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["set", "create"], + description: "Add/update a setting", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears a setting", + args: [ + { + name: "setting", + description: "The setting to remove", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + ], + }, + ], + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["shell", "sh"], + description: "Sets a tool version for the current session.", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-u", "--unset"], + description: "Removes a previously set version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["sync"], + description: "Add tool versions from external tools to mise", + subcommands: [ + { + name: ["node"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--brew"], + description: "Get tool versions from Homebrew", + isRepeatable: false, + }, + { + name: ["--nvm"], + description: "Get tool versions from nvm", + isRepeatable: false, + }, + { + name: ["--nodenv"], + description: "Get tool versions from nodenv", + isRepeatable: false, + }, + ], + }, + { + name: ["python"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--pyenv"], + description: "Get tool versions from pyenv", + isRepeatable: false, + }, + ], + }, + ], + }, + { + name: ["tasks", "t"], + description: "Manage tasks", + subcommands: [ + { + name: ["deps"], + description: "Display a tree visualization of a dependency graph", + options: [ + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--dot"], + description: "Display dependencies in DOT format", + isRepeatable: false, + }, + ], + args: [ + { + name: "tasks", + description: + "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["edit"], + description: "Edit a tasks with $EDITOR", + options: [ + { + name: ["-p", "--path"], + description: + "Display the path to the tasks instead of editing it", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Tasks to edit", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + ], + }, + { + name: ["info"], + description: "Get information about a task", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Name of the task to get information about", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + ], + }, + { + name: ["ls"], + description: + "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.", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: + "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: + "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: + "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", + isOptional: true, + isVariadic: false, + generators: simpleTaskGenerator, + }, + { + name: "args", + description: + 'Arguments to pass to the tasks. Use ":::" to separate tasks', + isOptional: true, + isVariadic: true, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["trust"], + description: "Marks a config file as trusted", + options: [ + { + name: ["-a", "--all"], + description: + "Trust all config files in the current directory and its parents", + isRepeatable: false, + }, + { + name: ["--untrust"], + description: "No longer trust this config", + isRepeatable: false, + }, + { + name: ["--show"], + description: + "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", + isRepeatable: false, + }, + ], + args: [ + { + name: "config_file", + description: "The config file to trust", + isOptional: true, + isVariadic: false, + template: "filepaths", + generators: configPathGenerator, + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes installed tool versions", + options: [ + { + name: ["-a", "--all"], + description: "Delete all installed versions", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + ], + args: [ + { + name: "installed_tool@version", + description: "Tool(s) to remove", + isOptional: true, + isVariadic: true, + generators: installedToolVersionGenerator, + }, + ], + }, + { + name: ["unset"], + description: "Remove environment variable(s) from the config file.", + options: [ + { + name: ["-f", "--file"], + description: "Specify a file to use instead of `mise.toml`", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Use the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "keys", + description: "Environment variable(s) to remove\ne.g.: NODE_ENV", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["upgrade", "up"], + description: "Upgrades outdated tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Just print what would be done, don't actually do it", + isRepeatable: false, + }, + { + name: ["-i", "--interactive"], + description: + "Display multiselect menu to choose which tools to upgrade", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-l", "--bump"], + description: + "Upgrades to the latest version available, bumping the version in mise.toml", + isRepeatable: false, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["use", "u"], + description: "Installs a tool and adds the version it to mise.toml.", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["--fuzzy"], + description: "Save fuzzy version to config file", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", + isRepeatable: false, + }, + { + name: ["-e", "--env"], + description: + "Modify an environment-specific config file like .mise..toml", + isRepeatable: false, + args: { + name: "env", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", + isRepeatable: false, + }, + { + name: ["--remove"], + description: "Remove the plugin(s) from config file", + isRepeatable: true, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + }, + { + name: ["-p", "--path"], + description: "Specify a path to a config file or directory", + isRepeatable: false, + args: { + name: "path", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["--pin"], + description: + "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to add to config file", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["version", "v"], + description: "Display the version of mise", + }, + { + name: ["watch", "w"], + description: "Run task(s) and watch for changes to rerun it", + options: [ + { + name: ["-t", "--task"], + description: "Tasks to run", + isRepeatable: true, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + }, + { + name: ["-g", "--glob"], + description: "Files to watch\nDefaults to sources from the tasks(s)", + isRepeatable: true, + args: { + name: "glob", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "args", + description: "Extra arguments", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["where"], + description: "Display the installation path for a tool", + args: [ + { + name: "tool@version", + description: + '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', + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["which"], + description: "Shows the path that a tool's bin points to.", + options: [ + { + name: ["--plugin"], + description: "Show the plugin name instead of the path", + isRepeatable: false, + }, + { + name: ["--version"], + description: "Show the version instead of the path", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: + "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", + isRepeatable: false, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + }, + ], + args: [ + { + name: "bin_name", + description: "The bin to look up", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["-C", "--cd"], + description: "Change directory before running command", + isRepeatable: false, + args: { + name: "dir", + isOptional: false, + isVariadic: false, + template: "folders", + }, + }, + { + name: ["-P", "--profile"], + description: "Set the profile (environment)", + isRepeatable: false, + args: { + name: "profile", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show extra output (use -vv for even more)", + isRepeatable: true, + }, + { + name: ["-y", "--yes"], + description: "Answer yes to all confirmation prompts", + isRepeatable: false, + }, + ], +}; +export default completionSpec; From 76ca47e18fd7d5fb41083f99badee0f9c4fbf5e6 Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Sun, 10 Nov 2024 20:57:20 +0000 Subject: [PATCH 11/14] Fix duplicated code --- tasks/fig/addCustomGenerators.ts | 7 +- tasks/fig/src/mise.ts | 7172 ++++++++++++------------------ 2 files changed, 2853 insertions(+), 4326 deletions(-) diff --git a/tasks/fig/addCustomGenerators.ts b/tasks/fig/addCustomGenerators.ts index f3186831cc..25b62486b7 100644 --- a/tasks/fig/addCustomGenerators.ts +++ b/tasks/fig/addCustomGenerators.ts @@ -1,5 +1,6 @@ import fsAsync = require("node:fs/promises"); import * as ts from "typescript"; +import * as path from "path"; type GeneratorIdentifier = { identifier: string; @@ -47,6 +48,10 @@ const customGenerators: GeneratorIdentifier[] = [ identifier: "env_vars", generator_name: "envVarGenerator", }, + { + identifier: "tool@version", + generator_name: "toolVersionGenerator", + }, ]; const get_identifier = (node: ts.Node): ts.Identifier | undefined => { @@ -94,7 +99,7 @@ function transformer(context: ts.TransformationContext) { const main = async (fileName: string, outFile?: string) => { try { - const generatorFileContents = (await fsAsync.readFile(fileName)).toString(); + const generatorFileContents = (await fsAsync.readFile(path.join(__dirname, "generators.ts"))).toString(); const contents = (await fsAsync.readFile(fileName)).toString(); const sourceFile = ts.createSourceFile( "example.ts", diff --git a/tasks/fig/src/mise.ts b/tasks/fig/src/mise.ts index 5be619f587..ee4011c899 100644 --- a/tasks/fig/src/mise.ts +++ b/tasks/fig/src/mise.ts @@ -1,4361 +1,2883 @@ -const usageGenerateSpec = (cmds: string[]) => { - return async ( - context: string[], - executeCommand: Fig.ExecuteCommandFunction, - ): Promise => { - const promises = cmds.map(async (cmd): Promise => { - try { - const args = cmd.split(" "); - const { - stdout, - stderr: cmdStderr, - status: cmdStatus, - } = await executeCommand({ - command: args[0], - args: args.splice(1), - }); - if (cmdStatus !== 0) { - return [{ name: "error", description: cmdStderr }]; - } - const { - stdout: figSpecOut, - stderr: figSpecStderr, - status: usageFigStatus, - } = await executeCommand({ - command: "usage", - args: ["g", "fig", "--spec", stdout], - }); - if (usageFigStatus !== 0) { - return [{ name: "error", description: figSpecStderr }]; +// If not being published, these need to manually downloaded from https://github.com/withfig/autocomplete/tree/master/src +import { createNpmSearchHandler } from "./npm"; +import { searchGenerator as createCargoSearchGenerator } from "./cargo"; + +const envVarGenerator = { + script: ["sh", "-c", "env"], + postProcess: (output: string) => { + return output.split("\n").map((l) => ({ name: l.split("=")[0] })); + }, +}; + +const singleCmdNewLineGenerator = (completion_cmd: string): Fig.Generator => ({ + script: completion_cmd.split(" "), + splitOn: "\n", +}); + +const singleCmdJsonGenerator = (cmd: string): Fig.Generator => ({ + script: cmd.split(" "), + postProcess: (out) => + JSON.parse(out).map((r: any) => ({ + name: r.name, + description: r.description, + })), +}); + +const contextualGeneratorLastWord = (cmd: string): Fig.Generator => ({ + script: (context) => { + if (context.length < 2) { + return []; + } + + const prev = context[context.length - 2]; // -1 is the current word + return ["sh", "-c", [cmd, prev].join(" ")]; + }, +}); + +const aliasGenerator: Fig.Generator = { + ...contextualGeneratorLastWord("mise alias ls"), + postProcess: (out) => { + //return [{name: out}] + //return out.split('\t').map(l => ({name: l})) + //return [{name: "test", "description": out}] + const tokens = out.split(/\s+/); + if (tokens.length == 0) return []; + + return tokens + .flatMap((_, i) => { + if (i % 3 == 0) { + return [tokens[i + 1]]; } + return []; + }) + .filter((l) => l.trim().length > 0) + .map((l) => ({ name: l.trim() })); + }, +}; - const start_of_json = figSpecOut.indexOf("{"); - const j = figSpecOut.slice(start_of_json); - return JSON.parse(j).subcommands as Fig.Subcommand[]; - } catch (e) { - return [{ name: "error", description: e }] as Fig.Subcommand[]; - } +const pluginWithAlias: Fig.Generator = { + script: "mise alias ls".split(" "), + postProcess: (output: string) => { + const plugins = output.split("\n").map((line) => { + const tokens = line.split(/\s+/); + return tokens[0]; }); + return [...new Set(plugins)].map((p) => ({ name: p })); + }, +}; - // eslint-disable-next-line compat/compat - const results = await Promise.allSettled(promises); - const subcommands = results - .filter((p) => p.status === "fulfilled") - .map((p) => p.value); - const failed = results - .filter((p) => p.status === "rejected") - .map((p) => ({ name: "error", description: p.reason })); +const getInstalledTools = async ( + executeShellCommand: Fig.ExecuteCommandFunction, +) => { + const { stdout } = await executeShellCommand({ + command: "sh", + args: ["-c", "mise ls --installed"], + }); + return [ + ...new Set( + stdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[0], version: tokens[1] }; + }), + ), + ]; +}; - return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; - }; +type ConfigLsOutput = { + path: string; + tools: string[]; }; -const completionGeneratorTemplate = ( - argSuggestionBash: string, -): Fig.Generator => { - return { - custom: async (tokens: string[], executeCommand) => { - let arg = argSuggestionBash; - if (tokens.length >= 1) { - arg = argSuggestionBash.replace( - "{{words[CURRENT]}}", - tokens[tokens.length - 1], - ); - } +const configPathGenerator: Fig.Generator = { + ...singleCmdJsonGenerator("mise config ls -J"), + postProcess: (out) => + JSON.parse(out).map((r: ConfigLsOutput) => ({ + name: r.path, + description: r.path, + })), +}; - if (tokens.length >= 2) { - arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); - } - const { stdout: text } = await executeCommand({ - command: "sh", - args: ["-c", arg], - }); - if (text.trim().length == 0) return []; - return text.split("\n").map((elm) => ({ name: elm })); - }, - }; +type ObjectKeyType = string | symbol | number; +type ObjectAcceptableKeyValues = { + [key: string]: ObjectKeyType; }; -const completionSpec: Fig.Spec = { - name: ["mise"], - subcommands: [ - { - name: ["activate"], - description: "Initializes mise in the current shell session", - options: [ - { - name: ["--shims"], - description: - "Use shims instead of modifying PATH\nEffectively the same as:", - isRepeatable: false, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - ], - args: [ - { - name: "shell_type", - description: "Shell type to generate the script for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - ], - }, - { - name: ["alias", "a"], - description: "Manage aliases", - subcommands: [ - { - name: ["get"], - description: "Show an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to show the alias for", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - { - name: "alias", - description: "The alias to show", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise alias ls {{words[PREV]}} | awk '{print $2}'`, - ), - }, - ], - }, - { - name: ["ls", "list"], - description: - "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", - options: [ - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool", - description: "Show aliases for ", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set", "add", "create"], - description: "Add/update an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to set the alias for", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - { - name: "alias", - description: "The alias to set", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise alias ls {{words[PREV]}} | awk '{print $2}'`, - ), - }, - { - name: "value", - description: "The value to set the alias to", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to remove the alias from", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - { - name: "alias", - description: "The alias to remove", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise alias ls {{words[PREV]}} | awk '{print $2}'`, - ), - }, - ], - }, - ], - options: [ - { - name: ["-p", "--plugin"], - description: "filter aliases by plugin", - isRepeatable: false, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - }, - { - name: ["backends", "b"], - description: "Manage backends", - subcommands: [ - { - name: ["ls", "list"], - description: "List built-in backends", - }, - ], - }, - { - name: ["bin-paths"], - description: "List all the active runtime bin paths", - }, - { - name: ["cache"], - description: "Manage the mise cache", - subcommands: [ - { - name: ["clear", "c"], - description: "Deletes all cache files in mise", - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - ], - }, - { - name: ["prune", "p"], - description: "Removes stale mise cache files", - options: [ - { - name: ["--dry-run"], - description: "Just show what would be pruned", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show pruned files", - isRepeatable: true, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - ], - }, - ], - }, - { - name: ["completion"], - description: "Generate shell completions", - args: [ - { - name: "shell", - description: "Shell type to generate completions for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "fish", "zsh"], - }, - ], - }, - { - name: ["config", "cfg"], - description: "Manage config files", - subcommands: [ - { - name: ["generate", "g"], - description: "[experimental] Generate a mise.toml file", - options: [ - { - name: ["-o", "--output"], - description: "Output to file instead of stdout", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - ], - }, - { - name: ["get"], - description: "Display the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["ls"], - description: "List config files currently in use", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["set"], - description: "Set the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-t", "--type"], - isRepeatable: false, - args: { - name: "type", - isOptional: false, - isVariadic: false, - suggestions: [ - "infer", - "string", - "integer", - "float", - "bool", - "list", - ], - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: false, - isVariadic: false, - }, - { - name: "value", - description: "The value to set the key to", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["deactivate"], - description: "Disable mise for current shell session", - }, - { - name: ["direnv"], - description: "Output direnv function to use mise inside direnv", - subcommands: [ - { - name: ["activate"], - description: "Output direnv function to use mise inside direnv", - }, - ], - }, - { - name: ["doctor", "dr"], - description: "Check mise installation for possible problems", - }, - { - name: ["env", "e"], - description: "Exports env vars to activate mise a single time", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-s", "--shell"], - description: "Shell type to generate environment variables for", - isRepeatable: false, - args: { - name: "shell", - isOptional: false, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" +function groupBy( + array: T[], + key: keyof T, +): Record { + return array.reduce( + (result, currentItem) => { + (result[currentItem[key] as ObjectKeyType] = + result[currentItem[key] as ObjectKeyType] || []).push(currentItem); + return result; + }, + {} as Record, + ); +} - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') +const installedToolsGenerator: Fig.Generator = { + script: ["sh", "-c", "mise ls --installed"], + postProcess: (stdout: string) => { + return [ + ...new Set( + stdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[0], version: tokens[1] }; + }), + ), + ]; + }, +}; - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["exec", "x"], - description: "Execute a command with tool(s) set", - options: [ - { - name: ["-c", "--command"], - description: "Command string to execute", - isRepeatable: false, - args: { - name: "c", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to start e.g.: node@20 python@3.10", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" +const pluginGenerator: Fig.Generator = installedToolsGenerator; +const allPluginsGenerator: Fig.Generator = + singleCmdNewLineGenerator("mise plugins --all"); +const simpleTaskGenerator = singleCmdJsonGenerator("mise tasks -J"); +const settingsGenerator = singleCmdNewLineGenerator(`mise settings --keys`); - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') +const atsInStr = (s: string) => (s.match(/@/g) || []).length != 0; +const backendSepInStr = (s: string) => (s.match(/:/g) || []).length != 0; - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - { - name: "command", - description: "Command string to execute (same as --command)", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["generate", "g"], - description: "[experimental] Generate files for various tools/services", - subcommands: [ - { - name: ["git-pre-commit", "pre-commit"], - description: "[experimental] Generate a git pre-commit hook", - options: [ - { - name: ["--hook"], - description: "Which hook to generate (saves to .git/hooks/$hook)", - isRepeatable: false, - args: { - name: "hook", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: - "The task to run when the pre-commit hook is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - }, - { - name: ["-w", "--write"], - description: - "write to .git/hooks/pre-commit and make it executable", - isRepeatable: false, - }, - ], - }, - { - name: ["github-action"], - description: "[experimental] Generate a GitHub Action workflow file", - options: [ - { - name: ["-n", "--name"], - description: "the name of the workflow to generate", - isRepeatable: false, - args: { - name: "name", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: "The task to run when the workflow is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - }, - { - name: ["-w", "--write"], - description: "write to .github/workflows/$name.yml", - isRepeatable: false, - }, - ], - }, - { - name: ["task-docs"], - description: "Generate documentation for tasks in a project", - options: [ - { - name: ["-I", "--index"], - description: - "write only an index of tasks, intended for use with `--multi`", - isRepeatable: false, - }, - { - name: ["-i", "--inject"], - description: "inserts the documentation into an existing file", - isRepeatable: false, - }, - { - name: ["-m", "--multi"], - description: - "render each task as a separate document, requires `--output` to be a directory", - isRepeatable: false, - }, - { - name: ["-o", "--output"], - description: "writes the generated docs to a file/directory", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--root"], - description: "root directory to search for tasks", - isRepeatable: false, - args: { - name: "root", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-s", "--style"], - isRepeatable: false, - args: { - name: "style", - isOptional: false, - isVariadic: false, - suggestions: ["simple", "detailed"], - }, - }, - ], - }, - ], - }, - { - name: ["implode"], - description: "Removes mise CLI and all related data", - options: [ - { - name: ["--config"], - description: "Also remove config directory", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: - "List directories that would be removed without actually removing them", - isRepeatable: false, - }, - ], - }, - { - name: ["install", "i"], - description: "Install a tool version", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to install e.g.: node@20", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" +const searchBackend = async ( + backend: string, + context: string[], + executeShellCommand: Fig.ExecuteCommandFunction, + shellContext: Fig.GeneratorContext, +): Promise => { + const customContext = context; + customContext[context.length - 1] = customContext[context.length - 1].replace( + `${backend}:`, + "", + ); + switch (backend) { + case "npm": + return await createNpmSearchHandler()( + context, + executeShellCommand, + shellContext, + ); + case "cargo": + //return [{name: customContext[context.length - 1]}] + return await createCargoSearchGenerator.custom( + customContext, + executeShellCommand, + shellContext, + ); + case "asdf": + const { stdout } = await executeShellCommand({ + command: "sh", + args: ["-c", "mise registry"], + }); + return [ + ...new Set( + stdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[1].replace(`${backend}:`, "") }; + }), + ), + ]; + case "ubi": + const { stdout: ubiOut } = await executeShellCommand({ + command: "sh", + args: ["-c", "mise registry"], + }); + return [ + ...new Set( + ubiOut.split("\n").flatMap((l) => { + const tokens = l.split(/\s+/); + if (!tokens[1].includes("ubi:")) return []; + return [{ name: tokens[1].replace("ubi:", "") }] as Fig.Suggestion; + }), + ), + ]; + default: + return []; + } +}; - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') +const compareVersions = (a: string, b: string): number => { + const result = [a, b].sort(); // Unless we can add semversort + if (result[0] != a) return 1; + return -1; +}; - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["latest"], - description: "Gets the latest available version for a plugin", - options: [ - { - name: ["-i", "--installed"], - description: "Show latest installed instead of available version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool to get the latest version of", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" +const toolVersionGenerator: Fig.Generator = { + trigger: (newToken: string, oldToken: string): boolean => { + return ( + (backendSepInStr(newToken) && !backendSepInStr(oldToken)) || + (atsInStr(newToken) && !atsInStr(oldToken)) + ); + }, + getQueryTerm: "@", - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + custom: async ( + context: string[], + executeShellCommand: Fig.ExecuteCommandFunction, + shellContext: Fig.GeneratorContext, + ) => { + const currentWord = context[context.length - 1]; + if (backendSepInStr(currentWord)) { + // Let's handle backends + const backend = currentWord.slice(0, currentWord.lastIndexOf(":")); - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a tool version into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite an existing tool version if it exists", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool name and version to create a symlink for", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" + return ( + await searchBackend(backend, context, executeShellCommand, shellContext) + ).map((s) => ({ + ...s, + name: `${backend}:${s.name}`, + displayName: s.name, + icon: "📦", + })); + } else if (atsInStr(currentWord)) { + const tool = currentWord.slice(0, currentWord.lastIndexOf("@")); + const { stdout } = await executeShellCommand({ + command: "sh", + args: ["-c", `mise ls-remote ${tool}`], + }); + const remote_versions_suggestions = stdout + .split("\n") + .sort((a, b) => compareVersions(b, a)) + .map((l) => ({ name: l })); + const { stdout: aliasStdout } = await executeShellCommand({ + command: "sh", + args: ["-c", `mise alias ls ${tool}`], + }); + const aliases_suggestions = aliasStdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[1] }; + }); + return [...aliases_suggestions, ...remote_versions_suggestions]; + } - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + const { stdout } = await executeShellCommand({ + command: "sh", + args: ["-c", "mise registry"], + }); + return [ + ...new Set( + stdout.split("\n").map((l) => { + const tokens = l.split(/\s+/); + return { name: tokens[0] }; + }), + ), + ]; + }, +}; - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - { - name: "path", - description: - "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed and active tool versions", - options: [ - { - name: ["-c", "--current"], - description: - "Only show tool versions currently specified in a mise.toml", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Only show tool versions currently specified in the global mise.toml", - isRepeatable: false, - }, - { - name: ["-i", "--installed"], - description: - "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", - isRepeatable: false, - }, - { - name: ["-o", "--offline"], - description: "Don't fetch information such as outdated versions", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-m", "--missing"], - description: "Display missing tool versions", - isRepeatable: false, - }, - { - name: ["--prefix"], - description: "Display versions matching this prefix", - isRepeatable: false, - args: { - name: "prefix", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - }, - { - name: ["--no-header"], - description: "Don't display headers", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Only show tool versions from [PLUGIN]", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(`mise plugins --core --user`), - }, - ], - }, - { - name: ["ls-remote"], - description: "List runtime versions available for install.", - options: [ - { - name: ["--all"], - description: "Show all installed plugins and versions", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Plugin to get versions for", - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" +const installedToolVersionGenerator: Fig.Generator = { + trigger: "@", + getQueryTerm: "@", + custom: async ( + context: string[], + executeShellCommand: Fig.ExecuteCommandFunction, + ) => { + const tools = await getInstalledTools(executeShellCommand); + const toolsVersions = groupBy(tools, "name"); - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + const currentWord = context[context.length - 1]; + if (atsInStr(currentWord)) { + const tool = currentWord.slice(0, currentWord.lastIndexOf("@")); - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - { - name: "prefix", - description: - 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - ], - }, - { - name: ["outdated"], - description: "Shows outdated tool versions", - options: [ - { - name: ["-l", "--bump"], - description: - "Compares against the latest versions available, not what matches the current config", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "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", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" + const { stdout: aliasStdout } = await executeShellCommand({ + command: "sh", + args: ["-c", `mise alias ls ${tool}`], + }); - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + // This lists all aliases even if they are not installed + /* + const aliases_suggestions = aliasStdout.split('\n').map(l => { + const tokens = l.split(/\s+/) + return {name: tokens[1], description: tokens[2]} + }) as Fig.Suggestion[] + */ - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["plugins", "p"], - description: "Manage plugins", - subcommands: [ - { - name: ["install", "i", "a", "add"], - description: "Install a plugin", - options: [ - { - name: ["-f", "--force"], - description: "Reinstall even if plugin exists", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: - "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "new_plugin", - description: - "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate(`mise plugins --all`), - }, - { - name: "git_url", - description: "The git url of the plugin", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a plugin into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite existing plugin", - isRepeatable: false, - }, - ], - args: [ - { - name: "name", - description: "The name of the plugin\ne.g.: node, ruby", - isOptional: false, - isVariadic: false, - }, - { - name: "path", - description: "The local path to the plugin\ne.g.: ./mise-node", - isOptional: true, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed plugins", - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["ls-remote", "list-remote", "list-all"], - description: "List all available remote plugins", - options: [ - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", - isRepeatable: false, - }, - { - name: ["--only-names"], - description: - 'Only show the name of each plugin by default it will show a "*" next to installed plugins', - isRepeatable: false, - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes a plugin", - options: [ - { - name: ["-p", "--purge"], - description: - "Also remove the plugin's installs, downloads, and cache", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: "Remove all plugins", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to remove", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - ], - }, - { - name: ["update", "up", "upgrade"], - description: "Updates a plugin to the latest version", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\nDefault: 4", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to update", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - ], - }, - ], - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["prune"], - description: "Delete unused versions of tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - { - name: ["--configs"], - description: - "Prune only tracked and trusted configuration links that point to non-existent configurations", - isRepeatable: false, - }, - { - name: ["--tools"], - description: "Prune only unused versions of tools", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Prune only versions from this plugin(s)", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(`mise plugins --core --user`), - }, - ], - }, - { - name: ["registry"], - description: "List available tools to install", - args: [ - { - name: "name", - description: "Show only the specified tool's full name", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["reshim"], - description: - "Creates new shims based on bin paths from currently installed tools.", - options: [ - { - name: ["-f", "--force"], - description: "Removes all shims before reshimming", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" + const toolVersions = (toolsVersions[tool] || []) as { + name: string; + version: string; + }[]; + const suggestions = toolVersions.map((s) => ({ + name: s.version, + })) as Fig.Suggestion[]; - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + return [...suggestions]; + } - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - { - name: ["self-update"], - description: "Updates mise itself.", - options: [ - { - name: ["-f", "--force"], - description: "Update even if already up to date", - isRepeatable: false, - }, - { - name: ["--no-plugins"], - description: "Disable auto-updating plugins", - isRepeatable: false, - }, - { - name: ["-y", "--yes"], - description: "Skip confirmation prompt", - isRepeatable: false, - }, - ], - args: [ - { - name: "version", - description: "Update to a specific version", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set"], - description: "Set environment variables in mise.toml", - options: [ - { - name: ["--file"], - description: "The TOML file to update", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Set the environment variable in the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "env_vars", - description: - "Environment variable(s) to set\ne.g.: NODE_ENV=production", - isOptional: true, - isVariadic: true, - generators: envVarGenerator, - }, - ], - }, - { - name: ["settings"], - description: "Manage settings", - subcommands: [ - { - name: ["add"], - description: "Adds a setting to the configuration file", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(`mise settings --keys`), - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["get"], - description: "Show a current setting", - args: [ - { - name: "setting", - description: "The setting to show", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(`mise settings --keys`), - }, - ], - }, - { - name: ["ls", "list"], - description: "Show current settings", - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["set", "create"], - description: "Add/update a setting", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(`mise settings --keys`), - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears a setting", - args: [ - { - name: "setting", - description: "The setting to remove", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(`mise settings --keys`), - }, - ], - }, - ], - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["shell", "sh"], - description: "Sets a tool version for the current session.", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-u", "--unset"], - description: "Removes a previously set version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["sync"], - description: "Add tool versions from external tools to mise", - subcommands: [ - { - name: ["node"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--brew"], - description: "Get tool versions from Homebrew", - isRepeatable: false, - }, - { - name: ["--nvm"], - description: "Get tool versions from nvm", - isRepeatable: false, - }, - { - name: ["--nodenv"], - description: "Get tool versions from nodenv", - isRepeatable: false, - }, - ], - }, - { - name: ["python"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--pyenv"], - description: "Get tool versions from pyenv", - isRepeatable: false, - }, - ], - }, - ], - }, - { - name: ["tasks", "t"], - description: "Manage tasks", - subcommands: [ - { - name: ["deps"], - description: "Display a tree visualization of a dependency graph", - options: [ - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--dot"], - description: "Display dependencies in DOT format", - isRepeatable: false, - }, - ], - args: [ - { - name: "tasks", - description: - "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["edit"], - description: "Edit a tasks with $EDITOR", - options: [ - { - name: ["-p", "--path"], - description: - "Display the path to the tasks instead of editing it", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Tasks to edit", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - ], - }, - { - name: ["info"], - description: "Get information about a task", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Name of the task to get information about", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - ], - }, - { - name: ["ls"], - description: - "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.", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: - "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: - "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: - "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - { - name: "args", - description: - 'Arguments to pass to the tasks. Use ":::" to separate tasks', - isOptional: true, - isVariadic: true, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["trust"], - description: "Marks a config file as trusted", - options: [ - { - name: ["-a", "--all"], - description: - "Trust all config files in the current directory and its parents", - isRepeatable: false, - }, - { - name: ["--untrust"], - description: "No longer trust this config", - isRepeatable: false, - }, - { - name: ["--show"], - description: - "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", - isRepeatable: false, - }, - ], - args: [ - { - name: "config_file", - description: "The config file to trust", - isOptional: true, - isVariadic: false, - template: "filepaths", - generators: completionGeneratorTemplate(``), - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes installed tool versions", - options: [ - { - name: ["-a", "--all"], - description: "Delete all installed versions", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - ], - args: [ - { - name: "installed_tool@version", - description: "Tool(s) to remove", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - if [ ! -z "$prefix" ]; then - prefix="--prefix $prefix" - fi - versions=$(mise ls --installed $tool $prefix | awk '{print $2}' | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise ls --installed | awk '{print $1}' | sed '1!G;h;$!d') - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["unset"], - description: "Remove environment variable(s) from the config file.", - options: [ - { - name: ["-f", "--file"], - description: "Specify a file to use instead of `mise.toml`", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Use the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "keys", - description: "Environment variable(s) to remove\ne.g.: NODE_ENV", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["upgrade", "up"], - description: "Upgrades outdated tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Just print what would be done, don't actually do it", - isRepeatable: false, - }, - { - name: ["-i", "--interactive"], - description: - "Display multiselect menu to choose which tools to upgrade", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-l", "--bump"], - description: - "Upgrades to the latest version available, bumping the version in mise.toml", - isRepeatable: false, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["use", "u"], - description: "Installs a tool and adds the version it to mise.toml.", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["--fuzzy"], - description: "Save fuzzy version to config file", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", - isRepeatable: false, - }, - { - name: ["-e", "--env"], - description: - "Modify an environment-specific config file like .mise..toml", - isRepeatable: false, - args: { - name: "env", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", - isRepeatable: false, - }, - { - name: ["--remove"], - description: "Remove the plugin(s) from config file", - isRepeatable: true, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise plugins --core --user`, - ), - }, - }, - { - name: ["-p", "--path"], - description: "Specify a path to a config file or directory", - isRepeatable: false, - args: { - name: "path", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["--pin"], - description: - "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to add to config file", - isOptional: true, - isVariadic: true, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["version", "v"], - description: "Display the version of mise", - }, - { - name: ["watch", "w"], - description: "Run task(s) and watch for changes to rerun it", - options: [ - { - name: ["-t", "--task"], - description: "Tasks to run", - isRepeatable: true, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise tasks | awk '{print $1}'`, - ), - }, - }, - { - name: ["-g", "--glob"], - description: "Files to watch\nDefaults to sources from the tasks(s)", - isRepeatable: true, - args: { - name: "glob", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "args", - description: "Extra arguments", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["where"], - description: "Display the installation path for a tool", - args: [ - { - name: "tool@version", - description: - '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', - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') - - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - ], - }, - { - name: ["which"], - description: "Shows the path that a tool's bin points to.", - options: [ - { - name: ["--plugin"], - description: "Show the plugin name instead of the path", - isRepeatable: false, - }, - { - name: ["--version"], - description: "Show the version instead of the path", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: - "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", - isRepeatable: false, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate(` -cur="{{words[CURRENT]}}" -case $cur in - *@*) - tool="$(echo "$cur" | cut -d'@' -f1)" - prefix="$(echo "$cur" | cut -d'@' -f2)" - - versions=$(mise ls-remote $tool $prefix | sed '1!G;h;$!d') + const suggestions: Fig.Suggestion[] = []; + Object.keys(toolsVersions).forEach((k) => { + if (toolsVersions[k].length == 1) { + suggestions.push({ name: k }); + } else { + suggestions.push({ name: `${k}@` }); + } + }); - for version in $versions; do - echo "$tool@$version" - done - ;; - *) - plugins=$(mise plugins --all) - for plugin in $plugins; do - echo "$plugin@" - done - ;; -esac -`), - }, - }, - ], - args: [ - { - name: "bin_name", - description: "The bin to look up", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["-C", "--cd"], - description: "Change directory before running command", - isRepeatable: false, - args: { - name: "dir", - isOptional: false, - isVariadic: false, - template: "folders", - }, - }, - { - name: ["-P", "--profile"], - description: "Set the profile (environment)", - isRepeatable: false, - args: { - name: "profile", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show extra output (use -vv for even more)", - isRepeatable: true, - }, - { - name: ["-y", "--yes"], - description: "Answer yes to all confirmation prompts", - isRepeatable: false, - }, - ], + return suggestions; + }, }; -export default completionSpec; - const usageGenerateSpec = (cmds: string[]) => { - return async ( - context: string[], - executeCommand: Fig.ExecuteCommandFunction, - ): Promise => { - const promises = cmds.map(async (cmd): Promise => { - try { - const args = cmd.split(" "); - const { - stdout, - stderr: cmdStderr, - status: cmdStatus, - } = await executeCommand({ - command: args[0], - args: args.splice(1), - }); - if (cmdStatus !== 0) { - return [{ name: "error", description: cmdStderr }]; - } - const { - stdout: figSpecOut, - stderr: figSpecStderr, - status: usageFigStatus, - } = await executeCommand({ - command: "usage", - args: ["g", "fig", "--spec", stdout], + return async (context: string[], executeCommand: Fig.ExecuteCommandFunction): Promise => { + const promises = cmds.map(async (cmd): Promise => { + try { + const args = cmd.split(" "); + const { stdout, stderr: cmdStderr, status: cmdStatus, } = await executeCommand({ + command: args[0], + args: args.splice(1), + }); + if (cmdStatus !== 0) { + return [{ name: "error", description: cmdStderr }]; + } + const { stdout: figSpecOut, stderr: figSpecStderr, status: usageFigStatus, } = await executeCommand({ + command: "usage", + args: ["g", "fig", "--spec", stdout], + }); + if (usageFigStatus !== 0) { + return [{ name: "error", description: figSpecStderr }]; + } + const start_of_json = figSpecOut.indexOf("{"); + const j = figSpecOut.slice(start_of_json); + return JSON.parse(j).subcommands as Fig.Subcommand[]; + } + catch (e) { + return [{ name: "error", description: e }] as Fig.Subcommand[]; + } }); - if (usageFigStatus !== 0) { - return [{ name: "error", description: figSpecStderr }]; - } - const start_of_json = figSpecOut.indexOf("{"); - const j = figSpecOut.slice(start_of_json); - return JSON.parse(j).subcommands as Fig.Subcommand[]; - } catch (e) { - return [{ name: "error", description: e }] as Fig.Subcommand[]; - } - }); - // eslint-disable-next-line compat/compat - const results = await Promise.allSettled(promises); - const subcommands = results - .filter((p) => p.status === "fulfilled") - .map((p) => p.value); - const failed = results - .filter((p) => p.status === "rejected") - .map((p) => ({ name: "error", description: p.reason })); - return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; - }; + // eslint-disable-next-line compat/compat + const results = await Promise.allSettled(promises); + const subcommands = results + .filter((p) => p.status === "fulfilled") + .map((p) => p.value); + const failed = results + .filter((p) => p.status === "rejected") + .map((p) => ({ name: "error", description: p.reason })); + return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; + }; }; -const completionGeneratorTemplate = ( - argSuggestionBash: string, -): Fig.Generator => { - return { - custom: async (tokens: string[], executeCommand) => { - let arg = argSuggestionBash; - if (tokens.length >= 1) { - arg = argSuggestionBash.replace( - "{{words[CURRENT]}}", - tokens[tokens.length - 1], - ); - } - if (tokens.length >= 2) { - arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); - } - const { stdout: text } = await executeCommand({ - command: "sh", - args: ["-c", arg], - }); - if (text.trim().length == 0) return []; - return text.split("\n").map((elm) => ({ name: elm })); - }, - }; +const completionGeneratorTemplate = (argSuggestionBash: string): Fig.Generator => { + return { + custom: async (tokens: string[], executeCommand) => { + let arg = argSuggestionBash; + if (tokens.length >= 1) { + arg = argSuggestionBash.replace("{{words[CURRENT]}}", tokens[tokens.length - 1]); + } + if (tokens.length >= 2) { + arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); + } + const { stdout: text } = await executeCommand({ + command: "sh", + args: ["-c", arg], + }); + if (text.trim().length == 0) + return []; + return text.split("\n").map((elm) => ({ name: elm })); + }, + }; }; const completionSpec: Fig.Spec = { - name: ["mise"], - subcommands: [ - { - name: ["activate"], - description: "Initializes mise in the current shell session", - options: [ - { - name: ["--shims"], - description: - "Use shims instead of modifying PATH\nEffectively the same as:", - isRepeatable: false, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - ], - args: [ - { - name: "shell_type", - description: "Shell type to generate the script for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - ], - }, - { - name: ["alias", "a"], - description: "Manage aliases", - subcommands: [ - { - name: ["get"], - description: "Show an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to show the alias for", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - { - name: "alias", - description: "The alias to show", - isOptional: false, - isVariadic: false, - generators: aliasGenerator, - }, - ], - }, - { - name: ["ls", "list"], - description: - "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", - options: [ - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool", - description: "Show aliases for ", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set", "add", "create"], - description: "Add/update an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to set the alias for", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - { - name: "alias", - description: "The alias to set", - isOptional: false, - isVariadic: false, - generators: aliasGenerator, - }, - { - name: "value", - description: "The value to set the alias to", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to remove the alias from", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - { - name: "alias", - description: "The alias to remove", - isOptional: false, - isVariadic: false, - generators: aliasGenerator, - }, - ], - }, - ], - options: [ - { - name: ["-p", "--plugin"], - description: "filter aliases by plugin", - isRepeatable: false, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - }, - { - name: ["backends", "b"], - description: "Manage backends", - subcommands: [ - { - name: ["ls", "list"], - description: "List built-in backends", - }, - ], - }, - { - name: ["bin-paths"], - description: "List all the active runtime bin paths", - }, - { - name: ["cache"], - description: "Manage the mise cache", - subcommands: [ - { - name: ["clear", "c"], - description: "Deletes all cache files in mise", - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["prune", "p"], - description: "Removes stale mise cache files", - options: [ - { - name: ["--dry-run"], - description: "Just show what would be pruned", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show pruned files", - isRepeatable: true, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - ], - }, - { - name: ["completion"], - description: "Generate shell completions", - args: [ - { - name: "shell", - description: "Shell type to generate completions for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "fish", "zsh"], - }, - ], - }, - { - name: ["config", "cfg"], - description: "Manage config files", - subcommands: [ - { - name: ["generate", "g"], - description: "[experimental] Generate a mise.toml file", - options: [ - { - name: ["-o", "--output"], - description: "Output to file instead of stdout", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - ], - }, - { - name: ["get"], - description: "Display the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["ls"], - description: "List config files currently in use", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["set"], - description: "Set the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-t", "--type"], - isRepeatable: false, - args: { - name: "type", - isOptional: false, - isVariadic: false, - suggestions: [ - "infer", - "string", - "integer", - "float", - "bool", - "list", - ], - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: false, - isVariadic: false, - }, - { - name: "value", - description: "The value to set the key to", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["deactivate"], - description: "Disable mise for current shell session", - }, - { - name: ["direnv"], - description: "Output direnv function to use mise inside direnv", - subcommands: [ - { - name: ["activate"], - description: "Output direnv function to use mise inside direnv", - }, - ], - }, - { - name: ["doctor", "dr"], - description: "Check mise installation for possible problems", - }, - { - name: ["env", "e"], - description: "Exports env vars to activate mise a single time", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-s", "--shell"], - description: "Shell type to generate environment variables for", - isRepeatable: false, - args: { - name: "shell", - isOptional: false, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["exec", "x"], - description: "Execute a command with tool(s) set", - options: [ - { - name: ["-c", "--command"], - description: "Command string to execute", - isRepeatable: false, - args: { - name: "c", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to start e.g.: node@20 python@3.10", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - { - name: "command", - description: "Command string to execute (same as --command)", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["generate", "g"], - description: "[experimental] Generate files for various tools/services", - subcommands: [ - { - name: ["git-pre-commit", "pre-commit"], - description: "[experimental] Generate a git pre-commit hook", - options: [ - { - name: ["--hook"], - description: "Which hook to generate (saves to .git/hooks/$hook)", - isRepeatable: false, - args: { - name: "hook", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: - "The task to run when the pre-commit hook is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - }, - { - name: ["-w", "--write"], - description: - "write to .git/hooks/pre-commit and make it executable", - isRepeatable: false, - }, - ], - }, - { - name: ["github-action"], - description: "[experimental] Generate a GitHub Action workflow file", - options: [ - { - name: ["-n", "--name"], - description: "the name of the workflow to generate", - isRepeatable: false, - args: { - name: "name", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: "The task to run when the workflow is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - }, - { - name: ["-w", "--write"], - description: "write to .github/workflows/$name.yml", - isRepeatable: false, - }, - ], - }, - { - name: ["task-docs"], - description: "Generate documentation for tasks in a project", - options: [ - { - name: ["-I", "--index"], - description: - "write only an index of tasks, intended for use with `--multi`", - isRepeatable: false, - }, - { - name: ["-i", "--inject"], - description: "inserts the documentation into an existing file", - isRepeatable: false, - }, - { - name: ["-m", "--multi"], - description: - "render each task as a separate document, requires `--output` to be a directory", - isRepeatable: false, - }, - { - name: ["-o", "--output"], - description: "writes the generated docs to a file/directory", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--root"], - description: "root directory to search for tasks", - isRepeatable: false, - args: { - name: "root", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-s", "--style"], - isRepeatable: false, - args: { - name: "style", - isOptional: false, - isVariadic: false, - suggestions: ["simple", "detailed"], - }, - }, - ], - }, - ], - }, - { - name: ["implode"], - description: "Removes mise CLI and all related data", - options: [ - { - name: ["--config"], - description: "Also remove config directory", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: - "List directories that would be removed without actually removing them", - isRepeatable: false, - }, - ], - }, - { - name: ["install", "i"], - description: "Install a tool version", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to install e.g.: node@20", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["latest"], - description: "Gets the latest available version for a plugin", - options: [ - { - name: ["-i", "--installed"], - description: "Show latest installed instead of available version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool to get the latest version of", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a tool version into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite an existing tool version if it exists", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool name and version to create a symlink for", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - { - name: "path", - description: - "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed and active tool versions", - options: [ - { - name: ["-c", "--current"], - description: - "Only show tool versions currently specified in a mise.toml", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Only show tool versions currently specified in the global mise.toml", - isRepeatable: false, - }, - { - name: ["-i", "--installed"], - description: - "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", - isRepeatable: false, - }, - { - name: ["-o", "--offline"], - description: "Don't fetch information such as outdated versions", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-m", "--missing"], - description: "Display missing tool versions", - isRepeatable: false, - }, - { - name: ["--prefix"], - description: "Display versions matching this prefix", - isRepeatable: false, - args: { - name: "prefix", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - }, - { - name: ["--no-header"], - description: "Don't display headers", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Only show tool versions from [PLUGIN]", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["ls-remote"], - description: "List runtime versions available for install.", - options: [ - { - name: ["--all"], - description: "Show all installed plugins and versions", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Plugin to get versions for", - isOptional: true, - isVariadic: false, - generators: toolVersionGenerator, - }, - { - name: "prefix", - description: - 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - ], - }, - { - name: ["outdated"], - description: "Shows outdated tool versions", - options: [ - { - name: ["-l", "--bump"], - description: - "Compares against the latest versions available, not what matches the current config", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "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", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["plugins", "p"], - description: "Manage plugins", - subcommands: [ - { - name: ["install", "i", "a", "add"], - description: "Install a plugin", - options: [ - { - name: ["-f", "--force"], - description: "Reinstall even if plugin exists", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: - "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "new_plugin", - description: - "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate(`mise plugins --all`), - }, - { - name: "git_url", - description: "The git url of the plugin", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a plugin into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite existing plugin", - isRepeatable: false, - }, - ], - args: [ - { - name: "name", - description: "The name of the plugin\ne.g.: node, ruby", - isOptional: false, - isVariadic: false, - }, - { - name: "path", - description: "The local path to the plugin\ne.g.: ./mise-node", - isOptional: true, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed plugins", - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["ls-remote", "list-remote", "list-all"], - description: "List all available remote plugins", - options: [ - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", - isRepeatable: false, - }, - { - name: ["--only-names"], - description: - 'Only show the name of each plugin by default it will show a "*" next to installed plugins', - isRepeatable: false, - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes a plugin", - options: [ - { - name: ["-p", "--purge"], - description: - "Also remove the plugin's installs, downloads, and cache", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: "Remove all plugins", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to remove", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["update", "up", "upgrade"], - description: "Updates a plugin to the latest version", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\nDefault: 4", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to update", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - ], - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["prune"], - description: "Delete unused versions of tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - { - name: ["--configs"], - description: - "Prune only tracked and trusted configuration links that point to non-existent configurations", - isRepeatable: false, - }, - { - name: ["--tools"], - description: "Prune only unused versions of tools", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Prune only versions from this plugin(s)", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["registry"], - description: "List available tools to install", - args: [ - { - name: "name", - description: "Show only the specified tool's full name", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["reshim"], - description: - "Creates new shims based on bin paths from currently installed tools.", - options: [ - { - name: ["-f", "--force"], - description: "Removes all shims before reshimming", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - { - name: ["self-update"], - description: "Updates mise itself.", - options: [ - { - name: ["-f", "--force"], - description: "Update even if already up to date", - isRepeatable: false, - }, - { - name: ["--no-plugins"], - description: "Disable auto-updating plugins", - isRepeatable: false, - }, - { - name: ["-y", "--yes"], - description: "Skip confirmation prompt", - isRepeatable: false, - }, - ], - args: [ - { - name: "version", - description: "Update to a specific version", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set"], - description: "Set environment variables in mise.toml", - options: [ - { - name: ["--file"], - description: "The TOML file to update", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Set the environment variable in the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "env_vars", - description: - "Environment variable(s) to set\ne.g.: NODE_ENV=production", - isOptional: true, - isVariadic: true, - generators: envVarGenerator, - }, - ], - }, - { - name: ["settings"], - description: "Manage settings", - subcommands: [ - { - name: ["add"], - description: "Adds a setting to the configuration file", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["get"], - description: "Show a current setting", - args: [ - { - name: "setting", - description: "The setting to show", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - ], - }, - { - name: ["ls", "list"], - description: "Show current settings", - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["set", "create"], - description: "Add/update a setting", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears a setting", - args: [ - { - name: "setting", - description: "The setting to remove", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - ], - }, - ], - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["shell", "sh"], - description: "Sets a tool version for the current session.", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-u", "--unset"], - description: "Removes a previously set version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["sync"], - description: "Add tool versions from external tools to mise", - subcommands: [ - { - name: ["node"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--brew"], - description: "Get tool versions from Homebrew", - isRepeatable: false, - }, - { - name: ["--nvm"], - description: "Get tool versions from nvm", - isRepeatable: false, - }, - { - name: ["--nodenv"], - description: "Get tool versions from nodenv", - isRepeatable: false, - }, - ], - }, - { - name: ["python"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--pyenv"], - description: "Get tool versions from pyenv", - isRepeatable: false, - }, - ], - }, - ], - }, - { - name: ["tasks", "t"], - description: "Manage tasks", - subcommands: [ - { - name: ["deps"], - description: "Display a tree visualization of a dependency graph", - options: [ - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--dot"], - description: "Display dependencies in DOT format", - isRepeatable: false, - }, - ], - args: [ - { - name: "tasks", - description: - "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["edit"], - description: "Edit a tasks with $EDITOR", - options: [ - { - name: ["-p", "--path"], - description: - "Display the path to the tasks instead of editing it", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Tasks to edit", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - ], - }, - { - name: ["info"], - description: "Get information about a task", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Name of the task to get information about", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - ], - }, - { - name: ["ls"], - description: - "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.", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: - "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: - "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: - "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", - isOptional: true, - isVariadic: false, - generators: simpleTaskGenerator, - }, - { - name: "args", - description: - 'Arguments to pass to the tasks. Use ":::" to separate tasks', - isOptional: true, - isVariadic: true, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["trust"], - description: "Marks a config file as trusted", - options: [ - { - name: ["-a", "--all"], - description: - "Trust all config files in the current directory and its parents", - isRepeatable: false, - }, - { - name: ["--untrust"], - description: "No longer trust this config", - isRepeatable: false, - }, - { - name: ["--show"], - description: - "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", - isRepeatable: false, - }, - ], - args: [ - { - name: "config_file", - description: "The config file to trust", - isOptional: true, - isVariadic: false, - template: "filepaths", - generators: configPathGenerator, - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes installed tool versions", - options: [ - { - name: ["-a", "--all"], - description: "Delete all installed versions", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - ], - args: [ - { - name: "installed_tool@version", - description: "Tool(s) to remove", - isOptional: true, - isVariadic: true, - generators: installedToolVersionGenerator, - }, - ], - }, - { - name: ["unset"], - description: "Remove environment variable(s) from the config file.", - options: [ - { - name: ["-f", "--file"], - description: "Specify a file to use instead of `mise.toml`", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Use the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "keys", - description: "Environment variable(s) to remove\ne.g.: NODE_ENV", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["upgrade", "up"], - description: "Upgrades outdated tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Just print what would be done, don't actually do it", - isRepeatable: false, - }, - { - name: ["-i", "--interactive"], - description: - "Display multiselect menu to choose which tools to upgrade", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-l", "--bump"], - description: - "Upgrades to the latest version available, bumping the version in mise.toml", - isRepeatable: false, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["use", "u"], - description: "Installs a tool and adds the version it to mise.toml.", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["--fuzzy"], - description: "Save fuzzy version to config file", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", - isRepeatable: false, - }, - { - name: ["-e", "--env"], - description: - "Modify an environment-specific config file like .mise..toml", - isRepeatable: false, - args: { - name: "env", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", - isRepeatable: false, - }, - { - name: ["--remove"], - description: "Remove the plugin(s) from config file", - isRepeatable: true, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - }, - { - name: ["-p", "--path"], - description: "Specify a path to a config file or directory", - isRepeatable: false, - args: { - name: "path", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["--pin"], - description: - "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to add to config file", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["version", "v"], - description: "Display the version of mise", - }, - { - name: ["watch", "w"], - description: "Run task(s) and watch for changes to rerun it", - options: [ - { - name: ["-t", "--task"], - description: "Tasks to run", - isRepeatable: true, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - }, - { - name: ["-g", "--glob"], - description: "Files to watch\nDefaults to sources from the tasks(s)", - isRepeatable: true, - args: { - name: "glob", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "args", - description: "Extra arguments", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["where"], - description: "Display the installation path for a tool", - args: [ - { - name: "tool@version", - description: - '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', - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["which"], - description: "Shows the path that a tool's bin points to.", - options: [ - { - name: ["--plugin"], - description: "Show the plugin name instead of the path", - isRepeatable: false, - }, - { - name: ["--version"], - description: "Show the version instead of the path", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: - "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", - isRepeatable: false, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - }, - ], - args: [ - { - name: "bin_name", - description: "The bin to look up", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["-C", "--cd"], - description: "Change directory before running command", - isRepeatable: false, - args: { - name: "dir", - isOptional: false, - isVariadic: false, - template: "folders", - }, - }, - { - name: ["-P", "--profile"], - description: "Set the profile (environment)", - isRepeatable: false, - args: { - name: "profile", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show extra output (use -vv for even more)", - isRepeatable: true, - }, - { - name: ["-y", "--yes"], - description: "Answer yes to all confirmation prompts", - isRepeatable: false, - }, - ], + "name": [ + "mise" + ], + "subcommands": [ + { + "name": [ + "activate" + ], + "description": "Initializes mise in the current shell session", + "options": [ + { + "name": [ + "--shims" + ], + "description": "Use shims instead of modifying PATH\nEffectively the same as:", + "isRepeatable": false + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress non-error messages", + "isRepeatable": false + } + ], + "args": [ + { + "name": "shell_type", + "description": "Shell type to generate the script for", + "isOptional": true, + "isVariadic": false, + "suggestions": [ + "bash", + "elvish", + "fish", + "nu", + "xonsh", + "zsh" + ] + } + ] + }, + { + "name": [ + "alias", + "a" + ], + "description": "Manage aliases", + "subcommands": [ + { + "name": [ + "get" + ], + "description": "Show an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to show the alias for", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + }, + { + "name": "alias", + "description": "The alias to show", + "isOptional": false, + "isVariadic": false, + "generators": aliasGenerator + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool", + "description": "Show aliases for ", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "set", + "add", + "create" + ], + "description": "Add/update an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to set the alias for", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + }, + { + "name": "alias", + "description": "The alias to set", + "isOptional": false, + "isVariadic": false, + "generators": aliasGenerator + }, + { + "name": "value", + "description": "The value to set the alias to", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "unset", + "rm", + "remove", + "delete", + "del" + ], + "description": "Clears an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to remove the alias from", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + }, + { + "name": "alias", + "description": "The alias to remove", + "isOptional": false, + "isVariadic": false, + "generators": aliasGenerator + } + ] + } + ], + "options": [ + { + "name": [ + "-p", + "--plugin" + ], + "description": "filter aliases by plugin", + "isRepeatable": false, + "args": { + "name": "plugin", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + } + }, + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ] + }, + { + "name": [ + "backends", + "b" + ], + "description": "Manage backends", + "subcommands": [ + { + "name": [ + "ls", + "list" + ], + "description": "List built-in backends" + } + ] + }, + { + "name": [ + "bin-paths" + ], + "description": "List all the active runtime bin paths" + }, + { + "name": [ + "cache" + ], + "description": "Manage the mise cache", + "subcommands": [ + { + "name": [ + "clear", + "c" + ], + "description": "Deletes all cache files in mise", + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to clear cache for e.g.: node, python", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "prune", + "p" + ], + "description": "Removes stale mise cache files", + "options": [ + { + "name": [ + "--dry-run" + ], + "description": "Just show what would be pruned", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show pruned files", + "isRepeatable": true + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to clear cache for e.g.: node, python", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + } + ] + }, + { + "name": [ + "completion" + ], + "description": "Generate shell completions", + "args": [ + { + "name": "shell", + "description": "Shell type to generate completions for", + "isOptional": true, + "isVariadic": false, + "suggestions": [ + "bash", + "fish", + "zsh" + ] + } + ] + }, + { + "name": [ + "config", + "cfg" + ], + "description": "Manage config files", + "subcommands": [ + { + "name": [ + "generate", + "g" + ], + "description": "[experimental] Generate a mise.toml file", + "options": [ + { + "name": [ + "-o", + "--output" + ], + "description": "Output to file instead of stdout", + "isRepeatable": false, + "args": { + "name": "output", + "isOptional": false, + "isVariadic": false + } + } + ] + }, + { + "name": [ + "get" + ], + "description": "Display the value of a setting in a mise.toml file", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "The path to the mise.toml file to edit", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + } + ], + "args": [ + { + "name": "key", + "description": "The path of the config to display", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "ls" + ], + "description": "List config files currently in use", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "set" + ], + "description": "Set the value of a setting in a mise.toml file", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "The path to the mise.toml file to edit", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-t", + "--type" + ], + "isRepeatable": false, + "args": { + "name": "type", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "infer", + "string", + "integer", + "float", + "bool", + "list" + ] + } + } + ], + "args": [ + { + "name": "key", + "description": "The path of the config to display", + "isOptional": false, + "isVariadic": false + }, + { + "name": "value", + "description": "The value to set the key to", + "isOptional": false, + "isVariadic": false + } + ] + } + ], + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "deactivate" + ], + "description": "Disable mise for current shell session" + }, + { + "name": [ + "direnv" + ], + "description": "Output direnv function to use mise inside direnv", + "subcommands": [ + { + "name": [ + "activate" + ], + "description": "Output direnv function to use mise inside direnv" + } + ] + }, + { + "name": [ + "doctor", + "dr" + ], + "description": "Check mise installation for possible problems" + }, + { + "name": [ + "env", + "e" + ], + "description": "Exports env vars to activate mise a single time", + "options": [ + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "-s", + "--shell" + ], + "description": "Shell type to generate environment variables for", + "isRepeatable": false, + "args": { + "name": "shell", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "bash", + "elvish", + "fish", + "nu", + "xonsh", + "zsh" + ] + } + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to use", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "exec", + "x" + ], + "description": "Execute a command with tool(s) set", + "options": [ + { + "name": [ + "-c", + "--command" + ], + "description": "Command string to execute", + "isRepeatable": false, + "args": { + "name": "c", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to start e.g.: node@20 python@3.10", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + }, + { + "name": "command", + "description": "Command string to execute (same as --command)", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "generate", + "g" + ], + "description": "[experimental] Generate files for various tools/services", + "subcommands": [ + { + "name": [ + "git-pre-commit", + "pre-commit" + ], + "description": "[experimental] Generate a git pre-commit hook", + "options": [ + { + "name": [ + "--hook" + ], + "description": "Which hook to generate (saves to .git/hooks/$hook)", + "isRepeatable": false, + "args": { + "name": "hook", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-t", + "--task" + ], + "description": "The task to run when the pre-commit hook is triggered", + "isRepeatable": false, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + }, + { + "name": [ + "-w", + "--write" + ], + "description": "write to .git/hooks/pre-commit and make it executable", + "isRepeatable": false + } + ] + }, + { + "name": [ + "github-action" + ], + "description": "[experimental] Generate a GitHub Action workflow file", + "options": [ + { + "name": [ + "-n", + "--name" + ], + "description": "the name of the workflow to generate", + "isRepeatable": false, + "args": { + "name": "name", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-t", + "--task" + ], + "description": "The task to run when the workflow is triggered", + "isRepeatable": false, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + }, + { + "name": [ + "-w", + "--write" + ], + "description": "write to .github/workflows/$name.yml", + "isRepeatable": false + } + ] + }, + { + "name": [ + "task-docs" + ], + "description": "Generate documentation for tasks in a project", + "options": [ + { + "name": [ + "-I", + "--index" + ], + "description": "write only an index of tasks, intended for use with `--multi`", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--inject" + ], + "description": "inserts the documentation into an existing file", + "isRepeatable": false + }, + { + "name": [ + "-m", + "--multi" + ], + "description": "render each task as a separate document, requires `--output` to be a directory", + "isRepeatable": false + }, + { + "name": [ + "-o", + "--output" + ], + "description": "writes the generated docs to a file/directory", + "isRepeatable": false, + "args": { + "name": "output", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--root" + ], + "description": "root directory to search for tasks", + "isRepeatable": false, + "args": { + "name": "root", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-s", + "--style" + ], + "isRepeatable": false, + "args": { + "name": "style", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "simple", + "detailed" + ] + } + } + ] + } + ] + }, + { + "name": [ + "implode" + ], + "description": "Removes mise CLI and all related data", + "options": [ + { + "name": [ + "--config" + ], + "description": "Also remove config directory", + "isRepeatable": false + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "List directories that would be removed without actually removing them", + "isRepeatable": false + } + ] + }, + { + "name": [ + "install", + "i" + ], + "description": "Install a tool version", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Force reinstall even if already installed", + "isRepeatable": false + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show installation output", + "isRepeatable": true + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to install e.g.: node@20", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "latest" + ], + "description": "Gets the latest available version for a plugin", + "options": [ + { + "name": [ + "-i", + "--installed" + ], + "description": "Show latest installed instead of available version", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool to get the latest version of", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "link", + "ln" + ], + "description": "Symlinks a tool version into mise", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Overwrite an existing tool version if it exists", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool name and version to create a symlink for", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + }, + { + "name": "path", + "description": "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List installed and active tool versions", + "options": [ + { + "name": [ + "-c", + "--current" + ], + "description": "Only show tool versions currently specified in a mise.toml", + "isRepeatable": false + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Only show tool versions currently specified in the global mise.toml", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--installed" + ], + "description": "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", + "isRepeatable": false + }, + { + "name": [ + "-o", + "--offline" + ], + "description": "Don't fetch information such as outdated versions", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "-m", + "--missing" + ], + "description": "Display missing tool versions", + "isRepeatable": false + }, + { + "name": [ + "--prefix" + ], + "description": "Display versions matching this prefix", + "isRepeatable": false, + "args": { + "name": "prefix", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) + } + }, + { + "name": [ + "--no-header" + ], + "description": "Don't display headers", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Only show tool versions from [PLUGIN]", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "ls-remote" + ], + "description": "List runtime versions available for install.", + "options": [ + { + "name": [ + "--all" + ], + "description": "Show all installed plugins and versions", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Plugin to get versions for", + "isOptional": true, + "isVariadic": false, + "generators": toolVersionGenerator + }, + { + "name": "prefix", + "description": "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\"", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) + } + ] + }, + { + "name": [ + "outdated" + ], + "description": "Shows outdated tool versions", + "options": [ + { + "name": [ + "-l", + "--bump" + ], + "description": "Compares against the latest versions available, not what matches the current config", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "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", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "plugins", + "p" + ], + "description": "Manage plugins", + "subcommands": [ + { + "name": [ + "install", + "i", + "a", + "add" + ], + "description": "Install a plugin", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Reinstall even if plugin exists", + "isRepeatable": false + }, + { + "name": [ + "-a", + "--all" + ], + "description": "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show installation output", + "isRepeatable": true + } + ], + "args": [ + { + "name": "new_plugin", + "description": "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise plugins --all`) + }, + { + "name": "git_url", + "description": "The git url of the plugin", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "link", + "ln" + ], + "description": "Symlinks a plugin into mise", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Overwrite existing plugin", + "isRepeatable": false + } + ], + "args": [ + { + "name": "name", + "description": "The name of the plugin\ne.g.: node, ruby", + "isOptional": false, + "isVariadic": false + }, + { + "name": "path", + "description": "The local path to the plugin\ne.g.: ./mise-node", + "isOptional": true, + "isVariadic": false, + "template": "filepaths" + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List installed plugins", + "options": [ + { + "name": [ + "-c", + "--core" + ], + "description": "The built-in plugins only\nNormally these are not shown", + "isRepeatable": false + }, + { + "name": [ + "--user" + ], + "description": "List installed plugins", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + "isRepeatable": false + } + ] + }, + { + "name": [ + "ls-remote", + "list-remote", + "list-all" + ], + "description": "List all available remote plugins", + "options": [ + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", + "isRepeatable": false + }, + { + "name": [ + "--only-names" + ], + "description": "Only show the name of each plugin by default it will show a \"*\" next to installed plugins", + "isRepeatable": false + } + ] + }, + { + "name": [ + "uninstall", + "remove", + "rm" + ], + "description": "Removes a plugin", + "options": [ + { + "name": [ + "-p", + "--purge" + ], + "description": "Also remove the plugin's installs, downloads, and cache", + "isRepeatable": false + }, + { + "name": [ + "-a", + "--all" + ], + "description": "Remove all plugins", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to remove", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "update", + "up", + "upgrade" + ], + "description": "Updates a plugin to the latest version", + "options": [ + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\nDefault: 4", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to update", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + } + ], + "options": [ + { + "name": [ + "-c", + "--core" + ], + "description": "The built-in plugins only\nNormally these are not shown", + "isRepeatable": false + }, + { + "name": [ + "--user" + ], + "description": "List installed plugins", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + "isRepeatable": false + } + ] + }, + { + "name": [ + "prune" + ], + "description": "Delete unused versions of tools", + "options": [ + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Do not actually delete anything", + "isRepeatable": false + }, + { + "name": [ + "--configs" + ], + "description": "Prune only tracked and trusted configuration links that point to non-existent configurations", + "isRepeatable": false + }, + { + "name": [ + "--tools" + ], + "description": "Prune only unused versions of tools", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Prune only versions from this plugin(s)", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "registry" + ], + "description": "List available tools to install", + "args": [ + { + "name": "name", + "description": "Show only the specified tool's full name", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "reshim" + ], + "description": "Creates new shims based on bin paths from currently installed tools.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Removes all shims before reshimming", + "isRepeatable": false + } + ] + }, + { + "name": [ + "run", + "r" + ], + "description": "Run task(s)", + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change to this directory before executing the command", + "isRepeatable": false, + "args": { + "name": "cd", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Don't actually run the tasks(s), just print them in order of execution", + "isRepeatable": false + }, + { + "name": [ + "-f", + "--force" + ], + "description": "Force the tasks to run even if outputs are up to date", + "isRepeatable": false + }, + { + "name": [ + "-p", + "--prefix" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interleave" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Tool(s) to also add e.g.: node@20 python@3.10", + "isRepeatable": true, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--raw" + ], + "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + "isRepeatable": false + }, + { + "name": [ + "--timings" + ], + "description": "Shows elapsed time after each task completes", + "isRepeatable": false + } + ], + "generateSpec": usageGenerateSpec(["mise tasks --usage"]), + "cache": false + }, + { + "name": [ + "self-update" + ], + "description": "Updates mise itself.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Update even if already up to date", + "isRepeatable": false + }, + { + "name": [ + "--no-plugins" + ], + "description": "Disable auto-updating plugins", + "isRepeatable": false + }, + { + "name": [ + "-y", + "--yes" + ], + "description": "Skip confirmation prompt", + "isRepeatable": false + } + ], + "args": [ + { + "name": "version", + "description": "Update to a specific version", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "set" + ], + "description": "Set environment variables in mise.toml", + "options": [ + { + "name": [ + "--file" + ], + "description": "The TOML file to update", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Set the environment variable in the global config file", + "isRepeatable": false + } + ], + "args": [ + { + "name": "env_vars", + "description": "Environment variable(s) to set\ne.g.: NODE_ENV=production", + "isOptional": true, + "isVariadic": true, + "generators": envVarGenerator + } + ] + }, + { + "name": [ + "settings" + ], + "description": "Manage settings", + "subcommands": [ + { + "name": [ + "add" + ], + "description": "Adds a setting to the configuration file", + "args": [ + { + "name": "setting", + "description": "The setting to set", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + }, + { + "name": "value", + "description": "The value to set", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "get" + ], + "description": "Show a current setting", + "args": [ + { + "name": "setting", + "description": "The setting to show", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "Show current settings", + "options": [ + { + "name": [ + "--keys" + ], + "description": "Only display key names for each setting", + "isRepeatable": false + } + ] + }, + { + "name": [ + "set", + "create" + ], + "description": "Add/update a setting", + "args": [ + { + "name": "setting", + "description": "The setting to set", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + }, + { + "name": "value", + "description": "The value to set", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "unset", + "rm", + "remove", + "delete", + "del" + ], + "description": "Clears a setting", + "args": [ + { + "name": "setting", + "description": "The setting to remove", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + } + ] + } + ], + "options": [ + { + "name": [ + "--keys" + ], + "description": "Only display key names for each setting", + "isRepeatable": false + } + ] + }, + { + "name": [ + "shell", + "sh" + ], + "description": "Sets a tool version for the current session.", + "options": [ + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--unset" + ], + "description": "Removes a previously set version", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to use", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "sync" + ], + "description": "Add tool versions from external tools to mise", + "subcommands": [ + { + "name": [ + "node" + ], + "description": "Symlinks all tool versions from an external tool into mise", + "options": [ + { + "name": [ + "--brew" + ], + "description": "Get tool versions from Homebrew", + "isRepeatable": false + }, + { + "name": [ + "--nvm" + ], + "description": "Get tool versions from nvm", + "isRepeatable": false + }, + { + "name": [ + "--nodenv" + ], + "description": "Get tool versions from nodenv", + "isRepeatable": false + } + ] + }, + { + "name": [ + "python" + ], + "description": "Symlinks all tool versions from an external tool into mise", + "options": [ + { + "name": [ + "--pyenv" + ], + "description": "Get tool versions from pyenv", + "isRepeatable": false + } + ] + } + ] + }, + { + "name": [ + "tasks", + "t" + ], + "description": "Manage tasks", + "subcommands": [ + { + "name": [ + "deps" + ], + "description": "Display a tree visualization of a dependency graph", + "options": [ + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--dot" + ], + "description": "Display dependencies in DOT format", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tasks", + "description": "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "edit" + ], + "description": "Edit a tasks with $EDITOR", + "options": [ + { + "name": [ + "-p", + "--path" + ], + "description": "Display the path to the tasks instead of editing it", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Tasks to edit", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + ] + }, + { + "name": [ + "info" + ], + "description": "Get information about a task", + "options": [ + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Name of the task to get information about", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + ] + }, + { + "name": [ + "ls" + ], + "description": "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.", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-x", + "--extended" + ], + "description": "Show all columns", + "isRepeatable": false + }, + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--sort" + ], + "description": "Sort by column. Default is name.", + "isRepeatable": false, + "args": { + "name": "column", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "name", + "alias", + "description", + "source" + ] + } + }, + { + "name": [ + "--sort-order" + ], + "description": "Sort order. Default is asc.", + "isRepeatable": false, + "args": { + "name": "sort_order", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "asc", + "desc" + ] + } + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "run", + "r" + ], + "description": "Run task(s)", + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change to this directory before executing the command", + "isRepeatable": false, + "args": { + "name": "cd", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Don't actually run the tasks(s), just print them in order of execution", + "isRepeatable": false + }, + { + "name": [ + "-f", + "--force" + ], + "description": "Force the tasks to run even if outputs are up to date", + "isRepeatable": false + }, + { + "name": [ + "-p", + "--prefix" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interleave" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Tool(s) to also add e.g.: node@20 python@3.10", + "isRepeatable": true, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--raw" + ], + "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + "isRepeatable": false + }, + { + "name": [ + "--timings" + ], + "description": "Shows elapsed time after each task completes", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", + "isOptional": true, + "isVariadic": false, + "generators": simpleTaskGenerator + }, + { + "name": "args", + "description": "Arguments to pass to the tasks. Use \":::\" to separate tasks", + "isOptional": true, + "isVariadic": true + } + ], + "generateSpec": usageGenerateSpec(["mise tasks --usage"]), + "cache": false + } + ], + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-x", + "--extended" + ], + "description": "Show all columns", + "isRepeatable": false + }, + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--sort" + ], + "description": "Sort by column. Default is name.", + "isRepeatable": false, + "args": { + "name": "column", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "name", + "alias", + "description", + "source" + ] + } + }, + { + "name": [ + "--sort-order" + ], + "description": "Sort order. Default is asc.", + "isRepeatable": false, + "args": { + "name": "sort_order", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "asc", + "desc" + ] + } + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "trust" + ], + "description": "Marks a config file as trusted", + "options": [ + { + "name": [ + "-a", + "--all" + ], + "description": "Trust all config files in the current directory and its parents", + "isRepeatable": false + }, + { + "name": [ + "--untrust" + ], + "description": "No longer trust this config", + "isRepeatable": false + }, + { + "name": [ + "--show" + ], + "description": "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", + "isRepeatable": false + } + ], + "args": [ + { + "name": "config_file", + "description": "The config file to trust", + "isOptional": true, + "isVariadic": false, + "template": "filepaths", + "generators": configPathGenerator + } + ] + }, + { + "name": [ + "uninstall", + "remove", + "rm" + ], + "description": "Removes installed tool versions", + "options": [ + { + "name": [ + "-a", + "--all" + ], + "description": "Delete all installed versions", + "isRepeatable": false + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Do not actually delete anything", + "isRepeatable": false + } + ], + "args": [ + { + "name": "installed_tool@version", + "description": "Tool(s) to remove", + "isOptional": true, + "isVariadic": true, + "generators": installedToolVersionGenerator + } + ] + }, + { + "name": [ + "unset" + ], + "description": "Remove environment variable(s) from the config file.", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "Specify a file to use instead of `mise.toml`", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Use the global config file", + "isRepeatable": false + } + ], + "args": [ + { + "name": "keys", + "description": "Environment variable(s) to remove\ne.g.: NODE_ENV", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "upgrade", + "up" + ], + "description": "Upgrades outdated tools", + "options": [ + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Just print what would be done, don't actually do it", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interactive" + ], + "description": "Display multiselect menu to choose which tools to upgrade", + "isRepeatable": false + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-l", + "--bump" + ], + "description": "Upgrades to the latest version available, bumping the version in mise.toml", + "isRepeatable": false + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "use", + "u" + ], + "description": "Installs a tool and adds the version it to mise.toml.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Force reinstall even if already installed", + "isRepeatable": false + }, + { + "name": [ + "--fuzzy" + ], + "description": "Save fuzzy version to config file", + "isRepeatable": false + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", + "isRepeatable": false + }, + { + "name": [ + "-e", + "--env" + ], + "description": "Modify an environment-specific config file like .mise..toml", + "isRepeatable": false, + "args": { + "name": "env", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", + "isRepeatable": false + }, + { + "name": [ + "--remove" + ], + "description": "Remove the plugin(s) from config file", + "isRepeatable": true, + "args": { + "name": "plugin", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + } + }, + { + "name": [ + "-p", + "--path" + ], + "description": "Specify a path to a config file or directory", + "isRepeatable": false, + "args": { + "name": "path", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "--pin" + ], + "description": "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to add to config file", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "version", + "v" + ], + "description": "Display the version of mise" + }, + { + "name": [ + "watch", + "w" + ], + "description": "Run task(s) and watch for changes to rerun it", + "options": [ + { + "name": [ + "-t", + "--task" + ], + "description": "Tasks to run", + "isRepeatable": true, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + }, + { + "name": [ + "-g", + "--glob" + ], + "description": "Files to watch\nDefaults to sources from the tasks(s)", + "isRepeatable": true, + "args": { + "name": "glob", + "isOptional": false, + "isVariadic": false + } + } + ], + "args": [ + { + "name": "args", + "description": "Extra arguments", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "where" + ], + "description": "Display the installation path for a tool", + "args": [ + { + "name": "tool@version", + "description": "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", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "which" + ], + "description": "Shows the path that a tool's bin points to.", + "options": [ + { + "name": [ + "--plugin" + ], + "description": "Show the plugin name instead of the path", + "isRepeatable": false + }, + { + "name": [ + "--version" + ], + "description": "Show the version instead of the path", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", + "isRepeatable": false, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + } + ], + "args": [ + { + "name": "bin_name", + "description": "The bin to look up", + "isOptional": false, + "isVariadic": false + } + ] + } + ], + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change directory before running command", + "isRepeatable": false, + "args": { + "name": "dir", + "isOptional": false, + "isVariadic": false, + "template": "folders" + } + }, + { + "name": [ + "-P", + "--profile" + ], + "description": "Set the profile (environment)", + "isRepeatable": false, + "args": { + "name": "profile", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress non-error messages", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show extra output (use -vv for even more)", + "isRepeatable": true + }, + { + "name": [ + "-y", + "--yes" + ], + "description": "Answer yes to all confirmation prompts", + "isRepeatable": false + } + ] }; export default completionSpec; From 73f57011beeaf2d7b3fd5332fa8a524fff02a6f2 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 21:01:21 +0000 Subject: [PATCH 12/14] [autofix.ci] apply automated fixes --- tasks/fig/addCustomGenerators.ts | 6 +- tasks/fig/src/mise.ts | 4558 +++++++++++++----------------- 2 files changed, 2004 insertions(+), 2560 deletions(-) diff --git a/tasks/fig/addCustomGenerators.ts b/tasks/fig/addCustomGenerators.ts index 25b62486b7..cf028ba7d9 100644 --- a/tasks/fig/addCustomGenerators.ts +++ b/tasks/fig/addCustomGenerators.ts @@ -48,7 +48,7 @@ const customGenerators: GeneratorIdentifier[] = [ identifier: "env_vars", generator_name: "envVarGenerator", }, - { + { identifier: "tool@version", generator_name: "toolVersionGenerator", }, @@ -99,7 +99,9 @@ function transformer(context: ts.TransformationContext) { const main = async (fileName: string, outFile?: string) => { try { - const generatorFileContents = (await fsAsync.readFile(path.join(__dirname, "generators.ts"))).toString(); + const generatorFileContents = ( + await fsAsync.readFile(path.join(__dirname, "generators.ts")) + ).toString(); const contents = (await fsAsync.readFile(fileName)).toString(); const sourceFile = ts.createSourceFile( "example.ts", diff --git a/tasks/fig/src/mise.ts b/tasks/fig/src/mise.ts index ee4011c899..d9f84e6a21 100644 --- a/tasks/fig/src/mise.ts +++ b/tasks/fig/src/mise.ts @@ -317,2567 +317,2009 @@ const installedToolVersionGenerator: Fig.Generator = { }; const usageGenerateSpec = (cmds: string[]) => { - return async (context: string[], executeCommand: Fig.ExecuteCommandFunction): Promise => { - const promises = cmds.map(async (cmd): Promise => { - try { - const args = cmd.split(" "); - const { stdout, stderr: cmdStderr, status: cmdStatus, } = await executeCommand({ - command: args[0], - args: args.splice(1), - }); - if (cmdStatus !== 0) { - return [{ name: "error", description: cmdStderr }]; - } - const { stdout: figSpecOut, stderr: figSpecStderr, status: usageFigStatus, } = await executeCommand({ - command: "usage", - args: ["g", "fig", "--spec", stdout], - }); - if (usageFigStatus !== 0) { - return [{ name: "error", description: figSpecStderr }]; - } - const start_of_json = figSpecOut.indexOf("{"); - const j = figSpecOut.slice(start_of_json); - return JSON.parse(j).subcommands as Fig.Subcommand[]; - } - catch (e) { - return [{ name: "error", description: e }] as Fig.Subcommand[]; - } + return async ( + context: string[], + executeCommand: Fig.ExecuteCommandFunction, + ): Promise => { + const promises = cmds.map(async (cmd): Promise => { + try { + const args = cmd.split(" "); + const { + stdout, + stderr: cmdStderr, + status: cmdStatus, + } = await executeCommand({ + command: args[0], + args: args.splice(1), + }); + if (cmdStatus !== 0) { + return [{ name: "error", description: cmdStderr }]; + } + const { + stdout: figSpecOut, + stderr: figSpecStderr, + status: usageFigStatus, + } = await executeCommand({ + command: "usage", + args: ["g", "fig", "--spec", stdout], }); - // eslint-disable-next-line compat/compat - const results = await Promise.allSettled(promises); - const subcommands = results - .filter((p) => p.status === "fulfilled") - .map((p) => p.value); - const failed = results - .filter((p) => p.status === "rejected") - .map((p) => ({ name: "error", description: p.reason })); - return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; - }; + if (usageFigStatus !== 0) { + return [{ name: "error", description: figSpecStderr }]; + } + const start_of_json = figSpecOut.indexOf("{"); + const j = figSpecOut.slice(start_of_json); + return JSON.parse(j).subcommands as Fig.Subcommand[]; + } catch (e) { + return [{ name: "error", description: e }] as Fig.Subcommand[]; + } + }); + // eslint-disable-next-line compat/compat + const results = await Promise.allSettled(promises); + const subcommands = results + .filter((p) => p.status === "fulfilled") + .map((p) => p.value); + const failed = results + .filter((p) => p.status === "rejected") + .map((p) => ({ name: "error", description: p.reason })); + return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; + }; }; -const completionGeneratorTemplate = (argSuggestionBash: string): Fig.Generator => { - return { - custom: async (tokens: string[], executeCommand) => { - let arg = argSuggestionBash; - if (tokens.length >= 1) { - arg = argSuggestionBash.replace("{{words[CURRENT]}}", tokens[tokens.length - 1]); - } - if (tokens.length >= 2) { - arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); - } - const { stdout: text } = await executeCommand({ - command: "sh", - args: ["-c", arg], - }); - if (text.trim().length == 0) - return []; - return text.split("\n").map((elm) => ({ name: elm })); - }, - }; +const completionGeneratorTemplate = ( + argSuggestionBash: string, +): Fig.Generator => { + return { + custom: async (tokens: string[], executeCommand) => { + let arg = argSuggestionBash; + if (tokens.length >= 1) { + arg = argSuggestionBash.replace( + "{{words[CURRENT]}}", + tokens[tokens.length - 1], + ); + } + if (tokens.length >= 2) { + arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); + } + const { stdout: text } = await executeCommand({ + command: "sh", + args: ["-c", arg], + }); + if (text.trim().length == 0) return []; + return text.split("\n").map((elm) => ({ name: elm })); + }, + }; }; const completionSpec: Fig.Spec = { - "name": [ - "mise" - ], - "subcommands": [ - { - "name": [ - "activate" - ], - "description": "Initializes mise in the current shell session", - "options": [ - { - "name": [ - "--shims" - ], - "description": "Use shims instead of modifying PATH\nEffectively the same as:", - "isRepeatable": false - }, - { - "name": [ - "-q", - "--quiet" - ], - "description": "Suppress non-error messages", - "isRepeatable": false - } - ], - "args": [ - { - "name": "shell_type", - "description": "Shell type to generate the script for", - "isOptional": true, - "isVariadic": false, - "suggestions": [ - "bash", - "elvish", - "fish", - "nu", - "xonsh", - "zsh" - ] - } - ] - }, - { - "name": [ - "alias", - "a" - ], - "description": "Manage aliases", - "subcommands": [ - { - "name": [ - "get" - ], - "description": "Show an alias for a plugin", - "args": [ - { - "name": "plugin", - "description": "The plugin to show the alias for", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - }, - { - "name": "alias", - "description": "The alias to show", - "isOptional": false, - "isVariadic": false, - "generators": aliasGenerator - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Don't show table header", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool", - "description": "Show aliases for ", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "set", - "add", - "create" - ], - "description": "Add/update an alias for a plugin", - "args": [ - { - "name": "plugin", - "description": "The plugin to set the alias for", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - }, - { - "name": "alias", - "description": "The alias to set", - "isOptional": false, - "isVariadic": false, - "generators": aliasGenerator - }, - { - "name": "value", - "description": "The value to set the alias to", - "isOptional": false, - "isVariadic": false - } - ] - }, - { - "name": [ - "unset", - "rm", - "remove", - "delete", - "del" - ], - "description": "Clears an alias for a plugin", - "args": [ - { - "name": "plugin", - "description": "The plugin to remove the alias from", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - }, - { - "name": "alias", - "description": "The alias to remove", - "isOptional": false, - "isVariadic": false, - "generators": aliasGenerator - } - ] - } - ], - "options": [ - { - "name": [ - "-p", - "--plugin" - ], - "description": "filter aliases by plugin", - "isRepeatable": false, - "args": { - "name": "plugin", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - } - }, - { - "name": [ - "--no-header" - ], - "description": "Don't show table header", - "isRepeatable": false - } - ] - }, - { - "name": [ - "backends", - "b" - ], - "description": "Manage backends", - "subcommands": [ - { - "name": [ - "ls", - "list" - ], - "description": "List built-in backends" - } - ] - }, - { - "name": [ - "bin-paths" - ], - "description": "List all the active runtime bin paths" - }, - { - "name": [ - "cache" - ], - "description": "Manage the mise cache", - "subcommands": [ - { - "name": [ - "clear", - "c" - ], - "description": "Deletes all cache files in mise", - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to clear cache for e.g.: node, python", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - }, - { - "name": [ - "prune", - "p" - ], - "description": "Removes stale mise cache files", - "options": [ - { - "name": [ - "--dry-run" - ], - "description": "Just show what would be pruned", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show pruned files", - "isRepeatable": true - } - ], - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to clear cache for e.g.: node, python", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - } - ] - }, - { - "name": [ - "completion" - ], - "description": "Generate shell completions", - "args": [ - { - "name": "shell", - "description": "Shell type to generate completions for", - "isOptional": true, - "isVariadic": false, - "suggestions": [ - "bash", - "fish", - "zsh" - ] - } - ] - }, - { - "name": [ - "config", - "cfg" - ], - "description": "Manage config files", - "subcommands": [ - { - "name": [ - "generate", - "g" - ], - "description": "[experimental] Generate a mise.toml file", - "options": [ - { - "name": [ - "-o", - "--output" - ], - "description": "Output to file instead of stdout", - "isRepeatable": false, - "args": { - "name": "output", - "isOptional": false, - "isVariadic": false - } - } - ] - }, - { - "name": [ - "get" - ], - "description": "Display the value of a setting in a mise.toml file", - "options": [ - { - "name": [ - "-f", - "--file" - ], - "description": "The path to the mise.toml file to edit", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - } - ], - "args": [ - { - "name": "key", - "description": "The path of the config to display", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "ls" - ], - "description": "List config files currently in use", - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "set" - ], - "description": "Set the value of a setting in a mise.toml file", - "options": [ - { - "name": [ - "-f", - "--file" - ], - "description": "The path to the mise.toml file to edit", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-t", - "--type" - ], - "isRepeatable": false, - "args": { - "name": "type", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "infer", - "string", - "integer", - "float", - "bool", - "list" - ] - } - } - ], - "args": [ - { - "name": "key", - "description": "The path of the config to display", - "isOptional": false, - "isVariadic": false - }, - { - "name": "value", - "description": "The value to set the key to", - "isOptional": false, - "isVariadic": false - } - ] - } - ], - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "deactivate" - ], - "description": "Disable mise for current shell session" - }, - { - "name": [ - "direnv" - ], - "description": "Output direnv function to use mise inside direnv", - "subcommands": [ - { - "name": [ - "activate" - ], - "description": "Output direnv function to use mise inside direnv" - } - ] - }, - { - "name": [ - "doctor", - "dr" - ], - "description": "Check mise installation for possible problems" - }, - { - "name": [ - "env", - "e" - ], - "description": "Exports env vars to activate mise a single time", - "options": [ - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - }, - { - "name": [ - "-s", - "--shell" - ], - "description": "Shell type to generate environment variables for", - "isRepeatable": false, - "args": { - "name": "shell", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "bash", - "elvish", - "fish", - "nu", - "xonsh", - "zsh" - ] - } - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to use", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "exec", - "x" - ], - "description": "Execute a command with tool(s) set", - "options": [ - { - "name": [ - "-c", - "--command" - ], - "description": "Command string to execute", - "isRepeatable": false, - "args": { - "name": "c", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to start e.g.: node@20 python@3.10", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - }, - { - "name": "command", - "description": "Command string to execute (same as --command)", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "generate", - "g" - ], - "description": "[experimental] Generate files for various tools/services", - "subcommands": [ - { - "name": [ - "git-pre-commit", - "pre-commit" - ], - "description": "[experimental] Generate a git pre-commit hook", - "options": [ - { - "name": [ - "--hook" - ], - "description": "Which hook to generate (saves to .git/hooks/$hook)", - "isRepeatable": false, - "args": { - "name": "hook", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-t", - "--task" - ], - "description": "The task to run when the pre-commit hook is triggered", - "isRepeatable": false, - "args": { - "name": "task", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - }, - { - "name": [ - "-w", - "--write" - ], - "description": "write to .git/hooks/pre-commit and make it executable", - "isRepeatable": false - } - ] - }, - { - "name": [ - "github-action" - ], - "description": "[experimental] Generate a GitHub Action workflow file", - "options": [ - { - "name": [ - "-n", - "--name" - ], - "description": "the name of the workflow to generate", - "isRepeatable": false, - "args": { - "name": "name", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-t", - "--task" - ], - "description": "The task to run when the workflow is triggered", - "isRepeatable": false, - "args": { - "name": "task", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - }, - { - "name": [ - "-w", - "--write" - ], - "description": "write to .github/workflows/$name.yml", - "isRepeatable": false - } - ] - }, - { - "name": [ - "task-docs" - ], - "description": "Generate documentation for tasks in a project", - "options": [ - { - "name": [ - "-I", - "--index" - ], - "description": "write only an index of tasks, intended for use with `--multi`", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--inject" - ], - "description": "inserts the documentation into an existing file", - "isRepeatable": false - }, - { - "name": [ - "-m", - "--multi" - ], - "description": "render each task as a separate document, requires `--output` to be a directory", - "isRepeatable": false - }, - { - "name": [ - "-o", - "--output" - ], - "description": "writes the generated docs to a file/directory", - "isRepeatable": false, - "args": { - "name": "output", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-r", - "--root" - ], - "description": "root directory to search for tasks", - "isRepeatable": false, - "args": { - "name": "root", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-s", - "--style" - ], - "isRepeatable": false, - "args": { - "name": "style", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "simple", - "detailed" - ] - } - } - ] - } - ] - }, - { - "name": [ - "implode" - ], - "description": "Removes mise CLI and all related data", - "options": [ - { - "name": [ - "--config" - ], - "description": "Also remove config directory", - "isRepeatable": false - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "List directories that would be removed without actually removing them", - "isRepeatable": false - } - ] - }, - { - "name": [ - "install", - "i" - ], - "description": "Install a tool version", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Force reinstall even if already installed", - "isRepeatable": false - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show installation output", - "isRepeatable": true - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to install e.g.: node@20", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "latest" - ], - "description": "Gets the latest available version for a plugin", - "options": [ - { - "name": [ - "-i", - "--installed" - ], - "description": "Show latest installed instead of available version", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool to get the latest version of", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "link", - "ln" - ], - "description": "Symlinks a tool version into mise", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Overwrite an existing tool version if it exists", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool name and version to create a symlink for", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - }, - { - "name": "path", - "description": "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "List installed and active tool versions", - "options": [ - { - "name": [ - "-c", - "--current" - ], - "description": "Only show tool versions currently specified in a mise.toml", - "isRepeatable": false - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Only show tool versions currently specified in the global mise.toml", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--installed" - ], - "description": "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", - "isRepeatable": false - }, - { - "name": [ - "-o", - "--offline" - ], - "description": "Don't fetch information such as outdated versions", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - }, - { - "name": [ - "-m", - "--missing" - ], - "description": "Display missing tool versions", - "isRepeatable": false - }, - { - "name": [ - "--prefix" - ], - "description": "Display versions matching this prefix", - "isRepeatable": false, - "args": { - "name": "prefix", - "isOptional": false, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) - } - }, - { - "name": [ - "--no-header" - ], - "description": "Don't display headers", - "isRepeatable": false - } - ], - "args": [ - { - "name": "plugin", - "description": "Only show tool versions from [PLUGIN]", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - }, - { - "name": [ - "ls-remote" - ], - "description": "List runtime versions available for install.", - "options": [ - { - "name": [ - "--all" - ], - "description": "Show all installed plugins and versions", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Plugin to get versions for", - "isOptional": true, - "isVariadic": false, - "generators": toolVersionGenerator - }, - { - "name": "prefix", - "description": "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\"", - "isOptional": true, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) - } - ] - }, - { - "name": [ - "outdated" - ], - "description": "Shows outdated tool versions", - "options": [ - { - "name": [ - "-l", - "--bump" - ], - "description": "Compares against the latest versions available, not what matches the current config", - "isRepeatable": false - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - }, - { - "name": [ - "--no-header" - ], - "description": "Don't show table header", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "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", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "plugins", - "p" - ], - "description": "Manage plugins", - "subcommands": [ - { - "name": [ - "install", - "i", - "a", - "add" - ], - "description": "Install a plugin", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Reinstall even if plugin exists", - "isRepeatable": false - }, - { - "name": [ - "-a", - "--all" - ], - "description": "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show installation output", - "isRepeatable": true - } - ], - "args": [ - { - "name": "new_plugin", - "description": "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", - "isOptional": true, - "isVariadic": false, - "generators": completionGeneratorTemplate(`mise plugins --all`) - }, - { - "name": "git_url", - "description": "The git url of the plugin", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "link", - "ln" - ], - "description": "Symlinks a plugin into mise", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Overwrite existing plugin", - "isRepeatable": false - } - ], - "args": [ - { - "name": "name", - "description": "The name of the plugin\ne.g.: node, ruby", - "isOptional": false, - "isVariadic": false - }, - { - "name": "path", - "description": "The local path to the plugin\ne.g.: ./mise-node", - "isOptional": true, - "isVariadic": false, - "template": "filepaths" - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "List installed plugins", - "options": [ - { - "name": [ - "-c", - "--core" - ], - "description": "The built-in plugins only\nNormally these are not shown", - "isRepeatable": false - }, - { - "name": [ - "--user" - ], - "description": "List installed plugins", - "isRepeatable": false - }, - { - "name": [ - "-u", - "--urls" - ], - "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - "isRepeatable": false - } - ] - }, - { - "name": [ - "ls-remote", - "list-remote", - "list-all" - ], - "description": "List all available remote plugins", - "options": [ - { - "name": [ - "-u", - "--urls" - ], - "description": "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", - "isRepeatable": false - }, - { - "name": [ - "--only-names" - ], - "description": "Only show the name of each plugin by default it will show a \"*\" next to installed plugins", - "isRepeatable": false - } - ] - }, - { - "name": [ - "uninstall", - "remove", - "rm" - ], - "description": "Removes a plugin", - "options": [ - { - "name": [ - "-p", - "--purge" - ], - "description": "Also remove the plugin's installs, downloads, and cache", - "isRepeatable": false - }, - { - "name": [ - "-a", - "--all" - ], - "description": "Remove all plugins", - "isRepeatable": false - } - ], - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to remove", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - }, - { - "name": [ - "update", - "up", - "upgrade" - ], - "description": "Updates a plugin to the latest version", - "options": [ - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\nDefault: 4", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - } - ], - "args": [ - { - "name": "plugin", - "description": "Plugin(s) to update", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - } - ], - "options": [ - { - "name": [ - "-c", - "--core" - ], - "description": "The built-in plugins only\nNormally these are not shown", - "isRepeatable": false - }, - { - "name": [ - "--user" - ], - "description": "List installed plugins", - "isRepeatable": false - }, - { - "name": [ - "-u", - "--urls" - ], - "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - "isRepeatable": false - } - ] - }, - { - "name": [ - "prune" - ], - "description": "Delete unused versions of tools", - "options": [ - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Do not actually delete anything", - "isRepeatable": false - }, - { - "name": [ - "--configs" - ], - "description": "Prune only tracked and trusted configuration links that point to non-existent configurations", - "isRepeatable": false - }, - { - "name": [ - "--tools" - ], - "description": "Prune only unused versions of tools", - "isRepeatable": false - } - ], - "args": [ - { - "name": "plugin", - "description": "Prune only versions from this plugin(s)", - "isOptional": true, - "isVariadic": true, - "generators": pluginGenerator - } - ] - }, - { - "name": [ - "registry" - ], - "description": "List available tools to install", - "args": [ - { - "name": "name", - "description": "Show only the specified tool's full name", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "reshim" - ], - "description": "Creates new shims based on bin paths from currently installed tools.", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Removes all shims before reshimming", - "isRepeatable": false - } - ] - }, - { - "name": [ - "run", - "r" - ], - "description": "Run task(s)", - "options": [ - { - "name": [ - "-C", - "--cd" - ], - "description": "Change to this directory before executing the command", - "isRepeatable": false, - "args": { - "name": "cd", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Don't actually run the tasks(s), just print them in order of execution", - "isRepeatable": false - }, - { - "name": [ - "-f", - "--force" - ], - "description": "Force the tasks to run even if outputs are up to date", - "isRepeatable": false - }, - { - "name": [ - "-p", - "--prefix" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--interleave" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-t", - "--tool" - ], - "description": "Tool(s) to also add e.g.: node@20 python@3.10", - "isRepeatable": true, - "args": { - "name": "tool@version", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-r", - "--raw" - ], - "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - "isRepeatable": false - }, - { - "name": [ - "--timings" - ], - "description": "Shows elapsed time after each task completes", - "isRepeatable": false - } - ], - "generateSpec": usageGenerateSpec(["mise tasks --usage"]), - "cache": false - }, - { - "name": [ - "self-update" - ], - "description": "Updates mise itself.", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Update even if already up to date", - "isRepeatable": false - }, - { - "name": [ - "--no-plugins" - ], - "description": "Disable auto-updating plugins", - "isRepeatable": false - }, - { - "name": [ - "-y", - "--yes" - ], - "description": "Skip confirmation prompt", - "isRepeatable": false - } - ], - "args": [ - { - "name": "version", - "description": "Update to a specific version", - "isOptional": true, - "isVariadic": false - } - ] - }, - { - "name": [ - "set" - ], - "description": "Set environment variables in mise.toml", - "options": [ - { - "name": [ - "--file" - ], - "description": "The TOML file to update", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Set the environment variable in the global config file", - "isRepeatable": false - } - ], - "args": [ - { - "name": "env_vars", - "description": "Environment variable(s) to set\ne.g.: NODE_ENV=production", - "isOptional": true, - "isVariadic": true, - "generators": envVarGenerator - } - ] - }, - { - "name": [ - "settings" - ], - "description": "Manage settings", - "subcommands": [ - { - "name": [ - "add" - ], - "description": "Adds a setting to the configuration file", - "args": [ - { - "name": "setting", - "description": "The setting to set", - "isOptional": false, - "isVariadic": false, - "generators": settingsGenerator - }, - { - "name": "value", - "description": "The value to set", - "isOptional": false, - "isVariadic": false - } - ] - }, - { - "name": [ - "get" - ], - "description": "Show a current setting", - "args": [ - { - "name": "setting", - "description": "The setting to show", - "isOptional": false, - "isVariadic": false, - "generators": settingsGenerator - } - ] - }, - { - "name": [ - "ls", - "list" - ], - "description": "Show current settings", - "options": [ - { - "name": [ - "--keys" - ], - "description": "Only display key names for each setting", - "isRepeatable": false - } - ] - }, - { - "name": [ - "set", - "create" - ], - "description": "Add/update a setting", - "args": [ - { - "name": "setting", - "description": "The setting to set", - "isOptional": false, - "isVariadic": false, - "generators": settingsGenerator - }, - { - "name": "value", - "description": "The value to set", - "isOptional": false, - "isVariadic": false - } - ] - }, - { - "name": [ - "unset", - "rm", - "remove", - "delete", - "del" - ], - "description": "Clears a setting", - "args": [ - { - "name": "setting", - "description": "The setting to remove", - "isOptional": false, - "isVariadic": false, - "generators": settingsGenerator - } - ] - } - ], - "options": [ - { - "name": [ - "--keys" - ], - "description": "Only display key names for each setting", - "isRepeatable": false - } - ] - }, - { - "name": [ - "shell", - "sh" - ], - "description": "Sets a tool version for the current session.", - "options": [ - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - }, - { - "name": [ - "-u", - "--unset" - ], - "description": "Removes a previously set version", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to use", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "sync" - ], - "description": "Add tool versions from external tools to mise", - "subcommands": [ - { - "name": [ - "node" - ], - "description": "Symlinks all tool versions from an external tool into mise", - "options": [ - { - "name": [ - "--brew" - ], - "description": "Get tool versions from Homebrew", - "isRepeatable": false - }, - { - "name": [ - "--nvm" - ], - "description": "Get tool versions from nvm", - "isRepeatable": false - }, - { - "name": [ - "--nodenv" - ], - "description": "Get tool versions from nodenv", - "isRepeatable": false - } - ] - }, - { - "name": [ - "python" - ], - "description": "Symlinks all tool versions from an external tool into mise", - "options": [ - { - "name": [ - "--pyenv" - ], - "description": "Get tool versions from pyenv", - "isRepeatable": false - } - ] - } - ] - }, - { - "name": [ - "tasks", - "t" - ], - "description": "Manage tasks", - "subcommands": [ - { - "name": [ - "deps" - ], - "description": "Display a tree visualization of a dependency graph", - "options": [ - { - "name": [ - "--hidden" - ], - "description": "Show hidden tasks", - "isRepeatable": false - }, - { - "name": [ - "--dot" - ], - "description": "Display dependencies in DOT format", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tasks", - "description": "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "edit" - ], - "description": "Edit a tasks with $EDITOR", - "options": [ - { - "name": [ - "-p", - "--path" - ], - "description": "Display the path to the tasks instead of editing it", - "isRepeatable": false - } - ], - "args": [ - { - "name": "task", - "description": "Tasks to edit", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - ] - }, - { - "name": [ - "info" - ], - "description": "Get information about a task", - "options": [ - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ], - "args": [ - { - "name": "task", - "description": "Name of the task to get information about", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - ] - }, - { - "name": [ - "ls" - ], - "description": "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.", - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-x", - "--extended" - ], - "description": "Show all columns", - "isRepeatable": false - }, - { - "name": [ - "--hidden" - ], - "description": "Show hidden tasks", - "isRepeatable": false - }, - { - "name": [ - "--sort" - ], - "description": "Sort by column. Default is name.", - "isRepeatable": false, - "args": { - "name": "column", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "name", - "alias", - "description", - "source" - ] - } - }, - { - "name": [ - "--sort-order" - ], - "description": "Sort order. Default is asc.", - "isRepeatable": false, - "args": { - "name": "sort_order", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "asc", - "desc" - ] - } - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "run", - "r" - ], - "description": "Run task(s)", - "options": [ - { - "name": [ - "-C", - "--cd" - ], - "description": "Change to this directory before executing the command", - "isRepeatable": false, - "args": { - "name": "cd", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Don't actually run the tasks(s), just print them in order of execution", - "isRepeatable": false - }, - { - "name": [ - "-f", - "--force" - ], - "description": "Force the tasks to run even if outputs are up to date", - "isRepeatable": false - }, - { - "name": [ - "-p", - "--prefix" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--interleave" - ], - "description": "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", - "isRepeatable": false - }, - { - "name": [ - "-t", - "--tool" - ], - "description": "Tool(s) to also add e.g.: node@20 python@3.10", - "isRepeatable": true, - "args": { - "name": "tool@version", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-r", - "--raw" - ], - "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - "isRepeatable": false - }, - { - "name": [ - "--timings" - ], - "description": "Shows elapsed time after each task completes", - "isRepeatable": false - } - ], - "args": [ - { - "name": "task", - "description": "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", - "isOptional": true, - "isVariadic": false, - "generators": simpleTaskGenerator - }, - { - "name": "args", - "description": "Arguments to pass to the tasks. Use \":::\" to separate tasks", - "isOptional": true, - "isVariadic": true - } - ], - "generateSpec": usageGenerateSpec(["mise tasks --usage"]), - "cache": false - } - ], - "options": [ - { - "name": [ - "--no-header" - ], - "description": "Do not print table header", - "isRepeatable": false - }, - { - "name": [ - "-x", - "--extended" - ], - "description": "Show all columns", - "isRepeatable": false - }, - { - "name": [ - "--hidden" - ], - "description": "Show hidden tasks", - "isRepeatable": false - }, - { - "name": [ - "--sort" - ], - "description": "Sort by column. Default is name.", - "isRepeatable": false, - "args": { - "name": "column", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "name", - "alias", - "description", - "source" - ] - } - }, - { - "name": [ - "--sort-order" - ], - "description": "Sort order. Default is asc.", - "isRepeatable": false, - "args": { - "name": "sort_order", - "isOptional": false, - "isVariadic": false, - "suggestions": [ - "asc", - "desc" - ] - } - }, - { - "name": [ - "-J", - "--json" - ], - "description": "Output in JSON format", - "isRepeatable": false - } - ] - }, - { - "name": [ - "trust" - ], - "description": "Marks a config file as trusted", - "options": [ - { - "name": [ - "-a", - "--all" - ], - "description": "Trust all config files in the current directory and its parents", - "isRepeatable": false - }, - { - "name": [ - "--untrust" - ], - "description": "No longer trust this config", - "isRepeatable": false - }, - { - "name": [ - "--show" - ], - "description": "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", - "isRepeatable": false - } - ], - "args": [ - { - "name": "config_file", - "description": "The config file to trust", - "isOptional": true, - "isVariadic": false, - "template": "filepaths", - "generators": configPathGenerator - } - ] - }, - { - "name": [ - "uninstall", - "remove", - "rm" - ], - "description": "Removes installed tool versions", - "options": [ - { - "name": [ - "-a", - "--all" - ], - "description": "Delete all installed versions", - "isRepeatable": false - }, - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Do not actually delete anything", - "isRepeatable": false - } - ], - "args": [ - { - "name": "installed_tool@version", - "description": "Tool(s) to remove", - "isOptional": true, - "isVariadic": true, - "generators": installedToolVersionGenerator - } - ] - }, - { - "name": [ - "unset" - ], - "description": "Remove environment variable(s) from the config file.", - "options": [ - { - "name": [ - "-f", - "--file" - ], - "description": "Specify a file to use instead of `mise.toml`", - "isRepeatable": false, - "args": { - "name": "file", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Use the global config file", - "isRepeatable": false - } - ], - "args": [ - { - "name": "keys", - "description": "Environment variable(s) to remove\ne.g.: NODE_ENV", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "upgrade", - "up" - ], - "description": "Upgrades outdated tools", - "options": [ - { - "name": [ - "-n", - "--dry-run" - ], - "description": "Just print what would be done, don't actually do it", - "isRepeatable": false - }, - { - "name": [ - "-i", - "--interactive" - ], - "description": "Display multiselect menu to choose which tools to upgrade", - "isRepeatable": false - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-l", - "--bump" - ], - "description": "Upgrades to the latest version available, bumping the version in mise.toml", - "isRepeatable": false - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "use", - "u" - ], - "description": "Installs a tool and adds the version it to mise.toml.", - "options": [ - { - "name": [ - "-f", - "--force" - ], - "description": "Force reinstall even if already installed", - "isRepeatable": false - }, - { - "name": [ - "--fuzzy" - ], - "description": "Save fuzzy version to config file", - "isRepeatable": false - }, - { - "name": [ - "-g", - "--global" - ], - "description": "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", - "isRepeatable": false - }, - { - "name": [ - "-e", - "--env" - ], - "description": "Modify an environment-specific config file like .mise..toml", - "isRepeatable": false, - "args": { - "name": "env", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "-j", - "--jobs" - ], - "description": "Number of jobs to run in parallel\n[default: 4]", - "isRepeatable": false, - "args": { - "name": "jobs", - "isOptional": false, - "isVariadic": false - } - }, - { - "name": [ - "--raw" - ], - "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", - "isRepeatable": false - }, - { - "name": [ - "--remove" - ], - "description": "Remove the plugin(s) from config file", - "isRepeatable": true, - "args": { - "name": "plugin", - "isOptional": false, - "isVariadic": false, - "generators": pluginGenerator - } - }, - { - "name": [ - "-p", - "--path" - ], - "description": "Specify a path to a config file or directory", - "isRepeatable": false, - "args": { - "name": "path", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "--pin" - ], - "description": "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", - "isRepeatable": false - } - ], - "args": [ - { - "name": "tool@version", - "description": "Tool(s) to add to config file", - "isOptional": true, - "isVariadic": true, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "version", - "v" - ], - "description": "Display the version of mise" - }, - { - "name": [ - "watch", - "w" - ], - "description": "Run task(s) and watch for changes to rerun it", - "options": [ - { - "name": [ - "-t", - "--task" - ], - "description": "Tasks to run", - "isRepeatable": true, - "args": { - "name": "task", - "isOptional": false, - "isVariadic": false, - "generators": simpleTaskGenerator - } - }, - { - "name": [ - "-g", - "--glob" - ], - "description": "Files to watch\nDefaults to sources from the tasks(s)", - "isRepeatable": true, - "args": { - "name": "glob", - "isOptional": false, - "isVariadic": false - } - } - ], - "args": [ - { - "name": "args", - "description": "Extra arguments", - "isOptional": true, - "isVariadic": true - } - ] - }, - { - "name": [ - "where" - ], - "description": "Display the installation path for a tool", - "args": [ - { - "name": "tool@version", - "description": "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", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - ] - }, - { - "name": [ - "which" - ], - "description": "Shows the path that a tool's bin points to.", - "options": [ - { - "name": [ - "--plugin" - ], - "description": "Show the plugin name instead of the path", - "isRepeatable": false - }, - { - "name": [ - "--version" - ], - "description": "Show the version instead of the path", - "isRepeatable": false - }, - { - "name": [ - "-t", - "--tool" - ], - "description": "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", - "isRepeatable": false, - "args": { - "name": "tool@version", - "isOptional": false, - "isVariadic": false, - "generators": toolVersionGenerator - } - } - ], - "args": [ - { - "name": "bin_name", - "description": "The bin to look up", - "isOptional": false, - "isVariadic": false - } - ] - } - ], - "options": [ - { - "name": [ - "-C", - "--cd" - ], - "description": "Change directory before running command", - "isRepeatable": false, - "args": { - "name": "dir", - "isOptional": false, - "isVariadic": false, - "template": "folders" - } - }, - { - "name": [ - "-P", - "--profile" - ], - "description": "Set the profile (environment)", - "isRepeatable": false, - "args": { - "name": "profile", - "isOptional": false, - "isVariadic": false, - "template": "filepaths" - } - }, - { - "name": [ - "-q", - "--quiet" - ], - "description": "Suppress non-error messages", - "isRepeatable": false - }, - { - "name": [ - "-v", - "--verbose" - ], - "description": "Show extra output (use -vv for even more)", - "isRepeatable": true - }, - { - "name": [ - "-y", - "--yes" - ], - "description": "Answer yes to all confirmation prompts", - "isRepeatable": false - } - ] + name: ["mise"], + subcommands: [ + { + name: ["activate"], + description: "Initializes mise in the current shell session", + options: [ + { + name: ["--shims"], + description: + "Use shims instead of modifying PATH\nEffectively the same as:", + isRepeatable: false, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + ], + args: [ + { + name: "shell_type", + description: "Shell type to generate the script for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + ], + }, + { + name: ["alias", "a"], + description: "Manage aliases", + subcommands: [ + { + name: ["get"], + description: "Show an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to show the alias for", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + { + name: "alias", + description: "The alias to show", + isOptional: false, + isVariadic: false, + generators: aliasGenerator, + }, + ], + }, + { + name: ["ls", "list"], + description: + "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + options: [ + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool", + description: "Show aliases for ", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set", "add", "create"], + description: "Add/update an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to set the alias for", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + { + name: "alias", + description: "The alias to set", + isOptional: false, + isVariadic: false, + generators: aliasGenerator, + }, + { + name: "value", + description: "The value to set the alias to", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears an alias for a plugin", + args: [ + { + name: "plugin", + description: "The plugin to remove the alias from", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + { + name: "alias", + description: "The alias to remove", + isOptional: false, + isVariadic: false, + generators: aliasGenerator, + }, + ], + }, + ], + options: [ + { + name: ["-p", "--plugin"], + description: "filter aliases by plugin", + isRepeatable: false, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + }, + { + name: ["backends", "b"], + description: "Manage backends", + subcommands: [ + { + name: ["ls", "list"], + description: "List built-in backends", + }, + ], + }, + { + name: ["bin-paths"], + description: "List all the active runtime bin paths", + }, + { + name: ["cache"], + description: "Manage the mise cache", + subcommands: [ + { + name: ["clear", "c"], + description: "Deletes all cache files in mise", + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["prune", "p"], + description: "Removes stale mise cache files", + options: [ + { + name: ["--dry-run"], + description: "Just show what would be pruned", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show pruned files", + isRepeatable: true, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to clear cache for e.g.: node, python", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + ], + }, + { + name: ["completion"], + description: "Generate shell completions", + args: [ + { + name: "shell", + description: "Shell type to generate completions for", + isOptional: true, + isVariadic: false, + suggestions: ["bash", "fish", "zsh"], + }, + ], + }, + { + name: ["config", "cfg"], + description: "Manage config files", + subcommands: [ + { + name: ["generate", "g"], + description: "[experimental] Generate a mise.toml file", + options: [ + { + name: ["-o", "--output"], + description: "Output to file instead of stdout", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + ], + }, + { + name: ["get"], + description: "Display the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["ls"], + description: "List config files currently in use", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["set"], + description: "Set the value of a setting in a mise.toml file", + options: [ + { + name: ["-f", "--file"], + description: "The path to the mise.toml file to edit", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-t", "--type"], + isRepeatable: false, + args: { + name: "type", + isOptional: false, + isVariadic: false, + suggestions: [ + "infer", + "string", + "integer", + "float", + "bool", + "list", + ], + }, + }, + ], + args: [ + { + name: "key", + description: "The path of the config to display", + isOptional: false, + isVariadic: false, + }, + { + name: "value", + description: "The value to set the key to", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["deactivate"], + description: "Disable mise for current shell session", + }, + { + name: ["direnv"], + description: "Output direnv function to use mise inside direnv", + subcommands: [ + { + name: ["activate"], + description: "Output direnv function to use mise inside direnv", + }, + ], + }, + { + name: ["doctor", "dr"], + description: "Check mise installation for possible problems", + }, + { + name: ["env", "e"], + description: "Exports env vars to activate mise a single time", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-s", "--shell"], + description: "Shell type to generate environment variables for", + isRepeatable: false, + args: { + name: "shell", + isOptional: false, + isVariadic: false, + suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], + }, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["exec", "x"], + description: "Execute a command with tool(s) set", + options: [ + { + name: ["-c", "--command"], + description: "Command string to execute", + isRepeatable: false, + args: { + name: "c", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to start e.g.: node@20 python@3.10", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + { + name: "command", + description: "Command string to execute (same as --command)", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["generate", "g"], + description: "[experimental] Generate files for various tools/services", + subcommands: [ + { + name: ["git-pre-commit", "pre-commit"], + description: "[experimental] Generate a git pre-commit hook", + options: [ + { + name: ["--hook"], + description: "Which hook to generate (saves to .git/hooks/$hook)", + isRepeatable: false, + args: { + name: "hook", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: + "The task to run when the pre-commit hook is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + }, + { + name: ["-w", "--write"], + description: + "write to .git/hooks/pre-commit and make it executable", + isRepeatable: false, + }, + ], + }, + { + name: ["github-action"], + description: "[experimental] Generate a GitHub Action workflow file", + options: [ + { + name: ["-n", "--name"], + description: "the name of the workflow to generate", + isRepeatable: false, + args: { + name: "name", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-t", "--task"], + description: "The task to run when the workflow is triggered", + isRepeatable: false, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + }, + { + name: ["-w", "--write"], + description: "write to .github/workflows/$name.yml", + isRepeatable: false, + }, + ], + }, + { + name: ["task-docs"], + description: "Generate documentation for tasks in a project", + options: [ + { + name: ["-I", "--index"], + description: + "write only an index of tasks, intended for use with `--multi`", + isRepeatable: false, + }, + { + name: ["-i", "--inject"], + description: "inserts the documentation into an existing file", + isRepeatable: false, + }, + { + name: ["-m", "--multi"], + description: + "render each task as a separate document, requires `--output` to be a directory", + isRepeatable: false, + }, + { + name: ["-o", "--output"], + description: "writes the generated docs to a file/directory", + isRepeatable: false, + args: { + name: "output", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--root"], + description: "root directory to search for tasks", + isRepeatable: false, + args: { + name: "root", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-s", "--style"], + isRepeatable: false, + args: { + name: "style", + isOptional: false, + isVariadic: false, + suggestions: ["simple", "detailed"], + }, + }, + ], + }, + ], + }, + { + name: ["implode"], + description: "Removes mise CLI and all related data", + options: [ + { + name: ["--config"], + description: "Also remove config directory", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: + "List directories that would be removed without actually removing them", + isRepeatable: false, + }, + ], + }, + { + name: ["install", "i"], + description: "Install a tool version", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to install e.g.: node@20", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["latest"], + description: "Gets the latest available version for a plugin", + options: [ + { + name: ["-i", "--installed"], + description: "Show latest installed instead of available version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool to get the latest version of", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a tool version into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite an existing tool version if it exists", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool name and version to create a symlink for", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + { + name: "path", + description: + "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed and active tool versions", + options: [ + { + name: ["-c", "--current"], + description: + "Only show tool versions currently specified in a mise.toml", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Only show tool versions currently specified in the global mise.toml", + isRepeatable: false, + }, + { + name: ["-i", "--installed"], + description: + "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", + isRepeatable: false, + }, + { + name: ["-o", "--offline"], + description: "Don't fetch information such as outdated versions", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["-m", "--missing"], + description: "Display missing tool versions", + isRepeatable: false, + }, + { + name: ["--prefix"], + description: "Display versions matching this prefix", + isRepeatable: false, + args: { + name: "prefix", + isOptional: false, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + }, + { + name: ["--no-header"], + description: "Don't display headers", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Only show tool versions from [PLUGIN]", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["ls-remote"], + description: "List runtime versions available for install.", + options: [ + { + name: ["--all"], + description: "Show all installed plugins and versions", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Plugin to get versions for", + isOptional: true, + isVariadic: false, + generators: toolVersionGenerator, + }, + { + name: "prefix", + description: + 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate( + `mise ls-remote {{words[PREV]}}`, + ), + }, + ], + }, + { + name: ["outdated"], + description: "Shows outdated tool versions", + options: [ + { + name: ["-l", "--bump"], + description: + "Compares against the latest versions available, not what matches the current config", + isRepeatable: false, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + { + name: ["--no-header"], + description: "Don't show table header", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "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", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["plugins", "p"], + description: "Manage plugins", + subcommands: [ + { + name: ["install", "i", "a", "add"], + description: "Install a plugin", + options: [ + { + name: ["-f", "--force"], + description: "Reinstall even if plugin exists", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: + "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show installation output", + isRepeatable: true, + }, + ], + args: [ + { + name: "new_plugin", + description: + "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", + isOptional: true, + isVariadic: false, + generators: completionGeneratorTemplate(`mise plugins --all`), + }, + { + name: "git_url", + description: "The git url of the plugin", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["link", "ln"], + description: "Symlinks a plugin into mise", + options: [ + { + name: ["-f", "--force"], + description: "Overwrite existing plugin", + isRepeatable: false, + }, + ], + args: [ + { + name: "name", + description: "The name of the plugin\ne.g.: node, ruby", + isOptional: false, + isVariadic: false, + }, + { + name: "path", + description: "The local path to the plugin\ne.g.: ./mise-node", + isOptional: true, + isVariadic: false, + template: "filepaths", + }, + ], + }, + { + name: ["ls", "list"], + description: "List installed plugins", + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["ls-remote", "list-remote", "list-all"], + description: "List all available remote plugins", + options: [ + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", + isRepeatable: false, + }, + { + name: ["--only-names"], + description: + 'Only show the name of each plugin by default it will show a "*" next to installed plugins', + isRepeatable: false, + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes a plugin", + options: [ + { + name: ["-p", "--purge"], + description: + "Also remove the plugin's installs, downloads, and cache", + isRepeatable: false, + }, + { + name: ["-a", "--all"], + description: "Remove all plugins", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to remove", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["update", "up", "upgrade"], + description: "Updates a plugin to the latest version", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\nDefault: 4", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "plugin", + description: "Plugin(s) to update", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + ], + options: [ + { + name: ["-c", "--core"], + description: + "The built-in plugins only\nNormally these are not shown", + isRepeatable: false, + }, + { + name: ["--user"], + description: "List installed plugins", + isRepeatable: false, + }, + { + name: ["-u", "--urls"], + description: + "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + isRepeatable: false, + }, + ], + }, + { + name: ["prune"], + description: "Delete unused versions of tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + { + name: ["--configs"], + description: + "Prune only tracked and trusted configuration links that point to non-existent configurations", + isRepeatable: false, + }, + { + name: ["--tools"], + description: "Prune only unused versions of tools", + isRepeatable: false, + }, + ], + args: [ + { + name: "plugin", + description: "Prune only versions from this plugin(s)", + isOptional: true, + isVariadic: true, + generators: pluginGenerator, + }, + ], + }, + { + name: ["registry"], + description: "List available tools to install", + args: [ + { + name: "name", + description: "Show only the specified tool's full name", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["reshim"], + description: + "Creates new shims based on bin paths from currently installed tools.", + options: [ + { + name: ["-f", "--force"], + description: "Removes all shims before reshimming", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + { + name: ["self-update"], + description: "Updates mise itself.", + options: [ + { + name: ["-f", "--force"], + description: "Update even if already up to date", + isRepeatable: false, + }, + { + name: ["--no-plugins"], + description: "Disable auto-updating plugins", + isRepeatable: false, + }, + { + name: ["-y", "--yes"], + description: "Skip confirmation prompt", + isRepeatable: false, + }, + ], + args: [ + { + name: "version", + description: "Update to a specific version", + isOptional: true, + isVariadic: false, + }, + ], + }, + { + name: ["set"], + description: "Set environment variables in mise.toml", + options: [ + { + name: ["--file"], + description: "The TOML file to update", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Set the environment variable in the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "env_vars", + description: + "Environment variable(s) to set\ne.g.: NODE_ENV=production", + isOptional: true, + isVariadic: true, + generators: envVarGenerator, + }, + ], + }, + { + name: ["settings"], + description: "Manage settings", + subcommands: [ + { + name: ["add"], + description: "Adds a setting to the configuration file", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["get"], + description: "Show a current setting", + args: [ + { + name: "setting", + description: "The setting to show", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + ], + }, + { + name: ["ls", "list"], + description: "Show current settings", + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["set", "create"], + description: "Add/update a setting", + args: [ + { + name: "setting", + description: "The setting to set", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + { + name: "value", + description: "The value to set", + isOptional: false, + isVariadic: false, + }, + ], + }, + { + name: ["unset", "rm", "remove", "delete", "del"], + description: "Clears a setting", + args: [ + { + name: "setting", + description: "The setting to remove", + isOptional: false, + isVariadic: false, + generators: settingsGenerator, + }, + ], + }, + ], + options: [ + { + name: ["--keys"], + description: "Only display key names for each setting", + isRepeatable: false, + }, + ], + }, + { + name: ["shell", "sh"], + description: "Sets a tool version for the current session.", + options: [ + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + { + name: ["-u", "--unset"], + description: "Removes a previously set version", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to use", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["sync"], + description: "Add tool versions from external tools to mise", + subcommands: [ + { + name: ["node"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--brew"], + description: "Get tool versions from Homebrew", + isRepeatable: false, + }, + { + name: ["--nvm"], + description: "Get tool versions from nvm", + isRepeatable: false, + }, + { + name: ["--nodenv"], + description: "Get tool versions from nodenv", + isRepeatable: false, + }, + ], + }, + { + name: ["python"], + description: + "Symlinks all tool versions from an external tool into mise", + options: [ + { + name: ["--pyenv"], + description: "Get tool versions from pyenv", + isRepeatable: false, + }, + ], + }, + ], + }, + { + name: ["tasks", "t"], + description: "Manage tasks", + subcommands: [ + { + name: ["deps"], + description: "Display a tree visualization of a dependency graph", + options: [ + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--dot"], + description: "Display dependencies in DOT format", + isRepeatable: false, + }, + ], + args: [ + { + name: "tasks", + description: + "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["edit"], + description: "Edit a tasks with $EDITOR", + options: [ + { + name: ["-p", "--path"], + description: + "Display the path to the tasks instead of editing it", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Tasks to edit", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + ], + }, + { + name: ["info"], + description: "Get information about a task", + options: [ + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: "Name of the task to get information about", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + ], + }, + { + name: ["ls"], + description: + "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.", + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["run", "r"], + description: "Run task(s)", + options: [ + { + name: ["-C", "--cd"], + description: + "Change to this directory before executing the command", + isRepeatable: false, + args: { + name: "cd", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-n", "--dry-run"], + description: + "Don't actually run the tasks(s), just print them in order of execution", + isRepeatable: false, + }, + { + name: ["-f", "--force"], + description: + "Force the tasks to run even if outputs are up to date", + isRepeatable: false, + }, + { + name: ["-p", "--prefix"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-i", "--interleave"], + description: + "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", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: "Tool(s) to also add e.g.: node@20 python@3.10", + isRepeatable: true, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + }, + { + name: ["-j", "--jobs"], + description: + "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-r", "--raw"], + description: + "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + isRepeatable: false, + }, + { + name: ["--timings"], + description: "Shows elapsed time after each task completes", + isRepeatable: false, + }, + ], + args: [ + { + name: "task", + description: + "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", + isOptional: true, + isVariadic: false, + generators: simpleTaskGenerator, + }, + { + name: "args", + description: + 'Arguments to pass to the tasks. Use ":::" to separate tasks', + isOptional: true, + isVariadic: true, + }, + ], + generateSpec: usageGenerateSpec(["mise tasks --usage"]), + cache: false, + }, + ], + options: [ + { + name: ["--no-header"], + description: "Do not print table header", + isRepeatable: false, + }, + { + name: ["-x", "--extended"], + description: "Show all columns", + isRepeatable: false, + }, + { + name: ["--hidden"], + description: "Show hidden tasks", + isRepeatable: false, + }, + { + name: ["--sort"], + description: "Sort by column. Default is name.", + isRepeatable: false, + args: { + name: "column", + isOptional: false, + isVariadic: false, + suggestions: ["name", "alias", "description", "source"], + }, + }, + { + name: ["--sort-order"], + description: "Sort order. Default is asc.", + isRepeatable: false, + args: { + name: "sort_order", + isOptional: false, + isVariadic: false, + suggestions: ["asc", "desc"], + }, + }, + { + name: ["-J", "--json"], + description: "Output in JSON format", + isRepeatable: false, + }, + ], + }, + { + name: ["trust"], + description: "Marks a config file as trusted", + options: [ + { + name: ["-a", "--all"], + description: + "Trust all config files in the current directory and its parents", + isRepeatable: false, + }, + { + name: ["--untrust"], + description: "No longer trust this config", + isRepeatable: false, + }, + { + name: ["--show"], + description: + "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", + isRepeatable: false, + }, + ], + args: [ + { + name: "config_file", + description: "The config file to trust", + isOptional: true, + isVariadic: false, + template: "filepaths", + generators: configPathGenerator, + }, + ], + }, + { + name: ["uninstall", "remove", "rm"], + description: "Removes installed tool versions", + options: [ + { + name: ["-a", "--all"], + description: "Delete all installed versions", + isRepeatable: false, + }, + { + name: ["-n", "--dry-run"], + description: "Do not actually delete anything", + isRepeatable: false, + }, + ], + args: [ + { + name: "installed_tool@version", + description: "Tool(s) to remove", + isOptional: true, + isVariadic: true, + generators: installedToolVersionGenerator, + }, + ], + }, + { + name: ["unset"], + description: "Remove environment variable(s) from the config file.", + options: [ + { + name: ["-f", "--file"], + description: "Specify a file to use instead of `mise.toml`", + isRepeatable: false, + args: { + name: "file", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-g", "--global"], + description: "Use the global config file", + isRepeatable: false, + }, + ], + args: [ + { + name: "keys", + description: "Environment variable(s) to remove\ne.g.: NODE_ENV", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["upgrade", "up"], + description: "Upgrades outdated tools", + options: [ + { + name: ["-n", "--dry-run"], + description: "Just print what would be done, don't actually do it", + isRepeatable: false, + }, + { + name: ["-i", "--interactive"], + description: + "Display multiselect menu to choose which tools to upgrade", + isRepeatable: false, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-l", "--bump"], + description: + "Upgrades to the latest version available, bumping the version in mise.toml", + isRepeatable: false, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: + "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["use", "u"], + description: "Installs a tool and adds the version it to mise.toml.", + options: [ + { + name: ["-f", "--force"], + description: "Force reinstall even if already installed", + isRepeatable: false, + }, + { + name: ["--fuzzy"], + description: "Save fuzzy version to config file", + isRepeatable: false, + }, + { + name: ["-g", "--global"], + description: + "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", + isRepeatable: false, + }, + { + name: ["-e", "--env"], + description: + "Modify an environment-specific config file like .mise..toml", + isRepeatable: false, + args: { + name: "env", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["-j", "--jobs"], + description: "Number of jobs to run in parallel\n[default: 4]", + isRepeatable: false, + args: { + name: "jobs", + isOptional: false, + isVariadic: false, + }, + }, + { + name: ["--raw"], + description: + "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", + isRepeatable: false, + }, + { + name: ["--remove"], + description: "Remove the plugin(s) from config file", + isRepeatable: true, + args: { + name: "plugin", + isOptional: false, + isVariadic: false, + generators: pluginGenerator, + }, + }, + { + name: ["-p", "--path"], + description: "Specify a path to a config file or directory", + isRepeatable: false, + args: { + name: "path", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["--pin"], + description: + "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", + isRepeatable: false, + }, + ], + args: [ + { + name: "tool@version", + description: "Tool(s) to add to config file", + isOptional: true, + isVariadic: true, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["version", "v"], + description: "Display the version of mise", + }, + { + name: ["watch", "w"], + description: "Run task(s) and watch for changes to rerun it", + options: [ + { + name: ["-t", "--task"], + description: "Tasks to run", + isRepeatable: true, + args: { + name: "task", + isOptional: false, + isVariadic: false, + generators: simpleTaskGenerator, + }, + }, + { + name: ["-g", "--glob"], + description: "Files to watch\nDefaults to sources from the tasks(s)", + isRepeatable: true, + args: { + name: "glob", + isOptional: false, + isVariadic: false, + }, + }, + ], + args: [ + { + name: "args", + description: "Extra arguments", + isOptional: true, + isVariadic: true, + }, + ], + }, + { + name: ["where"], + description: "Display the installation path for a tool", + args: [ + { + name: "tool@version", + description: + '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', + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + ], + }, + { + name: ["which"], + description: "Shows the path that a tool's bin points to.", + options: [ + { + name: ["--plugin"], + description: "Show the plugin name instead of the path", + isRepeatable: false, + }, + { + name: ["--version"], + description: "Show the version instead of the path", + isRepeatable: false, + }, + { + name: ["-t", "--tool"], + description: + "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", + isRepeatable: false, + args: { + name: "tool@version", + isOptional: false, + isVariadic: false, + generators: toolVersionGenerator, + }, + }, + ], + args: [ + { + name: "bin_name", + description: "The bin to look up", + isOptional: false, + isVariadic: false, + }, + ], + }, + ], + options: [ + { + name: ["-C", "--cd"], + description: "Change directory before running command", + isRepeatable: false, + args: { + name: "dir", + isOptional: false, + isVariadic: false, + template: "folders", + }, + }, + { + name: ["-P", "--profile"], + description: "Set the profile (environment)", + isRepeatable: false, + args: { + name: "profile", + isOptional: false, + isVariadic: false, + template: "filepaths", + }, + }, + { + name: ["-q", "--quiet"], + description: "Suppress non-error messages", + isRepeatable: false, + }, + { + name: ["-v", "--verbose"], + description: "Show extra output (use -vv for even more)", + isRepeatable: true, + }, + { + name: ["-y", "--yes"], + description: "Answer yes to all confirmation prompts", + isRepeatable: false, + }, + ], }; export default completionSpec; From b20f4f8ed8ad84cc8f4532cc3e1b45ab7a0d0150 Mon Sep 17 00:00:00 2001 From: Miguel Oliveira Date: Sun, 10 Nov 2024 21:16:40 +0000 Subject: [PATCH 13/14] Prettier: Ignore generated mise.ts --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index 13b636741d..13512bf776 100644 --- a/.prettierignore +++ b/.prettierignore @@ -8,3 +8,4 @@ docs/.vitepress/dist docs/public/site.webmanifest schema/mise.json.hbs tasks.md +tasks/fig/src/mise.ts From 88e08d5b1bb2ba426448c63ffa2aac8e3d0efe6d Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sun, 10 Nov 2024 21:20:42 +0000 Subject: [PATCH 14/14] [autofix.ci] apply automated fixes --- tasks/fig/src/mise.ts | 4558 +++++++++++++++++++++++------------------ 1 file changed, 2558 insertions(+), 2000 deletions(-) diff --git a/tasks/fig/src/mise.ts b/tasks/fig/src/mise.ts index d9f84e6a21..ee4011c899 100644 --- a/tasks/fig/src/mise.ts +++ b/tasks/fig/src/mise.ts @@ -317,2009 +317,2567 @@ const installedToolVersionGenerator: Fig.Generator = { }; const usageGenerateSpec = (cmds: string[]) => { - return async ( - context: string[], - executeCommand: Fig.ExecuteCommandFunction, - ): Promise => { - const promises = cmds.map(async (cmd): Promise => { - try { - const args = cmd.split(" "); - const { - stdout, - stderr: cmdStderr, - status: cmdStatus, - } = await executeCommand({ - command: args[0], - args: args.splice(1), - }); - if (cmdStatus !== 0) { - return [{ name: "error", description: cmdStderr }]; - } - const { - stdout: figSpecOut, - stderr: figSpecStderr, - status: usageFigStatus, - } = await executeCommand({ - command: "usage", - args: ["g", "fig", "--spec", stdout], + return async (context: string[], executeCommand: Fig.ExecuteCommandFunction): Promise => { + const promises = cmds.map(async (cmd): Promise => { + try { + const args = cmd.split(" "); + const { stdout, stderr: cmdStderr, status: cmdStatus, } = await executeCommand({ + command: args[0], + args: args.splice(1), + }); + if (cmdStatus !== 0) { + return [{ name: "error", description: cmdStderr }]; + } + const { stdout: figSpecOut, stderr: figSpecStderr, status: usageFigStatus, } = await executeCommand({ + command: "usage", + args: ["g", "fig", "--spec", stdout], + }); + if (usageFigStatus !== 0) { + return [{ name: "error", description: figSpecStderr }]; + } + const start_of_json = figSpecOut.indexOf("{"); + const j = figSpecOut.slice(start_of_json); + return JSON.parse(j).subcommands as Fig.Subcommand[]; + } + catch (e) { + return [{ name: "error", description: e }] as Fig.Subcommand[]; + } }); - if (usageFigStatus !== 0) { - return [{ name: "error", description: figSpecStderr }]; - } - const start_of_json = figSpecOut.indexOf("{"); - const j = figSpecOut.slice(start_of_json); - return JSON.parse(j).subcommands as Fig.Subcommand[]; - } catch (e) { - return [{ name: "error", description: e }] as Fig.Subcommand[]; - } - }); - // eslint-disable-next-line compat/compat - const results = await Promise.allSettled(promises); - const subcommands = results - .filter((p) => p.status === "fulfilled") - .map((p) => p.value); - const failed = results - .filter((p) => p.status === "rejected") - .map((p) => ({ name: "error", description: p.reason })); - return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; - }; + // eslint-disable-next-line compat/compat + const results = await Promise.allSettled(promises); + const subcommands = results + .filter((p) => p.status === "fulfilled") + .map((p) => p.value); + const failed = results + .filter((p) => p.status === "rejected") + .map((p) => ({ name: "error", description: p.reason })); + return { subcommands: [...subcommands.flat(), ...failed] } as Fig.Spec; + }; }; -const completionGeneratorTemplate = ( - argSuggestionBash: string, -): Fig.Generator => { - return { - custom: async (tokens: string[], executeCommand) => { - let arg = argSuggestionBash; - if (tokens.length >= 1) { - arg = argSuggestionBash.replace( - "{{words[CURRENT]}}", - tokens[tokens.length - 1], - ); - } - if (tokens.length >= 2) { - arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); - } - const { stdout: text } = await executeCommand({ - command: "sh", - args: ["-c", arg], - }); - if (text.trim().length == 0) return []; - return text.split("\n").map((elm) => ({ name: elm })); - }, - }; +const completionGeneratorTemplate = (argSuggestionBash: string): Fig.Generator => { + return { + custom: async (tokens: string[], executeCommand) => { + let arg = argSuggestionBash; + if (tokens.length >= 1) { + arg = argSuggestionBash.replace("{{words[CURRENT]}}", tokens[tokens.length - 1]); + } + if (tokens.length >= 2) { + arg = arg.replace(`{{words[PREV]}}`, tokens[tokens.length - 2]); + } + const { stdout: text } = await executeCommand({ + command: "sh", + args: ["-c", arg], + }); + if (text.trim().length == 0) + return []; + return text.split("\n").map((elm) => ({ name: elm })); + }, + }; }; const completionSpec: Fig.Spec = { - name: ["mise"], - subcommands: [ - { - name: ["activate"], - description: "Initializes mise in the current shell session", - options: [ - { - name: ["--shims"], - description: - "Use shims instead of modifying PATH\nEffectively the same as:", - isRepeatable: false, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - ], - args: [ - { - name: "shell_type", - description: "Shell type to generate the script for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - ], - }, - { - name: ["alias", "a"], - description: "Manage aliases", - subcommands: [ - { - name: ["get"], - description: "Show an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to show the alias for", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - { - name: "alias", - description: "The alias to show", - isOptional: false, - isVariadic: false, - generators: aliasGenerator, - }, - ], - }, - { - name: ["ls", "list"], - description: - "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", - options: [ - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool", - description: "Show aliases for ", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set", "add", "create"], - description: "Add/update an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to set the alias for", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - { - name: "alias", - description: "The alias to set", - isOptional: false, - isVariadic: false, - generators: aliasGenerator, - }, - { - name: "value", - description: "The value to set the alias to", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears an alias for a plugin", - args: [ - { - name: "plugin", - description: "The plugin to remove the alias from", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - { - name: "alias", - description: "The alias to remove", - isOptional: false, - isVariadic: false, - generators: aliasGenerator, - }, - ], - }, - ], - options: [ - { - name: ["-p", "--plugin"], - description: "filter aliases by plugin", - isRepeatable: false, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - }, - { - name: ["backends", "b"], - description: "Manage backends", - subcommands: [ - { - name: ["ls", "list"], - description: "List built-in backends", - }, - ], - }, - { - name: ["bin-paths"], - description: "List all the active runtime bin paths", - }, - { - name: ["cache"], - description: "Manage the mise cache", - subcommands: [ - { - name: ["clear", "c"], - description: "Deletes all cache files in mise", - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["prune", "p"], - description: "Removes stale mise cache files", - options: [ - { - name: ["--dry-run"], - description: "Just show what would be pruned", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show pruned files", - isRepeatable: true, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to clear cache for e.g.: node, python", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - ], - }, - { - name: ["completion"], - description: "Generate shell completions", - args: [ - { - name: "shell", - description: "Shell type to generate completions for", - isOptional: true, - isVariadic: false, - suggestions: ["bash", "fish", "zsh"], - }, - ], - }, - { - name: ["config", "cfg"], - description: "Manage config files", - subcommands: [ - { - name: ["generate", "g"], - description: "[experimental] Generate a mise.toml file", - options: [ - { - name: ["-o", "--output"], - description: "Output to file instead of stdout", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - ], - }, - { - name: ["get"], - description: "Display the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["ls"], - description: "List config files currently in use", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["set"], - description: "Set the value of a setting in a mise.toml file", - options: [ - { - name: ["-f", "--file"], - description: "The path to the mise.toml file to edit", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-t", "--type"], - isRepeatable: false, - args: { - name: "type", - isOptional: false, - isVariadic: false, - suggestions: [ - "infer", - "string", - "integer", - "float", - "bool", - "list", - ], - }, - }, - ], - args: [ - { - name: "key", - description: "The path of the config to display", - isOptional: false, - isVariadic: false, - }, - { - name: "value", - description: "The value to set the key to", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["deactivate"], - description: "Disable mise for current shell session", - }, - { - name: ["direnv"], - description: "Output direnv function to use mise inside direnv", - subcommands: [ - { - name: ["activate"], - description: "Output direnv function to use mise inside direnv", - }, - ], - }, - { - name: ["doctor", "dr"], - description: "Check mise installation for possible problems", - }, - { - name: ["env", "e"], - description: "Exports env vars to activate mise a single time", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-s", "--shell"], - description: "Shell type to generate environment variables for", - isRepeatable: false, - args: { - name: "shell", - isOptional: false, - isVariadic: false, - suggestions: ["bash", "elvish", "fish", "nu", "xonsh", "zsh"], - }, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["exec", "x"], - description: "Execute a command with tool(s) set", - options: [ - { - name: ["-c", "--command"], - description: "Command string to execute", - isRepeatable: false, - args: { - name: "c", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to start e.g.: node@20 python@3.10", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - { - name: "command", - description: "Command string to execute (same as --command)", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["generate", "g"], - description: "[experimental] Generate files for various tools/services", - subcommands: [ - { - name: ["git-pre-commit", "pre-commit"], - description: "[experimental] Generate a git pre-commit hook", - options: [ - { - name: ["--hook"], - description: "Which hook to generate (saves to .git/hooks/$hook)", - isRepeatable: false, - args: { - name: "hook", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: - "The task to run when the pre-commit hook is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - }, - { - name: ["-w", "--write"], - description: - "write to .git/hooks/pre-commit and make it executable", - isRepeatable: false, - }, - ], - }, - { - name: ["github-action"], - description: "[experimental] Generate a GitHub Action workflow file", - options: [ - { - name: ["-n", "--name"], - description: "the name of the workflow to generate", - isRepeatable: false, - args: { - name: "name", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-t", "--task"], - description: "The task to run when the workflow is triggered", - isRepeatable: false, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - }, - { - name: ["-w", "--write"], - description: "write to .github/workflows/$name.yml", - isRepeatable: false, - }, - ], - }, - { - name: ["task-docs"], - description: "Generate documentation for tasks in a project", - options: [ - { - name: ["-I", "--index"], - description: - "write only an index of tasks, intended for use with `--multi`", - isRepeatable: false, - }, - { - name: ["-i", "--inject"], - description: "inserts the documentation into an existing file", - isRepeatable: false, - }, - { - name: ["-m", "--multi"], - description: - "render each task as a separate document, requires `--output` to be a directory", - isRepeatable: false, - }, - { - name: ["-o", "--output"], - description: "writes the generated docs to a file/directory", - isRepeatable: false, - args: { - name: "output", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--root"], - description: "root directory to search for tasks", - isRepeatable: false, - args: { - name: "root", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-s", "--style"], - isRepeatable: false, - args: { - name: "style", - isOptional: false, - isVariadic: false, - suggestions: ["simple", "detailed"], - }, - }, - ], - }, - ], - }, - { - name: ["implode"], - description: "Removes mise CLI and all related data", - options: [ - { - name: ["--config"], - description: "Also remove config directory", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: - "List directories that would be removed without actually removing them", - isRepeatable: false, - }, - ], - }, - { - name: ["install", "i"], - description: "Install a tool version", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to install e.g.: node@20", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["latest"], - description: "Gets the latest available version for a plugin", - options: [ - { - name: ["-i", "--installed"], - description: "Show latest installed instead of available version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool to get the latest version of", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a tool version into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite an existing tool version if it exists", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool name and version to create a symlink for", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - { - name: "path", - description: - "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed and active tool versions", - options: [ - { - name: ["-c", "--current"], - description: - "Only show tool versions currently specified in a mise.toml", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Only show tool versions currently specified in the global mise.toml", - isRepeatable: false, - }, - { - name: ["-i", "--installed"], - description: - "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", - isRepeatable: false, - }, - { - name: ["-o", "--offline"], - description: "Don't fetch information such as outdated versions", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["-m", "--missing"], - description: "Display missing tool versions", - isRepeatable: false, - }, - { - name: ["--prefix"], - description: "Display versions matching this prefix", - isRepeatable: false, - args: { - name: "prefix", - isOptional: false, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - }, - { - name: ["--no-header"], - description: "Don't display headers", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Only show tool versions from [PLUGIN]", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["ls-remote"], - description: "List runtime versions available for install.", - options: [ - { - name: ["--all"], - description: "Show all installed plugins and versions", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Plugin to get versions for", - isOptional: true, - isVariadic: false, - generators: toolVersionGenerator, - }, - { - name: "prefix", - description: - 'The version prefix to use when querying the latest version\nsame as the first argument after the "@"', - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate( - `mise ls-remote {{words[PREV]}}`, - ), - }, - ], - }, - { - name: ["outdated"], - description: "Shows outdated tool versions", - options: [ - { - name: ["-l", "--bump"], - description: - "Compares against the latest versions available, not what matches the current config", - isRepeatable: false, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - { - name: ["--no-header"], - description: "Don't show table header", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "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", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["plugins", "p"], - description: "Manage plugins", - subcommands: [ - { - name: ["install", "i", "a", "add"], - description: "Install a plugin", - options: [ - { - name: ["-f", "--force"], - description: "Reinstall even if plugin exists", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: - "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show installation output", - isRepeatable: true, - }, - ], - args: [ - { - name: "new_plugin", - description: - "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", - isOptional: true, - isVariadic: false, - generators: completionGeneratorTemplate(`mise plugins --all`), - }, - { - name: "git_url", - description: "The git url of the plugin", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["link", "ln"], - description: "Symlinks a plugin into mise", - options: [ - { - name: ["-f", "--force"], - description: "Overwrite existing plugin", - isRepeatable: false, - }, - ], - args: [ - { - name: "name", - description: "The name of the plugin\ne.g.: node, ruby", - isOptional: false, - isVariadic: false, - }, - { - name: "path", - description: "The local path to the plugin\ne.g.: ./mise-node", - isOptional: true, - isVariadic: false, - template: "filepaths", - }, - ], - }, - { - name: ["ls", "list"], - description: "List installed plugins", - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["ls-remote", "list-remote", "list-all"], - description: "List all available remote plugins", - options: [ - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", - isRepeatable: false, - }, - { - name: ["--only-names"], - description: - 'Only show the name of each plugin by default it will show a "*" next to installed plugins', - isRepeatable: false, - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes a plugin", - options: [ - { - name: ["-p", "--purge"], - description: - "Also remove the plugin's installs, downloads, and cache", - isRepeatable: false, - }, - { - name: ["-a", "--all"], - description: "Remove all plugins", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to remove", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["update", "up", "upgrade"], - description: "Updates a plugin to the latest version", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\nDefault: 4", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "plugin", - description: "Plugin(s) to update", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - ], - options: [ - { - name: ["-c", "--core"], - description: - "The built-in plugins only\nNormally these are not shown", - isRepeatable: false, - }, - { - name: ["--user"], - description: "List installed plugins", - isRepeatable: false, - }, - { - name: ["-u", "--urls"], - description: - "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", - isRepeatable: false, - }, - ], - }, - { - name: ["prune"], - description: "Delete unused versions of tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - { - name: ["--configs"], - description: - "Prune only tracked and trusted configuration links that point to non-existent configurations", - isRepeatable: false, - }, - { - name: ["--tools"], - description: "Prune only unused versions of tools", - isRepeatable: false, - }, - ], - args: [ - { - name: "plugin", - description: "Prune only versions from this plugin(s)", - isOptional: true, - isVariadic: true, - generators: pluginGenerator, - }, - ], - }, - { - name: ["registry"], - description: "List available tools to install", - args: [ - { - name: "name", - description: "Show only the specified tool's full name", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["reshim"], - description: - "Creates new shims based on bin paths from currently installed tools.", - options: [ - { - name: ["-f", "--force"], - description: "Removes all shims before reshimming", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - { - name: ["self-update"], - description: "Updates mise itself.", - options: [ - { - name: ["-f", "--force"], - description: "Update even if already up to date", - isRepeatable: false, - }, - { - name: ["--no-plugins"], - description: "Disable auto-updating plugins", - isRepeatable: false, - }, - { - name: ["-y", "--yes"], - description: "Skip confirmation prompt", - isRepeatable: false, - }, - ], - args: [ - { - name: "version", - description: "Update to a specific version", - isOptional: true, - isVariadic: false, - }, - ], - }, - { - name: ["set"], - description: "Set environment variables in mise.toml", - options: [ - { - name: ["--file"], - description: "The TOML file to update", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Set the environment variable in the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "env_vars", - description: - "Environment variable(s) to set\ne.g.: NODE_ENV=production", - isOptional: true, - isVariadic: true, - generators: envVarGenerator, - }, - ], - }, - { - name: ["settings"], - description: "Manage settings", - subcommands: [ - { - name: ["add"], - description: "Adds a setting to the configuration file", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["get"], - description: "Show a current setting", - args: [ - { - name: "setting", - description: "The setting to show", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - ], - }, - { - name: ["ls", "list"], - description: "Show current settings", - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["set", "create"], - description: "Add/update a setting", - args: [ - { - name: "setting", - description: "The setting to set", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - { - name: "value", - description: "The value to set", - isOptional: false, - isVariadic: false, - }, - ], - }, - { - name: ["unset", "rm", "remove", "delete", "del"], - description: "Clears a setting", - args: [ - { - name: "setting", - description: "The setting to remove", - isOptional: false, - isVariadic: false, - generators: settingsGenerator, - }, - ], - }, - ], - options: [ - { - name: ["--keys"], - description: "Only display key names for each setting", - isRepeatable: false, - }, - ], - }, - { - name: ["shell", "sh"], - description: "Sets a tool version for the current session.", - options: [ - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - { - name: ["-u", "--unset"], - description: "Removes a previously set version", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to use", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["sync"], - description: "Add tool versions from external tools to mise", - subcommands: [ - { - name: ["node"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--brew"], - description: "Get tool versions from Homebrew", - isRepeatable: false, - }, - { - name: ["--nvm"], - description: "Get tool versions from nvm", - isRepeatable: false, - }, - { - name: ["--nodenv"], - description: "Get tool versions from nodenv", - isRepeatable: false, - }, - ], - }, - { - name: ["python"], - description: - "Symlinks all tool versions from an external tool into mise", - options: [ - { - name: ["--pyenv"], - description: "Get tool versions from pyenv", - isRepeatable: false, - }, - ], - }, - ], - }, - { - name: ["tasks", "t"], - description: "Manage tasks", - subcommands: [ - { - name: ["deps"], - description: "Display a tree visualization of a dependency graph", - options: [ - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--dot"], - description: "Display dependencies in DOT format", - isRepeatable: false, - }, - ], - args: [ - { - name: "tasks", - description: - "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["edit"], - description: "Edit a tasks with $EDITOR", - options: [ - { - name: ["-p", "--path"], - description: - "Display the path to the tasks instead of editing it", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Tasks to edit", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - ], - }, - { - name: ["info"], - description: "Get information about a task", - options: [ - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: "Name of the task to get information about", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - ], - }, - { - name: ["ls"], - description: - "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.", - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["run", "r"], - description: "Run task(s)", - options: [ - { - name: ["-C", "--cd"], - description: - "Change to this directory before executing the command", - isRepeatable: false, - args: { - name: "cd", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-n", "--dry-run"], - description: - "Don't actually run the tasks(s), just print them in order of execution", - isRepeatable: false, - }, - { - name: ["-f", "--force"], - description: - "Force the tasks to run even if outputs are up to date", - isRepeatable: false, - }, - { - name: ["-p", "--prefix"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-i", "--interleave"], - description: - "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", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: "Tool(s) to also add e.g.: node@20 python@3.10", - isRepeatable: true, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - }, - { - name: ["-j", "--jobs"], - description: - "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-r", "--raw"], - description: - "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", - isRepeatable: false, - }, - { - name: ["--timings"], - description: "Shows elapsed time after each task completes", - isRepeatable: false, - }, - ], - args: [ - { - name: "task", - description: - "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", - isOptional: true, - isVariadic: false, - generators: simpleTaskGenerator, - }, - { - name: "args", - description: - 'Arguments to pass to the tasks. Use ":::" to separate tasks', - isOptional: true, - isVariadic: true, - }, - ], - generateSpec: usageGenerateSpec(["mise tasks --usage"]), - cache: false, - }, - ], - options: [ - { - name: ["--no-header"], - description: "Do not print table header", - isRepeatable: false, - }, - { - name: ["-x", "--extended"], - description: "Show all columns", - isRepeatable: false, - }, - { - name: ["--hidden"], - description: "Show hidden tasks", - isRepeatable: false, - }, - { - name: ["--sort"], - description: "Sort by column. Default is name.", - isRepeatable: false, - args: { - name: "column", - isOptional: false, - isVariadic: false, - suggestions: ["name", "alias", "description", "source"], - }, - }, - { - name: ["--sort-order"], - description: "Sort order. Default is asc.", - isRepeatable: false, - args: { - name: "sort_order", - isOptional: false, - isVariadic: false, - suggestions: ["asc", "desc"], - }, - }, - { - name: ["-J", "--json"], - description: "Output in JSON format", - isRepeatable: false, - }, - ], - }, - { - name: ["trust"], - description: "Marks a config file as trusted", - options: [ - { - name: ["-a", "--all"], - description: - "Trust all config files in the current directory and its parents", - isRepeatable: false, - }, - { - name: ["--untrust"], - description: "No longer trust this config", - isRepeatable: false, - }, - { - name: ["--show"], - description: - "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", - isRepeatable: false, - }, - ], - args: [ - { - name: "config_file", - description: "The config file to trust", - isOptional: true, - isVariadic: false, - template: "filepaths", - generators: configPathGenerator, - }, - ], - }, - { - name: ["uninstall", "remove", "rm"], - description: "Removes installed tool versions", - options: [ - { - name: ["-a", "--all"], - description: "Delete all installed versions", - isRepeatable: false, - }, - { - name: ["-n", "--dry-run"], - description: "Do not actually delete anything", - isRepeatable: false, - }, - ], - args: [ - { - name: "installed_tool@version", - description: "Tool(s) to remove", - isOptional: true, - isVariadic: true, - generators: installedToolVersionGenerator, - }, - ], - }, - { - name: ["unset"], - description: "Remove environment variable(s) from the config file.", - options: [ - { - name: ["-f", "--file"], - description: "Specify a file to use instead of `mise.toml`", - isRepeatable: false, - args: { - name: "file", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-g", "--global"], - description: "Use the global config file", - isRepeatable: false, - }, - ], - args: [ - { - name: "keys", - description: "Environment variable(s) to remove\ne.g.: NODE_ENV", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["upgrade", "up"], - description: "Upgrades outdated tools", - options: [ - { - name: ["-n", "--dry-run"], - description: "Just print what would be done, don't actually do it", - isRepeatable: false, - }, - { - name: ["-i", "--interactive"], - description: - "Display multiselect menu to choose which tools to upgrade", - isRepeatable: false, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-l", "--bump"], - description: - "Upgrades to the latest version available, bumping the version in mise.toml", - isRepeatable: false, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: - "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["use", "u"], - description: "Installs a tool and adds the version it to mise.toml.", - options: [ - { - name: ["-f", "--force"], - description: "Force reinstall even if already installed", - isRepeatable: false, - }, - { - name: ["--fuzzy"], - description: "Save fuzzy version to config file", - isRepeatable: false, - }, - { - name: ["-g", "--global"], - description: - "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", - isRepeatable: false, - }, - { - name: ["-e", "--env"], - description: - "Modify an environment-specific config file like .mise..toml", - isRepeatable: false, - args: { - name: "env", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["-j", "--jobs"], - description: "Number of jobs to run in parallel\n[default: 4]", - isRepeatable: false, - args: { - name: "jobs", - isOptional: false, - isVariadic: false, - }, - }, - { - name: ["--raw"], - description: - "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", - isRepeatable: false, - }, - { - name: ["--remove"], - description: "Remove the plugin(s) from config file", - isRepeatable: true, - args: { - name: "plugin", - isOptional: false, - isVariadic: false, - generators: pluginGenerator, - }, - }, - { - name: ["-p", "--path"], - description: "Specify a path to a config file or directory", - isRepeatable: false, - args: { - name: "path", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["--pin"], - description: - "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", - isRepeatable: false, - }, - ], - args: [ - { - name: "tool@version", - description: "Tool(s) to add to config file", - isOptional: true, - isVariadic: true, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["version", "v"], - description: "Display the version of mise", - }, - { - name: ["watch", "w"], - description: "Run task(s) and watch for changes to rerun it", - options: [ - { - name: ["-t", "--task"], - description: "Tasks to run", - isRepeatable: true, - args: { - name: "task", - isOptional: false, - isVariadic: false, - generators: simpleTaskGenerator, - }, - }, - { - name: ["-g", "--glob"], - description: "Files to watch\nDefaults to sources from the tasks(s)", - isRepeatable: true, - args: { - name: "glob", - isOptional: false, - isVariadic: false, - }, - }, - ], - args: [ - { - name: "args", - description: "Extra arguments", - isOptional: true, - isVariadic: true, - }, - ], - }, - { - name: ["where"], - description: "Display the installation path for a tool", - args: [ - { - name: "tool@version", - description: - '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', - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - ], - }, - { - name: ["which"], - description: "Shows the path that a tool's bin points to.", - options: [ - { - name: ["--plugin"], - description: "Show the plugin name instead of the path", - isRepeatable: false, - }, - { - name: ["--version"], - description: "Show the version instead of the path", - isRepeatable: false, - }, - { - name: ["-t", "--tool"], - description: - "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", - isRepeatable: false, - args: { - name: "tool@version", - isOptional: false, - isVariadic: false, - generators: toolVersionGenerator, - }, - }, - ], - args: [ - { - name: "bin_name", - description: "The bin to look up", - isOptional: false, - isVariadic: false, - }, - ], - }, - ], - options: [ - { - name: ["-C", "--cd"], - description: "Change directory before running command", - isRepeatable: false, - args: { - name: "dir", - isOptional: false, - isVariadic: false, - template: "folders", - }, - }, - { - name: ["-P", "--profile"], - description: "Set the profile (environment)", - isRepeatable: false, - args: { - name: "profile", - isOptional: false, - isVariadic: false, - template: "filepaths", - }, - }, - { - name: ["-q", "--quiet"], - description: "Suppress non-error messages", - isRepeatable: false, - }, - { - name: ["-v", "--verbose"], - description: "Show extra output (use -vv for even more)", - isRepeatable: true, - }, - { - name: ["-y", "--yes"], - description: "Answer yes to all confirmation prompts", - isRepeatable: false, - }, - ], + "name": [ + "mise" + ], + "subcommands": [ + { + "name": [ + "activate" + ], + "description": "Initializes mise in the current shell session", + "options": [ + { + "name": [ + "--shims" + ], + "description": "Use shims instead of modifying PATH\nEffectively the same as:", + "isRepeatable": false + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress non-error messages", + "isRepeatable": false + } + ], + "args": [ + { + "name": "shell_type", + "description": "Shell type to generate the script for", + "isOptional": true, + "isVariadic": false, + "suggestions": [ + "bash", + "elvish", + "fish", + "nu", + "xonsh", + "zsh" + ] + } + ] + }, + { + "name": [ + "alias", + "a" + ], + "description": "Manage aliases", + "subcommands": [ + { + "name": [ + "get" + ], + "description": "Show an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to show the alias for", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + }, + { + "name": "alias", + "description": "The alias to show", + "isOptional": false, + "isVariadic": false, + "generators": aliasGenerator + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool", + "description": "Show aliases for ", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "set", + "add", + "create" + ], + "description": "Add/update an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to set the alias for", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + }, + { + "name": "alias", + "description": "The alias to set", + "isOptional": false, + "isVariadic": false, + "generators": aliasGenerator + }, + { + "name": "value", + "description": "The value to set the alias to", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "unset", + "rm", + "remove", + "delete", + "del" + ], + "description": "Clears an alias for a plugin", + "args": [ + { + "name": "plugin", + "description": "The plugin to remove the alias from", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + }, + { + "name": "alias", + "description": "The alias to remove", + "isOptional": false, + "isVariadic": false, + "generators": aliasGenerator + } + ] + } + ], + "options": [ + { + "name": [ + "-p", + "--plugin" + ], + "description": "filter aliases by plugin", + "isRepeatable": false, + "args": { + "name": "plugin", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + } + }, + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ] + }, + { + "name": [ + "backends", + "b" + ], + "description": "Manage backends", + "subcommands": [ + { + "name": [ + "ls", + "list" + ], + "description": "List built-in backends" + } + ] + }, + { + "name": [ + "bin-paths" + ], + "description": "List all the active runtime bin paths" + }, + { + "name": [ + "cache" + ], + "description": "Manage the mise cache", + "subcommands": [ + { + "name": [ + "clear", + "c" + ], + "description": "Deletes all cache files in mise", + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to clear cache for e.g.: node, python", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "prune", + "p" + ], + "description": "Removes stale mise cache files", + "options": [ + { + "name": [ + "--dry-run" + ], + "description": "Just show what would be pruned", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show pruned files", + "isRepeatable": true + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to clear cache for e.g.: node, python", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + } + ] + }, + { + "name": [ + "completion" + ], + "description": "Generate shell completions", + "args": [ + { + "name": "shell", + "description": "Shell type to generate completions for", + "isOptional": true, + "isVariadic": false, + "suggestions": [ + "bash", + "fish", + "zsh" + ] + } + ] + }, + { + "name": [ + "config", + "cfg" + ], + "description": "Manage config files", + "subcommands": [ + { + "name": [ + "generate", + "g" + ], + "description": "[experimental] Generate a mise.toml file", + "options": [ + { + "name": [ + "-o", + "--output" + ], + "description": "Output to file instead of stdout", + "isRepeatable": false, + "args": { + "name": "output", + "isOptional": false, + "isVariadic": false + } + } + ] + }, + { + "name": [ + "get" + ], + "description": "Display the value of a setting in a mise.toml file", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "The path to the mise.toml file to edit", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + } + ], + "args": [ + { + "name": "key", + "description": "The path of the config to display", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "ls" + ], + "description": "List config files currently in use", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "set" + ], + "description": "Set the value of a setting in a mise.toml file", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "The path to the mise.toml file to edit", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-t", + "--type" + ], + "isRepeatable": false, + "args": { + "name": "type", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "infer", + "string", + "integer", + "float", + "bool", + "list" + ] + } + } + ], + "args": [ + { + "name": "key", + "description": "The path of the config to display", + "isOptional": false, + "isVariadic": false + }, + { + "name": "value", + "description": "The value to set the key to", + "isOptional": false, + "isVariadic": false + } + ] + } + ], + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "deactivate" + ], + "description": "Disable mise for current shell session" + }, + { + "name": [ + "direnv" + ], + "description": "Output direnv function to use mise inside direnv", + "subcommands": [ + { + "name": [ + "activate" + ], + "description": "Output direnv function to use mise inside direnv" + } + ] + }, + { + "name": [ + "doctor", + "dr" + ], + "description": "Check mise installation for possible problems" + }, + { + "name": [ + "env", + "e" + ], + "description": "Exports env vars to activate mise a single time", + "options": [ + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "-s", + "--shell" + ], + "description": "Shell type to generate environment variables for", + "isRepeatable": false, + "args": { + "name": "shell", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "bash", + "elvish", + "fish", + "nu", + "xonsh", + "zsh" + ] + } + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to use", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "exec", + "x" + ], + "description": "Execute a command with tool(s) set", + "options": [ + { + "name": [ + "-c", + "--command" + ], + "description": "Command string to execute", + "isRepeatable": false, + "args": { + "name": "c", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to start e.g.: node@20 python@3.10", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + }, + { + "name": "command", + "description": "Command string to execute (same as --command)", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "generate", + "g" + ], + "description": "[experimental] Generate files for various tools/services", + "subcommands": [ + { + "name": [ + "git-pre-commit", + "pre-commit" + ], + "description": "[experimental] Generate a git pre-commit hook", + "options": [ + { + "name": [ + "--hook" + ], + "description": "Which hook to generate (saves to .git/hooks/$hook)", + "isRepeatable": false, + "args": { + "name": "hook", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-t", + "--task" + ], + "description": "The task to run when the pre-commit hook is triggered", + "isRepeatable": false, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + }, + { + "name": [ + "-w", + "--write" + ], + "description": "write to .git/hooks/pre-commit and make it executable", + "isRepeatable": false + } + ] + }, + { + "name": [ + "github-action" + ], + "description": "[experimental] Generate a GitHub Action workflow file", + "options": [ + { + "name": [ + "-n", + "--name" + ], + "description": "the name of the workflow to generate", + "isRepeatable": false, + "args": { + "name": "name", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-t", + "--task" + ], + "description": "The task to run when the workflow is triggered", + "isRepeatable": false, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + }, + { + "name": [ + "-w", + "--write" + ], + "description": "write to .github/workflows/$name.yml", + "isRepeatable": false + } + ] + }, + { + "name": [ + "task-docs" + ], + "description": "Generate documentation for tasks in a project", + "options": [ + { + "name": [ + "-I", + "--index" + ], + "description": "write only an index of tasks, intended for use with `--multi`", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--inject" + ], + "description": "inserts the documentation into an existing file", + "isRepeatable": false + }, + { + "name": [ + "-m", + "--multi" + ], + "description": "render each task as a separate document, requires `--output` to be a directory", + "isRepeatable": false + }, + { + "name": [ + "-o", + "--output" + ], + "description": "writes the generated docs to a file/directory", + "isRepeatable": false, + "args": { + "name": "output", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--root" + ], + "description": "root directory to search for tasks", + "isRepeatable": false, + "args": { + "name": "root", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-s", + "--style" + ], + "isRepeatable": false, + "args": { + "name": "style", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "simple", + "detailed" + ] + } + } + ] + } + ] + }, + { + "name": [ + "implode" + ], + "description": "Removes mise CLI and all related data", + "options": [ + { + "name": [ + "--config" + ], + "description": "Also remove config directory", + "isRepeatable": false + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "List directories that would be removed without actually removing them", + "isRepeatable": false + } + ] + }, + { + "name": [ + "install", + "i" + ], + "description": "Install a tool version", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Force reinstall even if already installed", + "isRepeatable": false + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show installation output", + "isRepeatable": true + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to install e.g.: node@20", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "latest" + ], + "description": "Gets the latest available version for a plugin", + "options": [ + { + "name": [ + "-i", + "--installed" + ], + "description": "Show latest installed instead of available version", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool to get the latest version of", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "link", + "ln" + ], + "description": "Symlinks a tool version into mise", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Overwrite an existing tool version if it exists", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool name and version to create a symlink for", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + }, + { + "name": "path", + "description": "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List installed and active tool versions", + "options": [ + { + "name": [ + "-c", + "--current" + ], + "description": "Only show tool versions currently specified in a mise.toml", + "isRepeatable": false + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Only show tool versions currently specified in the global mise.toml", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--installed" + ], + "description": "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", + "isRepeatable": false + }, + { + "name": [ + "-o", + "--offline" + ], + "description": "Don't fetch information such as outdated versions", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "-m", + "--missing" + ], + "description": "Display missing tool versions", + "isRepeatable": false + }, + { + "name": [ + "--prefix" + ], + "description": "Display versions matching this prefix", + "isRepeatable": false, + "args": { + "name": "prefix", + "isOptional": false, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) + } + }, + { + "name": [ + "--no-header" + ], + "description": "Don't display headers", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Only show tool versions from [PLUGIN]", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "ls-remote" + ], + "description": "List runtime versions available for install.", + "options": [ + { + "name": [ + "--all" + ], + "description": "Show all installed plugins and versions", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Plugin to get versions for", + "isOptional": true, + "isVariadic": false, + "generators": toolVersionGenerator + }, + { + "name": "prefix", + "description": "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\"", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise ls-remote {{words[PREV]}}`) + } + ] + }, + { + "name": [ + "outdated" + ], + "description": "Shows outdated tool versions", + "options": [ + { + "name": [ + "-l", + "--bump" + ], + "description": "Compares against the latest versions available, not what matches the current config", + "isRepeatable": false + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + }, + { + "name": [ + "--no-header" + ], + "description": "Don't show table header", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "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", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "plugins", + "p" + ], + "description": "Manage plugins", + "subcommands": [ + { + "name": [ + "install", + "i", + "a", + "add" + ], + "description": "Install a plugin", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Reinstall even if plugin exists", + "isRepeatable": false + }, + { + "name": [ + "-a", + "--all" + ], + "description": "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show installation output", + "isRepeatable": true + } + ], + "args": [ + { + "name": "new_plugin", + "description": "The name of the plugin to install\ne.g.: node, ruby\nCan specify multiple plugins: `mise plugins install node ruby python`", + "isOptional": true, + "isVariadic": false, + "generators": completionGeneratorTemplate(`mise plugins --all`) + }, + { + "name": "git_url", + "description": "The git url of the plugin", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "link", + "ln" + ], + "description": "Symlinks a plugin into mise", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Overwrite existing plugin", + "isRepeatable": false + } + ], + "args": [ + { + "name": "name", + "description": "The name of the plugin\ne.g.: node, ruby", + "isOptional": false, + "isVariadic": false + }, + { + "name": "path", + "description": "The local path to the plugin\ne.g.: ./mise-node", + "isOptional": true, + "isVariadic": false, + "template": "filepaths" + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "List installed plugins", + "options": [ + { + "name": [ + "-c", + "--core" + ], + "description": "The built-in plugins only\nNormally these are not shown", + "isRepeatable": false + }, + { + "name": [ + "--user" + ], + "description": "List installed plugins", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + "isRepeatable": false + } + ] + }, + { + "name": [ + "ls-remote", + "list-remote", + "list-all" + ], + "description": "List all available remote plugins", + "options": [ + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", + "isRepeatable": false + }, + { + "name": [ + "--only-names" + ], + "description": "Only show the name of each plugin by default it will show a \"*\" next to installed plugins", + "isRepeatable": false + } + ] + }, + { + "name": [ + "uninstall", + "remove", + "rm" + ], + "description": "Removes a plugin", + "options": [ + { + "name": [ + "-p", + "--purge" + ], + "description": "Also remove the plugin's installs, downloads, and cache", + "isRepeatable": false + }, + { + "name": [ + "-a", + "--all" + ], + "description": "Remove all plugins", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to remove", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "update", + "up", + "upgrade" + ], + "description": "Updates a plugin to the latest version", + "options": [ + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\nDefault: 4", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + } + ], + "args": [ + { + "name": "plugin", + "description": "Plugin(s) to update", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + } + ], + "options": [ + { + "name": [ + "-c", + "--core" + ], + "description": "The built-in plugins only\nNormally these are not shown", + "isRepeatable": false + }, + { + "name": [ + "--user" + ], + "description": "List installed plugins", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--urls" + ], + "description": "Show the git url for each plugin\ne.g.: https://github.com/asdf-vm/asdf-nodejs.git", + "isRepeatable": false + } + ] + }, + { + "name": [ + "prune" + ], + "description": "Delete unused versions of tools", + "options": [ + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Do not actually delete anything", + "isRepeatable": false + }, + { + "name": [ + "--configs" + ], + "description": "Prune only tracked and trusted configuration links that point to non-existent configurations", + "isRepeatable": false + }, + { + "name": [ + "--tools" + ], + "description": "Prune only unused versions of tools", + "isRepeatable": false + } + ], + "args": [ + { + "name": "plugin", + "description": "Prune only versions from this plugin(s)", + "isOptional": true, + "isVariadic": true, + "generators": pluginGenerator + } + ] + }, + { + "name": [ + "registry" + ], + "description": "List available tools to install", + "args": [ + { + "name": "name", + "description": "Show only the specified tool's full name", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "reshim" + ], + "description": "Creates new shims based on bin paths from currently installed tools.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Removes all shims before reshimming", + "isRepeatable": false + } + ] + }, + { + "name": [ + "run", + "r" + ], + "description": "Run task(s)", + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change to this directory before executing the command", + "isRepeatable": false, + "args": { + "name": "cd", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Don't actually run the tasks(s), just print them in order of execution", + "isRepeatable": false + }, + { + "name": [ + "-f", + "--force" + ], + "description": "Force the tasks to run even if outputs are up to date", + "isRepeatable": false + }, + { + "name": [ + "-p", + "--prefix" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interleave" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Tool(s) to also add e.g.: node@20 python@3.10", + "isRepeatable": true, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--raw" + ], + "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + "isRepeatable": false + }, + { + "name": [ + "--timings" + ], + "description": "Shows elapsed time after each task completes", + "isRepeatable": false + } + ], + "generateSpec": usageGenerateSpec(["mise tasks --usage"]), + "cache": false + }, + { + "name": [ + "self-update" + ], + "description": "Updates mise itself.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Update even if already up to date", + "isRepeatable": false + }, + { + "name": [ + "--no-plugins" + ], + "description": "Disable auto-updating plugins", + "isRepeatable": false + }, + { + "name": [ + "-y", + "--yes" + ], + "description": "Skip confirmation prompt", + "isRepeatable": false + } + ], + "args": [ + { + "name": "version", + "description": "Update to a specific version", + "isOptional": true, + "isVariadic": false + } + ] + }, + { + "name": [ + "set" + ], + "description": "Set environment variables in mise.toml", + "options": [ + { + "name": [ + "--file" + ], + "description": "The TOML file to update", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Set the environment variable in the global config file", + "isRepeatable": false + } + ], + "args": [ + { + "name": "env_vars", + "description": "Environment variable(s) to set\ne.g.: NODE_ENV=production", + "isOptional": true, + "isVariadic": true, + "generators": envVarGenerator + } + ] + }, + { + "name": [ + "settings" + ], + "description": "Manage settings", + "subcommands": [ + { + "name": [ + "add" + ], + "description": "Adds a setting to the configuration file", + "args": [ + { + "name": "setting", + "description": "The setting to set", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + }, + { + "name": "value", + "description": "The value to set", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "get" + ], + "description": "Show a current setting", + "args": [ + { + "name": "setting", + "description": "The setting to show", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + } + ] + }, + { + "name": [ + "ls", + "list" + ], + "description": "Show current settings", + "options": [ + { + "name": [ + "--keys" + ], + "description": "Only display key names for each setting", + "isRepeatable": false + } + ] + }, + { + "name": [ + "set", + "create" + ], + "description": "Add/update a setting", + "args": [ + { + "name": "setting", + "description": "The setting to set", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + }, + { + "name": "value", + "description": "The value to set", + "isOptional": false, + "isVariadic": false + } + ] + }, + { + "name": [ + "unset", + "rm", + "remove", + "delete", + "del" + ], + "description": "Clears a setting", + "args": [ + { + "name": "setting", + "description": "The setting to remove", + "isOptional": false, + "isVariadic": false, + "generators": settingsGenerator + } + ] + } + ], + "options": [ + { + "name": [ + "--keys" + ], + "description": "Only display key names for each setting", + "isRepeatable": false + } + ] + }, + { + "name": [ + "shell", + "sh" + ], + "description": "Sets a tool version for the current session.", + "options": [ + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + }, + { + "name": [ + "-u", + "--unset" + ], + "description": "Removes a previously set version", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to use", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "sync" + ], + "description": "Add tool versions from external tools to mise", + "subcommands": [ + { + "name": [ + "node" + ], + "description": "Symlinks all tool versions from an external tool into mise", + "options": [ + { + "name": [ + "--brew" + ], + "description": "Get tool versions from Homebrew", + "isRepeatable": false + }, + { + "name": [ + "--nvm" + ], + "description": "Get tool versions from nvm", + "isRepeatable": false + }, + { + "name": [ + "--nodenv" + ], + "description": "Get tool versions from nodenv", + "isRepeatable": false + } + ] + }, + { + "name": [ + "python" + ], + "description": "Symlinks all tool versions from an external tool into mise", + "options": [ + { + "name": [ + "--pyenv" + ], + "description": "Get tool versions from pyenv", + "isRepeatable": false + } + ] + } + ] + }, + { + "name": [ + "tasks", + "t" + ], + "description": "Manage tasks", + "subcommands": [ + { + "name": [ + "deps" + ], + "description": "Display a tree visualization of a dependency graph", + "options": [ + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--dot" + ], + "description": "Display dependencies in DOT format", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tasks", + "description": "Tasks to show dependencies for\nCan specify multiple tasks by separating with spaces\ne.g.: mise tasks deps lint test check", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "edit" + ], + "description": "Edit a tasks with $EDITOR", + "options": [ + { + "name": [ + "-p", + "--path" + ], + "description": "Display the path to the tasks instead of editing it", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Tasks to edit", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + ] + }, + { + "name": [ + "info" + ], + "description": "Get information about a task", + "options": [ + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Name of the task to get information about", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + ] + }, + { + "name": [ + "ls" + ], + "description": "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.", + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-x", + "--extended" + ], + "description": "Show all columns", + "isRepeatable": false + }, + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--sort" + ], + "description": "Sort by column. Default is name.", + "isRepeatable": false, + "args": { + "name": "column", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "name", + "alias", + "description", + "source" + ] + } + }, + { + "name": [ + "--sort-order" + ], + "description": "Sort order. Default is asc.", + "isRepeatable": false, + "args": { + "name": "sort_order", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "asc", + "desc" + ] + } + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "run", + "r" + ], + "description": "Run task(s)", + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change to this directory before executing the command", + "isRepeatable": false, + "args": { + "name": "cd", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Don't actually run the tasks(s), just print them in order of execution", + "isRepeatable": false + }, + { + "name": [ + "-f", + "--force" + ], + "description": "Force the tasks to run even if outputs are up to date", + "isRepeatable": false + }, + { + "name": [ + "-p", + "--prefix" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interleave" + ], + "description": "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", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Tool(s) to also add e.g.: node@20 python@3.10", + "isRepeatable": true, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of tasks to run in parallel\n[default: 4]\nConfigure with `jobs` config or `MISE_JOBS` env var", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-r", + "--raw" + ], + "description": "Read/write directly to stdin/stdout/stderr instead of by line\nConfigure with `raw` config or `MISE_RAW` env var", + "isRepeatable": false + }, + { + "name": [ + "--timings" + ], + "description": "Shows elapsed time after each task completes", + "isRepeatable": false + } + ], + "args": [ + { + "name": "task", + "description": "Tasks to run\nCan specify multiple tasks by separating with `:::`\ne.g.: mise run task1 arg1 arg2 ::: task2 arg1 arg2", + "isOptional": true, + "isVariadic": false, + "generators": simpleTaskGenerator + }, + { + "name": "args", + "description": "Arguments to pass to the tasks. Use \":::\" to separate tasks", + "isOptional": true, + "isVariadic": true + } + ], + "generateSpec": usageGenerateSpec(["mise tasks --usage"]), + "cache": false + } + ], + "options": [ + { + "name": [ + "--no-header" + ], + "description": "Do not print table header", + "isRepeatable": false + }, + { + "name": [ + "-x", + "--extended" + ], + "description": "Show all columns", + "isRepeatable": false + }, + { + "name": [ + "--hidden" + ], + "description": "Show hidden tasks", + "isRepeatable": false + }, + { + "name": [ + "--sort" + ], + "description": "Sort by column. Default is name.", + "isRepeatable": false, + "args": { + "name": "column", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "name", + "alias", + "description", + "source" + ] + } + }, + { + "name": [ + "--sort-order" + ], + "description": "Sort order. Default is asc.", + "isRepeatable": false, + "args": { + "name": "sort_order", + "isOptional": false, + "isVariadic": false, + "suggestions": [ + "asc", + "desc" + ] + } + }, + { + "name": [ + "-J", + "--json" + ], + "description": "Output in JSON format", + "isRepeatable": false + } + ] + }, + { + "name": [ + "trust" + ], + "description": "Marks a config file as trusted", + "options": [ + { + "name": [ + "-a", + "--all" + ], + "description": "Trust all config files in the current directory and its parents", + "isRepeatable": false + }, + { + "name": [ + "--untrust" + ], + "description": "No longer trust this config", + "isRepeatable": false + }, + { + "name": [ + "--show" + ], + "description": "Show the trusted status of config files from the current directory and its parents.\nDoes not trust or untrust any files.", + "isRepeatable": false + } + ], + "args": [ + { + "name": "config_file", + "description": "The config file to trust", + "isOptional": true, + "isVariadic": false, + "template": "filepaths", + "generators": configPathGenerator + } + ] + }, + { + "name": [ + "uninstall", + "remove", + "rm" + ], + "description": "Removes installed tool versions", + "options": [ + { + "name": [ + "-a", + "--all" + ], + "description": "Delete all installed versions", + "isRepeatable": false + }, + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Do not actually delete anything", + "isRepeatable": false + } + ], + "args": [ + { + "name": "installed_tool@version", + "description": "Tool(s) to remove", + "isOptional": true, + "isVariadic": true, + "generators": installedToolVersionGenerator + } + ] + }, + { + "name": [ + "unset" + ], + "description": "Remove environment variable(s) from the config file.", + "options": [ + { + "name": [ + "-f", + "--file" + ], + "description": "Specify a file to use instead of `mise.toml`", + "isRepeatable": false, + "args": { + "name": "file", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Use the global config file", + "isRepeatable": false + } + ], + "args": [ + { + "name": "keys", + "description": "Environment variable(s) to remove\ne.g.: NODE_ENV", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "upgrade", + "up" + ], + "description": "Upgrades outdated tools", + "options": [ + { + "name": [ + "-n", + "--dry-run" + ], + "description": "Just print what would be done, don't actually do it", + "isRepeatable": false + }, + { + "name": [ + "-i", + "--interactive" + ], + "description": "Display multiselect menu to choose which tools to upgrade", + "isRepeatable": false + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-l", + "--bump" + ], + "description": "Upgrades to the latest version available, bumping the version in mise.toml", + "isRepeatable": false + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets --jobs=1", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to upgrade\ne.g.: node@20 python@3.10\nIf not specified, all current tools will be upgraded", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "use", + "u" + ], + "description": "Installs a tool and adds the version it to mise.toml.", + "options": [ + { + "name": [ + "-f", + "--force" + ], + "description": "Force reinstall even if already installed", + "isRepeatable": false + }, + { + "name": [ + "--fuzzy" + ], + "description": "Save fuzzy version to config file", + "isRepeatable": false + }, + { + "name": [ + "-g", + "--global" + ], + "description": "Use the global config file (`~/.config/mise/config.toml`) instead of the local one", + "isRepeatable": false + }, + { + "name": [ + "-e", + "--env" + ], + "description": "Modify an environment-specific config file like .mise..toml", + "isRepeatable": false, + "args": { + "name": "env", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "-j", + "--jobs" + ], + "description": "Number of jobs to run in parallel\n[default: 4]", + "isRepeatable": false, + "args": { + "name": "jobs", + "isOptional": false, + "isVariadic": false + } + }, + { + "name": [ + "--raw" + ], + "description": "Directly pipe stdin/stdout/stderr from plugin to user Sets `--jobs=1`", + "isRepeatable": false + }, + { + "name": [ + "--remove" + ], + "description": "Remove the plugin(s) from config file", + "isRepeatable": true, + "args": { + "name": "plugin", + "isOptional": false, + "isVariadic": false, + "generators": pluginGenerator + } + }, + { + "name": [ + "-p", + "--path" + ], + "description": "Specify a path to a config file or directory", + "isRepeatable": false, + "args": { + "name": "path", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "--pin" + ], + "description": "Save exact version to config file\ne.g.: `mise use --pin node@20` will save 20.0.0 as the version\nSet `MISE_PIN=1` or `MISE_ASDF_COMPAT=1` to make this the default behavior", + "isRepeatable": false + } + ], + "args": [ + { + "name": "tool@version", + "description": "Tool(s) to add to config file", + "isOptional": true, + "isVariadic": true, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "version", + "v" + ], + "description": "Display the version of mise" + }, + { + "name": [ + "watch", + "w" + ], + "description": "Run task(s) and watch for changes to rerun it", + "options": [ + { + "name": [ + "-t", + "--task" + ], + "description": "Tasks to run", + "isRepeatable": true, + "args": { + "name": "task", + "isOptional": false, + "isVariadic": false, + "generators": simpleTaskGenerator + } + }, + { + "name": [ + "-g", + "--glob" + ], + "description": "Files to watch\nDefaults to sources from the tasks(s)", + "isRepeatable": true, + "args": { + "name": "glob", + "isOptional": false, + "isVariadic": false + } + } + ], + "args": [ + { + "name": "args", + "description": "Extra arguments", + "isOptional": true, + "isVariadic": true + } + ] + }, + { + "name": [ + "where" + ], + "description": "Display the installation path for a tool", + "args": [ + { + "name": "tool@version", + "description": "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", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + ] + }, + { + "name": [ + "which" + ], + "description": "Shows the path that a tool's bin points to.", + "options": [ + { + "name": [ + "--plugin" + ], + "description": "Show the plugin name instead of the path", + "isRepeatable": false + }, + { + "name": [ + "--version" + ], + "description": "Show the version instead of the path", + "isRepeatable": false + }, + { + "name": [ + "-t", + "--tool" + ], + "description": "Use a specific tool@version\ne.g.: `mise which npm --tool=node@20`", + "isRepeatable": false, + "args": { + "name": "tool@version", + "isOptional": false, + "isVariadic": false, + "generators": toolVersionGenerator + } + } + ], + "args": [ + { + "name": "bin_name", + "description": "The bin to look up", + "isOptional": false, + "isVariadic": false + } + ] + } + ], + "options": [ + { + "name": [ + "-C", + "--cd" + ], + "description": "Change directory before running command", + "isRepeatable": false, + "args": { + "name": "dir", + "isOptional": false, + "isVariadic": false, + "template": "folders" + } + }, + { + "name": [ + "-P", + "--profile" + ], + "description": "Set the profile (environment)", + "isRepeatable": false, + "args": { + "name": "profile", + "isOptional": false, + "isVariadic": false, + "template": "filepaths" + } + }, + { + "name": [ + "-q", + "--quiet" + ], + "description": "Suppress non-error messages", + "isRepeatable": false + }, + { + "name": [ + "-v", + "--verbose" + ], + "description": "Show extra output (use -vv for even more)", + "isRepeatable": true + }, + { + "name": [ + "-y", + "--yes" + ], + "description": "Answer yes to all confirmation prompts", + "isRepeatable": false + } + ] }; export default completionSpec;