mirror of https://github.com/jdx/mise
docs: add individual page for every CLI command
This commit is contained in:
parent
fff2253200
commit
53b0223950
|
@ -1,3 +1,4 @@
|
|||
registry/
|
||||
target/
|
||||
CHANGELOG.md
|
||||
docs/node_modules/
|
||||
|
|
|
@ -0,0 +1,265 @@
|
|||
// This file is generated by `mise render-help`
|
||||
// Do not edit this file directly
|
||||
|
||||
export type Command = {
|
||||
hide: boolean,
|
||||
subcommands?: {
|
||||
[key: string]: Command,
|
||||
},
|
||||
};
|
||||
export const commands: { [key: string]: Command } = {
|
||||
"activate": {
|
||||
hide: false,
|
||||
},
|
||||
"alias": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"get": {
|
||||
hide: false,
|
||||
},
|
||||
"ls": {
|
||||
hide: false,
|
||||
},
|
||||
"set": {
|
||||
hide: false,
|
||||
},
|
||||
"unset": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"asdf": {
|
||||
hide: true,
|
||||
},
|
||||
"backends": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"ls": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"bin-paths": {
|
||||
hide: false,
|
||||
},
|
||||
"cache": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"clear": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"completion": {
|
||||
hide: false,
|
||||
},
|
||||
"config": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"ls": {
|
||||
hide: false,
|
||||
},
|
||||
"generate": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"current": {
|
||||
hide: false,
|
||||
},
|
||||
"deactivate": {
|
||||
hide: false,
|
||||
},
|
||||
"direnv": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"envrc": {
|
||||
hide: true,
|
||||
},
|
||||
"exec": {
|
||||
hide: true,
|
||||
},
|
||||
"activate": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"doctor": {
|
||||
hide: false,
|
||||
},
|
||||
"env": {
|
||||
hide: false,
|
||||
},
|
||||
"exec": {
|
||||
hide: false,
|
||||
},
|
||||
"generate": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"git-pre-commit": {
|
||||
hide: false,
|
||||
},
|
||||
"github-action": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"global": {
|
||||
hide: true,
|
||||
},
|
||||
"hook-env": {
|
||||
hide: true,
|
||||
},
|
||||
"hook-not-found": {
|
||||
hide: true,
|
||||
},
|
||||
"implode": {
|
||||
hide: false,
|
||||
},
|
||||
"install": {
|
||||
hide: false,
|
||||
},
|
||||
"latest": {
|
||||
hide: false,
|
||||
},
|
||||
"link": {
|
||||
hide: false,
|
||||
},
|
||||
"local": {
|
||||
hide: true,
|
||||
},
|
||||
"ls": {
|
||||
hide: false,
|
||||
},
|
||||
"ls-remote": {
|
||||
hide: false,
|
||||
},
|
||||
"outdated": {
|
||||
hide: false,
|
||||
},
|
||||
"plugins": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"install": {
|
||||
hide: false,
|
||||
},
|
||||
"link": {
|
||||
hide: false,
|
||||
},
|
||||
"ls": {
|
||||
hide: false,
|
||||
},
|
||||
"ls-remote": {
|
||||
hide: false,
|
||||
},
|
||||
"uninstall": {
|
||||
hide: false,
|
||||
},
|
||||
"update": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"prune": {
|
||||
hide: false,
|
||||
},
|
||||
"registry": {
|
||||
hide: false,
|
||||
},
|
||||
"render-help": {
|
||||
hide: true,
|
||||
},
|
||||
"render-mangen": {
|
||||
hide: true,
|
||||
},
|
||||
"reshim": {
|
||||
hide: false,
|
||||
},
|
||||
"run": {
|
||||
hide: false,
|
||||
},
|
||||
"self-update": {
|
||||
hide: false,
|
||||
},
|
||||
"set": {
|
||||
hide: false,
|
||||
},
|
||||
"settings": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"get": {
|
||||
hide: false,
|
||||
},
|
||||
"ls": {
|
||||
hide: false,
|
||||
},
|
||||
"set": {
|
||||
hide: false,
|
||||
},
|
||||
"unset": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"shell": {
|
||||
hide: false,
|
||||
},
|
||||
"sync": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"node": {
|
||||
hide: false,
|
||||
},
|
||||
"python": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"tasks": {
|
||||
hide: false,
|
||||
subcommands: {
|
||||
"deps": {
|
||||
hide: false,
|
||||
},
|
||||
"edit": {
|
||||
hide: false,
|
||||
},
|
||||
"ls": {
|
||||
hide: false,
|
||||
},
|
||||
"run": {
|
||||
hide: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"trust": {
|
||||
hide: false,
|
||||
},
|
||||
"uninstall": {
|
||||
hide: false,
|
||||
},
|
||||
"unset": {
|
||||
hide: false,
|
||||
},
|
||||
"upgrade": {
|
||||
hide: false,
|
||||
},
|
||||
"usage": {
|
||||
hide: false,
|
||||
},
|
||||
"use": {
|
||||
hide: false,
|
||||
},
|
||||
"version": {
|
||||
hide: false,
|
||||
},
|
||||
"watch": {
|
||||
hide: false,
|
||||
},
|
||||
"where": {
|
||||
hide: false,
|
||||
},
|
||||
"which": {
|
||||
hide: false,
|
||||
},
|
||||
};
|
|
@ -1,4 +1,5 @@
|
|||
import { defineConfig } from 'vitepress'
|
||||
import { Command, commands } from './cli_commands'
|
||||
|
||||
// https://vitepress.dev/reference/site-config
|
||||
export default defineConfig({
|
||||
|
@ -14,44 +15,44 @@ export default defineConfig({
|
|||
// https://vitepress.dev/reference/default-theme-config
|
||||
outline: 'deep',
|
||||
nav: [
|
||||
{ text: 'Dev Tools', link: '/dev-tools/' },
|
||||
{ text: 'Environments', link: '/environments' },
|
||||
{ text: 'Tasks', link: '/tasks/' },
|
||||
{text: 'Dev Tools', link: '/dev-tools/'},
|
||||
{text: 'Environments', link: '/environments'},
|
||||
{text: 'Tasks', link: '/tasks/'},
|
||||
],
|
||||
sidebar: [
|
||||
{ text: 'Getting Started', link: '/getting-started' },
|
||||
{ text: 'About', link: '/about' },
|
||||
{ text: 'Coming from rtx', link: '/rtx' },
|
||||
{ text: 'Configuration', link: '/configuration' },
|
||||
{ text: 'Continuous Integration', link: '/continuous-integration' },
|
||||
{ text: 'Demo', link: '/demo' },
|
||||
{ text: 'FAQs', link: '/faq' },
|
||||
{ text: 'How I Use mise', link: '/how-i-use-mise' },
|
||||
{ text: 'IDE Integration', link: '/ide-integration' },
|
||||
{ text: 'Paranoid', link: '/paranoid' },
|
||||
{ text: 'Registry', link: '/registry' },
|
||||
{ text: 'Plugins', link: '/plugins' },
|
||||
{ text: 'Team', link: '/team' },
|
||||
{ text: 'Contributing', link: '/contributing' },
|
||||
{ text: 'Tips & Tricks', link: '/tips-and-tricks' },
|
||||
{text: 'Getting Started', link: '/getting-started'},
|
||||
{text: 'About', link: '/about'},
|
||||
{text: 'Coming from rtx', link: '/rtx'},
|
||||
{text: 'Configuration', link: '/configuration'},
|
||||
{text: 'Continuous Integration', link: '/continuous-integration'},
|
||||
{text: 'Demo', link: '/demo'},
|
||||
{text: 'FAQs', link: '/faq'},
|
||||
{text: 'How I Use mise', link: '/how-i-use-mise'},
|
||||
{text: 'IDE Integration', link: '/ide-integration'},
|
||||
{text: 'Paranoid', link: '/paranoid'},
|
||||
{text: 'Registry', link: '/registry'},
|
||||
{text: 'Plugins', link: '/plugins'},
|
||||
{text: 'Team', link: '/team'},
|
||||
{text: 'Contributing', link: '/contributing'},
|
||||
{text: 'Tips & Tricks', link: '/tips-and-tricks'},
|
||||
{
|
||||
text: 'Dev Tools',
|
||||
link: '/dev-tools/',
|
||||
items: [
|
||||
{ text: 'Aliases', link: '/dev-tools/aliases' },
|
||||
{ text: 'Comparison to asdf', link: '/dev-tools/comparison-to-asdf' },
|
||||
{ text: 'Shims', link: '/dev-tools/shims' },
|
||||
{text: 'Aliases', link: '/dev-tools/aliases'},
|
||||
{text: 'Comparison to asdf', link: '/dev-tools/comparison-to-asdf'},
|
||||
{text: 'Shims', link: '/dev-tools/shims'},
|
||||
{
|
||||
text: 'Backends',
|
||||
link: '/dev-tools/backends/',
|
||||
items: [
|
||||
{ text: 'asdf', link: '/dev-tools/backends/asdf' },
|
||||
{ text: 'cargo', link: '/dev-tools/backends/cargo' },
|
||||
{ text: 'go', link: '/dev-tools/backends/go' },
|
||||
{ text: 'npm', link: '/dev-tools/backends/npm' },
|
||||
{ text: 'pipx', link: '/dev-tools/backends/pipx' },
|
||||
{ text: 'spm', link: '/dev-tools/backends/spm' },
|
||||
{ text: 'ubi', link: '/dev-tools/backends/ubi' },
|
||||
{text: 'asdf', link: '/dev-tools/backends/asdf'},
|
||||
{text: 'cargo', link: '/dev-tools/backends/cargo'},
|
||||
{text: 'go', link: '/dev-tools/backends/go'},
|
||||
{text: 'npm', link: '/dev-tools/backends/npm'},
|
||||
{text: 'pipx', link: '/dev-tools/backends/pipx'},
|
||||
{text: 'spm', link: '/dev-tools/backends/spm'},
|
||||
{text: 'ubi', link: '/dev-tools/backends/ubi'},
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -60,9 +61,9 @@ export default defineConfig({
|
|||
text: 'Environments',
|
||||
link: '/environments',
|
||||
items: [
|
||||
{ text: 'direnv', link: '/direnv' },
|
||||
{ text: 'Profiles', link: '/profiles' },
|
||||
{ text: 'Templates', link: '/templates' },
|
||||
{text: 'direnv', link: '/direnv'},
|
||||
{text: 'Profiles', link: '/profiles'},
|
||||
{text: 'Templates', link: '/templates'},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
@ -77,36 +78,37 @@ export default defineConfig({
|
|||
{
|
||||
text: 'Languages',
|
||||
items: [
|
||||
{ text: 'Bun', link: '/lang/bun' },
|
||||
{ text: 'Deno', link: '/lang/deno' },
|
||||
{ text: 'Erlang', link: '/lang/erlang' },
|
||||
{ text: 'Go', link: '/lang/go' },
|
||||
{ text: 'Java', link: '/lang/java' },
|
||||
{ text: 'Node.js', link: '/lang/node' },
|
||||
{ text: 'Python', link: '/lang/python' },
|
||||
{ text: 'Ruby', link: '/lang/ruby' },
|
||||
{ text: 'Rust', link: '/lang/rust' },
|
||||
{text: 'Bun', link: '/lang/bun'},
|
||||
{text: 'Deno', link: '/lang/deno'},
|
||||
{text: 'Erlang', link: '/lang/erlang'},
|
||||
{text: 'Go', link: '/lang/go'},
|
||||
{text: 'Java', link: '/lang/java'},
|
||||
{text: 'Node.js', link: '/lang/node'},
|
||||
{text: 'Python', link: '/lang/python'},
|
||||
{text: 'Ruby', link: '/lang/ruby'},
|
||||
{text: 'Rust', link: '/lang/rust'},
|
||||
]
|
||||
},
|
||||
{
|
||||
text: 'Internals',
|
||||
items: [
|
||||
{ text: 'Cache Behavior', link: '/cache-behavior' },
|
||||
{ text: 'Directory Structure', link: '/directories' },
|
||||
{ text: 'Project Roadmap', link: '/project-roadmap' },
|
||||
{text: 'Cache Behavior', link: '/cache-behavior'},
|
||||
{text: 'Directory Structure', link: '/directories'},
|
||||
{text: 'Project Roadmap', link: '/project-roadmap'},
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'CLI Reference',
|
||||
link: '/cli/',
|
||||
items: [
|
||||
{ text: 'Global Flags', link: '/cli/global-flags' }
|
||||
{text: 'Global Flags', link: '/cli/global-flags'},
|
||||
...cliReference(commands),
|
||||
]
|
||||
},
|
||||
],
|
||||
|
||||
socialLinks: [
|
||||
{ icon: 'github', link: 'https://github.com/jdx/mise' }
|
||||
{icon: 'github', link: 'https://github.com/jdx/mise'}
|
||||
],
|
||||
|
||||
editLink: {
|
||||
|
@ -138,7 +140,7 @@ export default defineConfig({
|
|||
head: [
|
||||
[
|
||||
'script',
|
||||
{ async: '', src: 'https://www.googletagmanager.com/gtag/js?id=G-B69G389C8T' }
|
||||
{async: '', src: 'https://www.googletagmanager.com/gtag/js?id=G-B69G389C8T'}
|
||||
],
|
||||
[
|
||||
'script',
|
||||
|
@ -150,3 +152,24 @@ export default defineConfig({
|
|||
]
|
||||
],
|
||||
})
|
||||
|
||||
function cliReference(commands: { [key: string]: Command }) {
|
||||
return Object.keys(commands)
|
||||
.map((name) => [name, commands[name]] as [string, Command])
|
||||
.filter(([name, command]) => command.hide !== true)
|
||||
.map(([name, command]) => {
|
||||
const x: any = {
|
||||
text: name,
|
||||
};
|
||||
if (command.subcommands) {
|
||||
x.collapsed = true;
|
||||
x.items = Object.keys(command.subcommands).map((subcommand) => ({
|
||||
text: subcommand,
|
||||
link: `/cli/${name}/${subcommand}`,
|
||||
}));
|
||||
} else {
|
||||
x.link = `/cli/${name}`;
|
||||
}
|
||||
return x;
|
||||
})
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ directory. Other projects on your machine can use a different set of versions.
|
|||
mise is inspired by [asdf](https://asdf-vm.com) and uses asdf's
|
||||
vast [plugin ecosystem](https://github.com/rtx-plugins/registry)
|
||||
under the hood. However, it is _much_ faster than asdf and has a more friendly user experience.
|
||||
For more on how mise compares to asdf, [see below](./comparison-to-asdf). See available plugins for
|
||||
For more on how mise compares to asdf, [see below](./comparison-to-asdf). See plugins available for
|
||||
mise with
|
||||
[`mise plugins ls-remote`](https://mise.jdx.dev/cli/#mise-plugins-ls-remote-options).
|
||||
[`mise plugins ls-remote`](/cli/plugins/ls-remote).
|
||||
|
||||
mise can be configured in many ways. The most typical is by `.mise.toml`, but it's also compatible
|
||||
with asdf `.tool-versions` files. It can also use idiomatic version files like `.node-version` and
|
||||
|
@ -65,7 +65,7 @@ for each command to go to its reference documentation page to see all available
|
|||
more
|
||||
examples.
|
||||
|
||||
### [`mise use`](https://mise.jdx.dev/cli/#mise-use-options-tool-version)
|
||||
### [`mise use`](/cli/use)
|
||||
|
||||
For some users, `mise use` might be the only command you need to learn. It will do the following:
|
||||
|
||||
|
@ -83,7 +83,7 @@ unless there is a config file in the local directory hierarchy, node-20 will be
|
|||
for
|
||||
the user.
|
||||
|
||||
### [`mise install`](https://mise.jdx.dev/cli/#mise-install-options-tool-version)
|
||||
### [`mise install`](/cli/install)
|
||||
|
||||
`mise install` will install but not activate tools—meaning it will download/build/compile the tool
|
||||
into `~/.local/share/mise/installs` but you won't be able to use it without "setting" the version
|
||||
|
@ -111,7 +111,7 @@ These are hidden from the CLI help and remain for asdf-compatibility. The recomm
|
|||
to use `mise use` instead because that will do the same thing but also install the tool if it does
|
||||
not already exists.
|
||||
|
||||
### [`mise exec`|`mise x`](https://mise.jdx.dev/cli/#mise-use-options-tool-version)
|
||||
### [`mise exec`|`mise x`](/cli/exec)
|
||||
|
||||
`mise x` can be used for one-off commands using specific tools. e.g.: if you want to run a script
|
||||
with python3.12:
|
||||
|
|
|
@ -62,7 +62,7 @@ never modify PATH because it never displays a prompt. For this type of setup, yo
|
|||
`mise hook-env` manually every time you wish to update PATH, or use [shims](/dev-tools/shims.md)
|
||||
instead (preferred).
|
||||
Or if you only need to use mise for certain commands, just prefix the commands with
|
||||
[`mise x --`](./cli/#mise-exec-options-tool-version-command).
|
||||
[`mise x --`](./cli/exec).
|
||||
For example, `mise x -- npm test` or `mise x -- ./my_script.sh`.
|
||||
|
||||
`mise hook-env` will exit early in different situations if no changes have been made. This prevents
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,6 +25,7 @@ impl RenderHelp {
|
|||
doc.push_str(current_readme.next().unwrap());
|
||||
doc = remove_trailing_spaces(&doc) + "\n";
|
||||
file::write("docs/cli/index.md", &doc)?;
|
||||
file::write("docs/.vitepress/cli_commands.ts", render_command_ts())?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -120,6 +121,61 @@ fn remove_trailing_spaces(s: &str) -> String {
|
|||
.join("\n")
|
||||
}
|
||||
|
||||
fn render_command_ts() -> String {
|
||||
let mut doc = String::new();
|
||||
doc.push_str(&formatdoc! {r#"
|
||||
// This file is generated by `mise render-help`
|
||||
// Do not edit this file directly
|
||||
|
||||
export type Command = {{
|
||||
hide: boolean,
|
||||
subcommands?: {{
|
||||
[key: string]: Command,
|
||||
}},
|
||||
}};
|
||||
"#});
|
||||
doc.push_str("export const commands: { [key: string]: Command } = {\n");
|
||||
let mut cli = Cli::command()
|
||||
.term_width(80)
|
||||
.max_term_width(80)
|
||||
.disable_help_subcommand(true)
|
||||
.disable_help_flag(true);
|
||||
for command in cli
|
||||
.get_subcommands_mut()
|
||||
.sorted_by_cached_key(|c| c.get_name().to_string())
|
||||
{
|
||||
match command.has_subcommands() {
|
||||
true => {
|
||||
let name = command.get_name().to_string();
|
||||
doc.push_str(&format!(
|
||||
" \"{}\": {{\n hide: {},\n subcommands: {{\n",
|
||||
name,
|
||||
command.is_hide_set()
|
||||
));
|
||||
for subcommand in command.get_subcommands_mut() {
|
||||
let output = format!(
|
||||
" \"{}\": {{\n hide: {},\n }},\n",
|
||||
subcommand.get_name(),
|
||||
subcommand.is_hide_set()
|
||||
);
|
||||
doc.push_str(&output);
|
||||
}
|
||||
doc.push_str(" },\n },\n");
|
||||
}
|
||||
false => {
|
||||
let output = format!(
|
||||
" \"{}\": {{\n hide: {},\n }},\n",
|
||||
command.get_name(),
|
||||
command.is_hide_set()
|
||||
);
|
||||
doc.push_str(&output);
|
||||
}
|
||||
}
|
||||
}
|
||||
doc.push_str("};\n");
|
||||
doc
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::fs;
|
||||
|
|
Loading…
Reference in New Issue