diff --git a/go/README.md b/go/README.md index 2e36bbbe4..286005a97 100644 --- a/go/README.md +++ b/go/README.md @@ -139,8 +139,12 @@ argv.UsageLine([]string{"mise"}, mise.Root, mise.HelpText) // mise [FLAGS] [TASK] ``` -**All 211 of mise's usage lines match usage-lib's byte for byte**, which is the -test that keeps it honest. usage-lib builds the line from a spec through a +`argv.ShortHelp` renders the whole page `-h` prints — header, `Commands`, +`Arguments`, `Flags` and `Global flags`, with the columns lined up and the +inherited globals worked out the way the parser resolves them. + +**All 211 of mise's usage lines and all 211 of its pages match usage-lib's byte +for byte**, which is the test that keeps both honest. usage-lib builds the line from a spec through a template over a runtime model; this builds it from static tables. Reimplemented rules drift, so both are run over mise's real spec and compared — the same check `benches/gate/tests/help.rs` makes for usage-argv, against the same reference. @@ -183,9 +187,9 @@ claim is measured at real scale rather than against a fixture with four flags: - **Typed values.** Binding collects text. Something still has to turn `"8"` into an `int` and `"1m"` into a `time.Duration`, and report the ones that will not convert. -- **The help pages themselves.** The usage line is done and the table behind it - carries the text; `-h` and `--help` still need laying out, which on the Rust - side is most of `argv/src/help.rs`. +- **The long page.** `-h` is done; `--help` wraps long descriptions and switches + to a two-line layout for entries that have a longer form, which `ShortHelp` + does not do. - **Errors worth reading.** `Error()` returns `unknown flag: --wat`, which names the problem and helps nobody fix it. usage-argv renders these through miette with the offending token underlined. diff --git a/go/argv/help.go b/go/argv/help.go index 127d56dd5..8b3729280 100644 --- a/go/argv/help.go +++ b/go/argv/help.go @@ -48,6 +48,29 @@ type Help struct { Long string // Heading groups an entry into a section of the page. Presentational only. Heading string + + // The rest a page prints and the usage line does not. + + // VisibleAliases are the aliases a command advertises. The parse table merges + // hidden ones in beside these, because binding does not care which is which; + // a page does, and that is the whole of the distinction. + VisibleAliases []string + // Choices, Env and Default are the annotations a page appends to an entry's + // help: `[a, b]`, `[env: X]`, `(default: y)`. + // + // Duplicated from [Meta] rather than read from it, which is the price of + // keeping the two tables separable: a CLI that prints help should not have to + // carry the post-binding table, and one that applies the rules should not have + // to carry the help strings. + Choices []string + Env string + Default []string + // BeforeHelp and AfterHelp bracket this command's page, overriding the + // spec-wide text. + BeforeHelp string + AfterHelp string + // Examples are worked invocations, printed last. + Examples []Example } // HelpTable is the cold help table, indexed by key: entry `Key` sits at @@ -144,16 +167,23 @@ func UsageLine(path []string, cmd *Command, help HelpTable) string { } // flagUsage is how one flag appears in the usage line: `-f --force`, plus its -// value if it takes one. +// value if it takes one. The line always offers every spelling, since nothing on +// it is competing for a word. func flagUsage(f *Flag, h *Help) string { + return flagUsageShown(f, allShown(f), h) +} + +// flagUsageShown is the same, restricted to the spellings a page is still +// offering for this flag — see [shown]. +func flagUsageShown(f *Flag, show shown, h *Help) string { var out strings.Builder long, short := "", byte(0) - if len(f.Longs) > 0 { - long = f.Longs[0] + if show.hasLong { + long = show.long } - if len(f.Shorts) > 0 { - short = f.Shorts[0] + if show.hasShort { + short = show.short } // The declared name, when it is not the one the forms would imply. A flag diff --git a/go/argv/page.go b/go/argv/page.go new file mode 100644 index 000000000..66560703f --- /dev/null +++ b/go/argv/page.go @@ -0,0 +1,333 @@ +package argv + +import ( + "sort" + "strings" +) + +// The page `-h` prints. +// +// Ported from usage-argv's `short_help`, and held to the same standard: every one +// of mise's 211 pages, byte for byte against usage-lib. Reimplemented rules +// drift, and help text is the part of a CLI a user actually reads, so a rule +// reimplemented here is only worth having if something checks it. + +// HelpSpec is what a page needs from the CLI as a whole rather than from one +// command: the parts of the header that come from the spec's root. +type HelpSpec struct { + // Name is what the spec calls the program, and Bin what it is invoked as. + // The header prefers Name and falls back to Bin. + Name string + Bin string + // Version is printed beside the name on the root's page, and only when the + // spec declares one — a `--version` that answers with nothing is worse than + // one that is not there. + Version string + // About is the root's description, which the root's page uses in place of the + // command's own. + About string + // BeforeHelp and AfterHelp bracket every page that does not override them. + BeforeHelp string + AfterHelp string +} + +// Example is one worked invocation, as a page prints it. +type Example struct { + Header string + Code string +} + +// shortCol is the width the short-flag column is padded to, so that `-J, --json` +// and ` --no-header` line their long forms up. +const shortCol = 4 + +// ShortHelp renders what `-h` prints for the command at the end of `chain`. +// +// `path` is the command as invoked, binary first. `chain` is the commands from +// the root down to this one, which is what a page needs to work out which +// inherited globals are still this command's to offer. +func ShortHelp(spec HelpSpec, path []string, chain []*Command, help HelpTable) string { + if len(chain) == 0 { + return "" + } + cmd := chain[len(chain)-1] + meta := help.Lookup(cmd.Key) + var out strings.Builder + + before := spec.BeforeHelp + if meta != nil && meta.BeforeHelp != "" { + before = meta.BeforeHelp + } + if before != "" { + out.WriteString(before + "\n\n") + } + + // The program, then what it is for — on the program's own page. A + // subcommand's page says what the subcommand does. usage-lib prints the name + // when the spec gives one and the binary otherwise, and only when there is a + // version beside it. + root := len(path) <= 1 + if root && spec.Version != "" { + name := spec.Name + if name == "" { + name = spec.Bin + } + out.WriteString(name + " " + spec.Version + "\n") + } + about := "" + if root { + about = spec.About + } else if meta != nil { + about = meta.Short + } + if about != "" { + out.WriteString(about + "\n\n") + } + + out.WriteString("Usage: " + UsageLine(path, cmd, help) + "\n") + + // The path without the binary, which is what a listed subcommand shows: + // usage-lib prints the whole path from the root rather than the child's own + // name. + commandsSection(&out, path[min(1, len(path)):], cmd, help) + + args := visibleArgs(cmd, help) + argCol := 0 + for _, a := range args { + if n := width(argUsage(a, help.Lookup(a.Key))); n > argCol { + argCol = n + } + } + groupsSection(&out, "Arguments", len(args), + func(i int) string { return headingOf(help, args[i].Key) }, + func(w *strings.Builder, i int) { + a := args[i] + h := help.Lookup(a.Key) + usage := argUsage(a, h) + if help := helpText(h); help != "" { + w.WriteString(" " + pad(usage, argCol) + " " + help) + } else { + w.WriteString(" " + usage) + } + annotations(w, h, true) + }) + + own, inherited := ownAndGlobal(chain, help) + + // One column over *both* lists, so the two sections read as one table with a + // rule through it rather than two tables that happen to be adjacent. + flagCol := 0 + for _, f := range own { + if n := width(f.usage); n > flagCol { + flagCol = n + } + } + for _, f := range inherited { + if n := width(f.usage); n > flagCol { + flagCol = n + } + } + entry := func(w *strings.Builder, f shownFlag) { + h := help.Lookup(f.key) + if f.supplied != "" { + // A flag the parser supplies has no table entry; its help is fixed. + if text := f.suppliedHelp; text != "" { + w.WriteString(" " + pad(f.usage, flagCol) + " " + text) + } else { + w.WriteString(" " + f.usage) + } + w.WriteString("\n") + return + } + if text := helpText(h); text != "" { + w.WriteString(" " + pad(f.usage, flagCol) + " " + text) + } else { + w.WriteString(" " + f.usage) + } + annotations(w, h, false) + } + groupsSection(&out, "Flags", len(own), + func(i int) string { + if own[i].supplied != "" { + return "" + } + return headingOf(help, own[i].key) + }, + func(w *strings.Builder, i int) { entry(w, own[i]) }) + // After the command's own, and under a heading that says where they came + // from: a global belongs to the program, not to this command, and a reader + // should be able to see that. + groupsSection(&out, "Global flags", len(inherited), + func(int) string { return "" }, + func(w *strings.Builder, i int) { entry(w, inherited[i]) }) + + examplesSection(&out, meta) + + after := spec.AfterHelp + if meta != nil && meta.AfterHelp != "" { + after = meta.AfterHelp + } + if after != "" { + out.WriteString("\n" + after + "\n") + } + + // usage-lib trims the whole document and puts back one newline, which keeps + // the blank lines between sections from becoming trailing ones. + return strings.TrimSpace(out.String()) + "\n" +} + +// commandsSection lists the subcommands, and the `help` command every CLI with +// subcommands has. +func commandsSection(out *strings.Builder, path []string, cmd *Command, help HelpTable) { + type line struct { + usage string + sub *Command + } + var lines []line + for _, sub := range cmd.Subcommands { + if h := help.Lookup(sub.Key); h != nil && h.Hide { + continue + } + subPath := append(append([]string{}, path...), sub.Name) + lines = append(lines, line{UsageLine(subPath, sub, help), sub}) + } + // Nothing visible, no section — a command may have subcommands and every one + // of them hidden. The usage *line* still says ``, because + // usage-lib computes it before filtering; matching the reference means + // matching that too, odd as the pair looks together. + if len(lines) == 0 { + return + } + out.WriteString("\nCommands:\n") + + // Sorted by the rendered usage rather than by name, as usage-lib sorts them. + sort.SliceStable(lines, func(i, j int) bool { return lines[i].usage < lines[j].usage }) + + for _, l := range lines { + out.WriteString(" " + l.usage) + if h := help.Lookup(l.sub.Key); h != nil { + // Visible aliases only: a hidden alias works and is not advertised, + // which is the whole of the distinction. + if len(h.VisibleAliases) > 0 { + out.WriteString(" [aliases: " + strings.Join(h.VisibleAliases, ", ") + "]") + } + if h.Short != "" { + out.WriteString(" " + h.Short) + } + } + out.WriteString("\n") + } + out.WriteString(" help Print this message or the help of the given subcommand(s)\n") +} + +// groupsSection writes one section per heading, unheaded first, in the order the +// headings first appear. +func groupsSection(out *strings.Builder, defaultTitle string, n int, + headingOf func(int) string, writeItem func(*strings.Builder, int)) { + + if n == 0 { + return + } + var headings []string + seen := map[string]bool{} + for i := 0; i < n; i++ { + h := headingOf(i) + if !seen[h] { + seen[h] = true + headings = append(headings, h) + } + } + // The unheaded group first, then the rest in first-seen order. + sort.SliceStable(headings, func(i, j int) bool { + return headings[i] == "" && headings[j] != "" + }) + + for _, heading := range headings { + title := heading + if title == "" { + title = defaultTitle + } + out.WriteString("\n" + title + ":\n") + for i := 0; i < n; i++ { + if headingOf(i) == heading { + writeItem(out, i) + } + } + } +} + +func examplesSection(out *strings.Builder, meta *Help) { + if meta == nil || len(meta.Examples) == 0 { + return + } + out.WriteString("\nExamples:\n") + for _, e := range meta.Examples { + if e.Header != "" { + out.WriteString(" " + e.Header + ":\n") + } + out.WriteString(" $ " + e.Code + "\n") + } +} + +// annotations writes what a page appends to an entry's help, then the newline. +// +// `withDefault` is false for a flag, which is not an oversight: usage-lib prints +// `(default: …)` for an argument and not for a flag, and the short page follows +// it. A flag's default shows up in the long page instead. +func annotations(out *strings.Builder, h *Help, withDefault bool) { + if h != nil { + if len(h.Choices) > 0 { + out.WriteString(" [" + strings.Join(h.Choices, ", ") + "]") + } + if h.Env != "" { + out.WriteString(" [env: " + h.Env + "]") + } + if withDefault && len(h.Default) > 0 { + out.WriteString(" (default: " + strings.Join(h.Default, ", ") + ")") + } + } + out.WriteString("\n") +} + +func helpText(h *Help) string { + if h == nil || strings.TrimSpace(h.Short) == "" { + return "" + } + return h.Short +} + +func headingOf(help HelpTable, key uint64) string { + if h := help.Lookup(key); h != nil { + return h.Heading + } + return "" +} + +func visibleArgs(cmd *Command, help HelpTable) []*Arg { + out := make([]*Arg, 0, len(cmd.Args)) + for _, a := range cmd.Args { + if h := help.Lookup(a.Key); h != nil && h.Hide { + continue + } + out = append(out, a) + } + return out +} + +// pad left-justifies to a column measured in characters, not bytes: the usage +// strings carry `…`. +func pad(s string, col int) string { + if n := width(s); n < col { + return s + strings.Repeat(" ", col-n) + } + return s +} + +func width(s string) int { return len([]rune(s)) } + +func min(a, b int) int { + if a < b { + return a + } + return b +} diff --git a/go/argv/scope.go b/go/argv/scope.go new file mode 100644 index 000000000..c0bb76c77 --- /dev/null +++ b/go/argv/scope.go @@ -0,0 +1,258 @@ +package argv + +import "strings" + +// Which flags a page offers, and under which spellings. +// +// A page should offer a spelling only where the flag it is describing is the one +// that would *bind* it. That is not a nicety: a global inherited from the root +// and a nearer command's flag can answer to the same word, and advertising the +// far one while the near one binds is a lie the reader has no way to catch. +// +// So this follows the parser's own rule exactly. `eachInScope` walks a command's +// own flags before its ancestors' — nearest first — and takes the first match; +// `longFlag` asks for every long form across the whole scope before it asks for +// any negation. Both of those show up below, and both are load-bearing. + +// shownFlag is one entry of a flag section: which table entry it describes, and +// the column text it is displayed as. +type shownFlag struct { + key uint64 + usage string + // supplied names a flag the parser provides rather than the spec declaring + // it — `--help` and `--version`. They have no table entry, so they carry + // their own help text. + supplied string + suppliedHelp string +} + +// shown is the spellings of one flag that a page should offer. +// +// Not "hide the long" and "hide the short": a flag may answer to several of each, +// and a descendant claiming `--jobs` leaves an inherited `--workers` working. +// What is shown is the first of each kind that nothing nearer has taken. +type shown struct { + long string + hasLong bool + short byte + hasShort bool + // negate is whether the negation is still this flag's to offer. `--no-color` + // is a spelling like any other and something nearer can claim it. + negate bool +} + +func (s shown) nothing() bool { return !s.hasLong && !s.hasShort && !s.negate } + +func allShown(f *Flag) shown { + out := shown{negate: f.Negate != ""} + if len(f.Longs) > 0 { + out.long, out.hasLong = f.Longs[0], true + } + if len(f.Shorts) > 0 { + out.short, out.hasShort = f.Shorts[0], true + } + return out +} + +func formsOf(f *Flag) []string { + out := make([]string, 0, len(f.Longs)+len(f.Shorts)) + for _, l := range f.Longs { + out = append(out, "--"+l) + } + for _, s := range f.Shorts { + out = append(out, "-"+string(s)) + } + return out +} + +func negationOf(f *Flag) string { + if f.Negate == "" { + return "" + } + return "--" + f.Negate +} + +func has(list []string, s string) bool { + for _, x := range list { + if x == s { + return true + } + } + return false +} + +// surviving is the spellings left to a flag once everything nearer has taken +// what it answers to. +func surviving(f *Flag, taken, takenNegations, everyForm []string) shown { + var out shown + for _, l := range f.Longs { + if !has(taken, "--"+l) { + out.long, out.hasLong = l, true + break + } + } + for _, s := range f.Shorts { + if !has(taken, "-"+string(s)) { + out.short, out.hasShort = s, true + break + } + } + if n := negationOf(f); n != "" { + // A long anywhere in scope wins over a negation — this flag's own + // excepted — because the parser asks for every long before any negation. + out.negate = !has(takenNegations, n) && (!has(everyForm, n) || has(formsOf(f), n)) + } + return out +} + +// ownAndGlobal splits the flags a page shows into the command's own and the +// globals it inherits, each with the spellings still available to it. +func ownAndGlobal(chain []*Command, help HelpTable) (own, inherited []shownFlag) { + if len(chain) == 0 { + return nil, nil + } + here, ancestors := chain[len(chain)-1], chain[:len(chain)-1] + + // Every long and short anything in scope answers to, near or far: one of these + // always beats a negation, so a negation survives only where none of them is + // the same word. + var everyForm []string + for _, f := range here.Flags { + everyForm = append(everyForm, formsOf(f)...) + } + for _, a := range ancestors { + for _, f := range a.Flags { + if f.Global { + everyForm = append(everyForm, formsOf(f)...) + } + } + } + + var taken, takenNegations []string + for _, f := range here.Flags { + taken = append(taken, formsOf(f)...) + if n := negationOf(f); n != "" { + takenNegations = append(takenNegations, n) + } + } + + for _, f := range here.Flags { + if h := help.Lookup(f.Key); h != nil && h.Hide { + continue + } + own = append(own, shownFlag{key: f.Key, usage: columnUsage(f, allShown(f), help)}) + } + + keep := map[*Flag]shown{} + for i := len(ancestors) - 1; i >= 0; i-- { + for _, f := range ancestors[i].Flags { + if !f.Global { + continue + } + show := surviving(f, taken, takenNegations, everyForm) + // Reserved whether or not it is shown: a hidden one still binds, and so + // does one whose every spelling something nearer already took. + taken = append(taken, formsOf(f)...) + if n := negationOf(f); n != "" { + takenNegations = append(takenNegations, n) + } + h := help.Lookup(f.Key) + if (h != nil && h.Hide) || show.nothing() { + continue + } + keep[f] = show + } + } + // In declaration order from the root down, which is the order a page lists + // them, rather than the nearest-first order they were resolved in. + for _, a := range ancestors { + for _, f := range a.Flags { + if show, ok := keep[f]; ok { + inherited = append(inherited, + shownFlag{key: f.Key, usage: columnUsage(f, show, help)}) + } + } + } + + // Last in the command's own section, which is where clap has them: they carry + // no heading, so a CLI that groups its flags gets them at the end of the + // ungrouped list rather than inside somebody's section. + claimed := append(append([]string{}, taken...), takenNegations...) + own = append(own, suppliedEntries(here, claimed)...) + return own, inherited +} + +// suppliedEntries are the flags the parser answers without the spec declaring +// them, under whichever spellings nothing else has claimed. +func suppliedEntries(cmd *Command, claimed []string) []shownFlag { + pick := func(long string, short byte, help string) (shownFlag, bool) { + hasLong := !has(claimed, "--"+long) + hasShort := !has(claimed, "-"+string(short)) + switch { + case !hasLong && !hasShort: + return shownFlag{}, false + case !hasLong: + return shownFlag{supplied: long, suppliedHelp: help, + usage: "-" + string(short)}, true + case !hasShort: + return shownFlag{supplied: long, suppliedHelp: help, + usage: pad("", shortCol) + "--" + long}, true + default: + return shownFlag{supplied: long, suppliedHelp: help, + usage: pad("-"+string(short)+",", shortCol) + "--" + long}, true + } + } + + var out []shownFlag + if e, ok := pick("help", 'h', "Print help"); ok { + out = append(out, e) + } + // Only where the parser accepts one, which is the root of a CLI that declared + // a version. + if cmd.Version { + if e, ok := pick("version", 'V', "Print version"); ok { + out = append(out, e) + } + } + return out +} + +// columnUsage is how a flag appears in a section's left column: the short form in +// its own four-wide column, so that the long forms line up under each other. +func columnUsage(f *Flag, show shown, help HelpTable) string { + rest := displayUsage(f, show, help) + if !show.hasLong { + return rest + } + // Only when the text actually begins with the long form. The `name:` prefix + // case does not, and splitting it would put `verbose:` in a column meant for + // `-v, `. + at := strings.Index(rest, "--"+show.long) + if at < 0 { + return rest + } + before, after := rest[:at], rest[at:] + short := strings.TrimSpace(before) + // Only a bare short form belongs in the short column. A flag may carry a + // declared name the forms do not imply — `jobs: -j --parallel` — and that + // prefix is not something to line up with a comma after. + bare := short == "" || (strings.HasPrefix(short, "-") && + !strings.HasPrefix(short, "--") && width(short) == 2) + if !bare { + return rest + } + if short != "" { + short += "," + } + return pad(short, shortCol) + after +} + +// displayUsage is the flag's spellings and value, plus its negation where the +// page is still offering one. +func displayUsage(f *Flag, show shown, help HelpTable) string { + usage := flagUsageShown(f, show, help.Lookup(f.Key)) + if show.negate && f.Negate != "" { + return usage + " / --" + f.Negate + } + return usage +} diff --git a/go/conformance/help_test.go b/go/conformance/help_test.go index a8f0796b4..53f7eedc2 100644 --- a/go/conformance/help_test.go +++ b/go/conformance/help_test.go @@ -39,9 +39,9 @@ func TestEveryUsageLineMatchesTheReference(t *testing.T) { var collect func(c *spec.Cmd, path []string) collect = func(c *spec.Cmd, path []string) { want[strings.Join(path, " ")] = c.Usage - for name, sub := range c.Subcommands { + for _, sub := range c.Subcommands { sub := sub - collect(&sub, append(append([]string{}, path...), name)) + collect(&sub.Cmd, append(append([]string{}, path...), sub.Name)) } } collect(&lowered.Cmd, nil) diff --git a/go/conformance/page_test.go b/go/conformance/page_test.go new file mode 100644 index 000000000..84c2b74c5 --- /dev/null +++ b/go/conformance/page_test.go @@ -0,0 +1,115 @@ +package conformance + +import ( + "encoding/json" + "os/exec" + "path/filepath" + "strings" + "testing" + + "github.com/jdx/usage/go/argv" + "github.com/jdx/usage/go/internal/spec" +) + +// Does the page `-h` prints match usage-lib's, at mise's scale? +// +// The same standard as the usage line, over the whole document: all 211 of mise's +// pages, byte for byte. This is the test that decides whether an adopter's help +// output changes, so it compares the text rather than a summary of it. +// +// The reference comes from `xtask help-pages`, which renders usage-lib's own +// pages — unwrapped, in one pass. See that command for why the CLI's output is +// not used directly. + +type pages struct { + Short string `json:"short"` + Long string `json:"long"` +} + +func referencePages(t *testing.T) map[string]pages { + t.Helper() + kdl := filepath.Join("..", "..", "benches", "mise.usage.kdl") + out, err := exec.Command("cargo", "run", "-q", "-p", "xtask", "--", + "help-pages", kdl).Output() + if err != nil { + if ee, ok := err.(*exec.ExitError); ok { + t.Fatalf("rendering the reference pages: %v\n%s", err, ee.Stderr) + } + t.Fatalf("rendering the reference pages: %v", err) + } + var got map[string]pages + if err := json.Unmarshal(out, &got); err != nil { + t.Fatalf("the reference pages would not decode: %v", err) + } + return got +} + +func TestEveryShortPageMatchesTheReference(t *testing.T) { + usageBin := findUsage(t) + lowered := lowerFile(t, usageBin, filepath.Join("..", "..", "benches", "mise.usage.kdl")) + root, _, help := lowered.BuildAll() + reference := referencePages(t) + spec := lowered.HelpSpec() + + var checked int + var differences []string + var walk func(chain []*argv.Command, path []string) + walk = func(chain []*argv.Command, path []string) { + key := strings.Join(path[1:], " ") + want, ok := reference[key] + if !ok { + differences = append(differences, key+": no reference page") + return + } + got := argv.ShortHelp(spec, path, chain, help) + if got != want.Short { + differences = append(differences, key+"\n"+firstDiff(got, want.Short)) + } + checked++ + cmd := chain[len(chain)-1] + for _, sub := range cmd.Subcommands { + walk(append(append([]*argv.Command{}, chain...), sub), + append(append([]string{}, path...), sub.Name)) + } + } + walk([]*argv.Command{root}, []string{"mise"}) + + if checked < 200 { + t.Errorf("only %d pages checked; mise's tree is larger", checked) + } + if len(differences) > 0 { + // Two is enough to work from; the whole set would bury the count. + shown := differences + if len(shown) > 2 { + shown = shown[:2] + } + t.Fatalf("%d of %d pages differ from usage-lib:\n%s", + len(differences), checked, strings.Join(shown, "\n")) + } + t.Logf("%d short pages match usage-lib exactly", checked) +} + +// firstDiff shows the first line that differs, with a little context — a whole +// help page twice over is not something anyone reads. +func firstDiff(ours, theirs string) string { + mine, ref := strings.Split(ours, "\n"), strings.Split(theirs, "\n") + for i := 0; i < len(mine) && i < len(ref); i++ { + if mine[i] != ref[i] { + return " line " + itoa(i+1) + ":\n ours: " + quote(mine[i]) + + "\n lib: " + quote(ref[i]) + } + } + return " same for " + itoa(min(len(mine), len(ref))) + " lines, then ours has " + + itoa(len(mine)) + " and the reference " + itoa(len(ref)) +} + +func quote(s string) string { b, _ := json.Marshal(s); return string(b) } +func itoa(n int) string { b, _ := json.Marshal(n); return string(b) } +func min(a, b int) int { + if a < b { + return a + } + return b +} + +var _ = spec.Spec{} diff --git a/go/conformance/producers_test.go b/go/conformance/producers_test.go new file mode 100644 index 000000000..43b783151 --- /dev/null +++ b/go/conformance/producers_test.go @@ -0,0 +1,136 @@ +package conformance + +import ( + "fmt" + "path/filepath" + "reflect" + "testing" + + "github.com/jdx/usage/go/argv" + "github.com/jdx/usage/go/internal/shadow/mise" +) + +// Do the two things that build tables build the same tables? +// +// There are two producers, and they are written in different languages. `usage +// generate go` emits Go source at build time, field by field, from Rust; the +// lowering in `internal/spec` builds the same structs at run time, from the same +// spec, in Go. An adopter picks one and gets whichever set of rules that half +// happens to implement. +// +// Nothing else notices when they drift. The corpus runs against the lowering; +// the shadow package's tests run against the generated tables; the page tests +// compare either one against usage-lib, and a field neither renderer reads — +// or that both fall back for — is invisible to all of them. So this compares +// the two producers directly, over mise's spec, which is what both are pointed +// at anyway: `mise.Root` is generated from `benches/mise.usage.kdl`, and that +// same file is lowered here. +// +// Whole structs rather than named fields, so that a field added to a table is +// compared by having been added rather than by someone remembering to list it. + +func TestTheTwoProducersAgree(t *testing.T) { + usageBin := findUsage(t) + lowered := lowerFile(t, usageBin, filepath.Join("..", "..", "benches", "mise.usage.kdl")) + root, meta, help := lowered.BuildAll() + + // The hot table, walked in parallel: same shape, same order, same keys. Order + // is part of the agreement rather than an accident of it — the parser takes + // the first flag in scope that matches, so two tables listing the same flags + // in different orders bind differently. + var walk func(path string, a, b *argv.Command) + walk = func(path string, a, b *argv.Command) { + if a.Name != b.Name || a.Key != b.Key { + t.Errorf("%s: lowered %q/%d, generated %q/%d", path, a.Name, a.Key, b.Name, b.Key) + return + } + compare(t, path, *a, *b, "Flags", "Args", "Subcommands", "DefaultSubcommand") + compareSlice(t, path+": flags", a.Flags, b.Flags) + compareSlice(t, path+": args", a.Args, b.Args) + // By key rather than by pointer: the two trees are different objects, so + // pointer identity says nothing and the key is what the tables use to + // mean "this one". + if keyOf(a.DefaultSubcommand) != keyOf(b.DefaultSubcommand) { + t.Errorf("%s: default subcommand is %d lowered, %d generated", + path, keyOf(a.DefaultSubcommand), keyOf(b.DefaultSubcommand)) + } + if len(a.Subcommands) != len(b.Subcommands) { + t.Errorf("%s: %d subcommands lowered, %d generated", + path, len(a.Subcommands), len(b.Subcommands)) + return + } + for i := range a.Subcommands { + walk(path+" "+a.Subcommands[i].Name, a.Subcommands[i], b.Subcommands[i]) + } + } + walk("mise", root, mise.Root) + + // And the two cold tables, per entry. Dense from 1 on both sides, which is + // what lets a key index them, so a length difference is itself a failure. + if len(meta) != len(mise.Meta) { + t.Fatalf("%d metadata entries lowered, %d generated", len(meta), len(mise.Meta)) + } + if len(help) != len(mise.HelpText) { + t.Fatalf("%d help entries lowered, %d generated", len(help), len(mise.HelpText)) + } + for i := range meta { + compare(t, fmt.Sprintf("meta[%d]", i), meta[i], mise.Meta[i]) + } + for i := range help { + compare(t, fmt.Sprintf("help[%d]", i), help[i], mise.HelpText[i]) + } +} + +func keyOf(c *argv.Command) uint64 { + if c == nil { + return 0 + } + return c.Key +} + +// compare reports the fields of two table entries that differ, skipping the +// named ones — the pointers into the tree, which are compared by key instead. +func compare[T any](t *testing.T, where string, lowered, generated T, skip ...string) { + t.Helper() + a := reflect.ValueOf(lowered) + b := reflect.ValueOf(generated) + for i := 0; i < a.NumField(); i++ { + name := a.Type().Field(i).Name + if contains(skip, name) { + continue + } + x, y := a.Field(i).Interface(), b.Field(i).Interface() + // An empty slice and an unset one are the same table: the emitter writes + // nothing where the lowering may have made a slice and put nothing in it. + if isEmptySlice(a.Field(i)) && isEmptySlice(b.Field(i)) { + continue + } + if !reflect.DeepEqual(x, y) { + t.Errorf("%s: %s is %#v lowered, %#v generated", where, name, x, y) + } + } +} + +func compareSlice[T any](t *testing.T, where string, lowered, generated []*T) { + t.Helper() + if len(lowered) != len(generated) { + t.Errorf("%s: %d lowered, %d generated", where, len(lowered), len(generated)) + return + } + for i := range lowered { + compare(t, fmt.Sprintf("%s[%d]", where, i), *lowered[i], *generated[i]) + } +} + +func isEmptySlice(v reflect.Value) bool { + return v.Kind() == reflect.Slice && v.Len() == 0 +} + +func contains(list []string, s string) bool { + for _, x := range list { + if x == s { + return true + } + } + return false +} diff --git a/go/internal/shadow/mise/meta_test.go b/go/internal/shadow/mise/meta_test.go index 175bb67ac..d425f2320 100644 --- a/go/internal/shadow/mise/meta_test.go +++ b/go/internal/shadow/mise/meta_test.go @@ -1,6 +1,7 @@ package mise import ( + "strings" "testing" "github.com/jdx/usage/go/argv" @@ -205,3 +206,70 @@ func TestATypedBooleanCountsAsGiven(t *testing.T) { t.Errorf("untyped, with nothing declared to fill it, should be unset: %v", source) } } + +// The generated tables render the same pages as the runtime-built ones. +// +// `go/conformance` proves the renderer against usage-lib using tables built from +// a lowered spec at run time. That leaves the emitter's half unchecked, and the +// help table is where a dropped field is least visible: a missing alias or +// annotation changes one line of one page. So the whole tree is rendered from +// what the generator actually wrote. +func TestGeneratedTablesRenderEveryPage(t *testing.T) { + var rendered int + var walk func(chain []*argv.Command, path []string) + walk = func(chain []*argv.Command, path []string) { + page := argv.ShortHelp(HelpMeta, path, chain, HelpText) + if page == "" || !strings.Contains(page, "Usage: "+strings.Join(path, " ")) { + t.Errorf("%s: page does not lead with its own usage line:\n%s", + strings.Join(path, " "), page) + } + rendered++ + cmd := chain[len(chain)-1] + for _, sub := range cmd.Subcommands { + walk(append(append([]*argv.Command{}, chain...), sub), + append(append([]string{}, path...), sub.Name)) + } + } + walk([]*argv.Command{Root}, []string{"mise"}) + + if rendered < 200 { + t.Errorf("only %d pages rendered; mise's tree is larger", rendered) + } +} + +// One page in full, so a reader can see what the generated tables produce rather +// than only that something was produced. +func TestAGeneratedPageReadsAsAPage(t *testing.T) { + var configLs, config *argv.Command + for _, c := range Root.Subcommands { + if c.Name == "config" { + config = c + for _, s := range c.Subcommands { + if s.Name == "ls" { + configLs = s + } + } + } + } + if configLs == nil { + t.Fatal("mise has a `config ls`") + } + page := argv.ShortHelp(HelpMeta, + []string{"mise", "config", "ls"}, + []*argv.Command{Root, config, configLs}, HelpText) + + for _, want := range []string{ + "List config files currently in use", + "Usage: mise config ls [FLAGS]", + "Flags:", + " -J, --json", + " -h, --help", + // The globals come from the root, under a heading that says so. + "Global flags:", + " -C, --cd ", + } { + if !strings.Contains(page, want) { + t.Errorf("page is missing %q:\n%s", want, page) + } + } +} diff --git a/go/internal/shadow/mise/tables.go b/go/internal/shadow/mise/tables.go index c1e628d3f..aa5437907 100644 --- a/go/internal/shadow/mise/tables.go +++ b/go/internal/shadow/mise/tables.go @@ -4856,7 +4856,7 @@ var HelpText = argv.HelpTable{ {Key: FlagVersion, Hide: true}, {Key: FlagYes, Short: "Answer yes to all confirmation prompts", Long: "Answer yes to all confirmation prompts"}, {Key: FlagDebug, Hide: true, Short: "Sets log level to debug", Long: "Sets log level to debug"}, - {Key: FlagLogLevel, Hide: true, ValueName: "LEVEL", ValueDemanded: true}, + {Key: FlagLogLevel, Hide: true, ValueName: "LEVEL", ValueDemanded: true, Choices: []string{"trace", "debug", "info", "warning", "error"}}, {Key: FlagNoConfig, Short: "Do not load any config files", Long: "Do not load any config files\n\nCan also use `MISE_NO_CONFIG=1`"}, {Key: FlagNoEnv, Short: "Do not load environment variables from config files", Long: "Do not load environment variables from config files\n\nCan also use `MISE_NO_ENV=1`"}, {Key: FlagNoHooks, Short: "Do not execute hooks from config files", Long: "Do not execute hooks from config files\n\nCan also use `MISE_NO_HOOKS=1`"}, @@ -4872,42 +4872,42 @@ var HelpText = argv.HelpTable{ {Key: ArgTaskArgsLast, Hide: true}, {Key: CmdActivate, Short: "Initializes mise in the current shell session", Long: "Initializes mise in the current shell session\n\nThis should go into your shell's rc file or login shell.\nOtherwise, it will only take effect in the current session.\n(e.g. ~/.zshrc, ~/.zprofile, ~/.zshenv, ~/.bashrc, ~/.bash_profile, ~/.profile, ~/.config/fish/config.fish, or $PROFILE for powershell)\n\nTypically, this can be added with something like the following:\n\n echo 'eval \"$(mise activate zsh)\"' >> ~/.zshrc\n\nHowever, this requires that \"mise\" is in your PATH. If it is not, you need to\nspecify the full path like this:\n\n echo 'eval \"$(/path/to/mise activate zsh)\"' >> ~/.zshrc\n\nCustomize status output with `status` settings."}, {Key: FlagActivateQuiet, Short: "Suppress non-error messages", Long: "Suppress non-error messages"}, - {Key: FlagActivateShell, Hide: true, ValueName: "SHELL", ValueDemanded: true, Short: "Shell type to generate the script for", Long: "Shell type to generate the script for"}, + {Key: FlagActivateShell, Hide: true, ValueName: "SHELL", ValueDemanded: true, Short: "Shell type to generate the script for", Long: "Shell type to generate the script for", Choices: []string{"bash", "elvish", "fish", "nu", "xonsh", "zsh", "pwsh"}}, {Key: FlagActivateNoHookEnv, Short: "Do not automatically call hook-env", Long: "Do not automatically call hook-env\n\nThis can be helpful for debugging mise. If you run `eval \"$(mise activate --no-hook-env)\"`, then you can call `mise hook-env` manually which will output the env vars to stdout without actually modifying the environment. That way you can do things like `mise hook-env --trace` to get more information or just see the values that hook-env is outputting."}, - {Key: FlagActivateShims, Short: "Use shims instead of modifying PATH", Long: "Use shims instead of modifying PATH\nEffectively the same as:\n\n PATH=\"$HOME/.local/share/mise/shims:$PATH\"\n\n`mise activate --shims` does not support all the features of `mise activate`.\nSee https://mise.jdx.dev/dev-tools/shims.html#shims-vs-path for more information"}, + {Key: FlagActivateShims, Short: "Use shims instead of modifying PATH\nEffectively the same as:", Long: "Use shims instead of modifying PATH\nEffectively the same as:\n\n PATH=\"$HOME/.local/share/mise/shims:$PATH\"\n\n`mise activate --shims` does not support all the features of `mise activate`.\nSee https://mise.jdx.dev/dev-tools/shims.html#shims-vs-path for more information"}, {Key: FlagActivateStatus, Hide: true, Short: "Show \"mise: @\" message when changing directories", Long: "Show \"mise: @\" message when changing directories"}, - {Key: ArgActivateShellType, Short: "Shell type to generate the script for", Long: "Shell type to generate the script for"}, + {Key: ArgActivateShellType, Short: "Shell type to generate the script for", Long: "Shell type to generate the script for", Choices: []string{"bash", "elvish", "fish", "nu", "xonsh", "zsh", "pwsh"}}, {Key: CmdToolAlias, Short: "Manage tool version aliases."}, {Key: FlagToolAliasTool, ValueName: "TOOL", ValueDemanded: true, Short: "Filter aliases by tool", Long: "Filter aliases by tool"}, {Key: FlagToolAliasNoHeader, Short: "Don't show table header", Long: "Don't show table header"}, {Key: CmdToolAliasGet, Short: "Show an alias for a tool", Long: "Show an alias for a tool\n\nThis is the contents of a tool_alias. entry in ~/.config/mise/config.toml"}, {Key: ArgToolAliasGetTool, Demanded: true, Short: "The tool to show the alias for", Long: "The tool to show the alias for"}, {Key: ArgToolAliasGetAlias, Demanded: true, Short: "The alias to show", Long: "The alias to show"}, - {Key: CmdToolAliasLs, Short: "List tool version aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", Long: "List tool version aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.\n\nFor user config, aliases are defined like the following in `~/.config/mise/config.toml`:\n\n [tool_alias.node.versions]\n lts = \"22.0.0\""}, + {Key: CmdToolAliasLs, Short: "List tool version aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.", Long: "List tool version aliases\nShows the aliases that can be specified.\nThese can come from user config or from plugins in `bin/list-aliases`.\n\nFor user config, aliases are defined like the following in `~/.config/mise/config.toml`:\n\n [tool_alias.node.versions]\n lts = \"22.0.0\"", VisibleAliases: []string{"list"}}, {Key: FlagToolAliasLsNoHeader, Short: "Don't show table header", Long: "Don't show table header"}, {Key: ArgToolAliasLsTool, Short: "Show aliases for ", Long: "Show aliases for "}, - {Key: CmdToolAliasSet, Short: "Add/update an alias for a tool/backend", Long: "Add/update an alias for a tool/backend\n\nThis modifies the contents of ~/.config/mise/config.toml"}, + {Key: CmdToolAliasSet, Short: "Add/update an alias for a tool/backend", Long: "Add/update an alias for a tool/backend\n\nThis modifies the contents of ~/.config/mise/config.toml", VisibleAliases: []string{"add", "create"}}, {Key: ArgToolAliasSetTool, Demanded: true, Short: "The tool/backend to set the alias for", Long: "The tool/backend to set the alias for"}, {Key: ArgToolAliasSetAlias, Demanded: true, Short: "The alias to set", Long: "The alias to set"}, {Key: ArgToolAliasSetValue, Short: "The value to set the alias to", Long: "The value to set the alias to"}, - {Key: CmdToolAliasUnset, Short: "Clears an alias for a tool/backend", Long: "Clears an alias for a tool/backend\n\nThis modifies the contents of ~/.config/mise/config.toml"}, + {Key: CmdToolAliasUnset, Short: "Clears an alias for a tool/backend", Long: "Clears an alias for a tool/backend\n\nThis modifies the contents of ~/.config/mise/config.toml", VisibleAliases: []string{"rm", "remove", "delete", "del"}}, {Key: ArgToolAliasUnsetTool, Demanded: true, Short: "The tool/backend to remove the alias from", Long: "The tool/backend to remove the alias from"}, {Key: ArgToolAliasUnsetAlias, Short: "The alias to remove", Long: "The alias to remove"}, {Key: CmdAsdf, Hide: true, Short: "[internal] simulates asdf for plugins that call \"asdf\" internally"}, {Key: ArgAsdfArgs, Short: "all arguments", Long: "all arguments"}, {Key: CmdBackends, Short: "Manage backends"}, - {Key: CmdBackendsLs, Short: "List built-in backends"}, + {Key: CmdBackendsLs, Short: "List built-in backends", VisibleAliases: []string{"list"}}, {Key: CmdBinPaths, Short: "List all the active runtime bin paths"}, {Key: FlagBinPathsBinNames, Short: "Output executable names instead of bin directories", Long: "Output executable names instead of bin directories"}, {Key: FlagBinPathsJson, Short: "Output executable entries in JSON format (implies --bin-names)", Long: "Output executable entries in JSON format (implies --bin-names)"}, - {Key: ArgBinPathsToolVersion, Short: "Tool(s) to look up", Long: "Tool(s) to look up\ne.g.: ruby@3"}, - {Key: CmdBootstrap, Short: "Set up a machine for the current config in one command", Long: "Set up a machine for the current config in one command\n\nRuns the bootstrap steps for the current config in order:\n\n0. `mise bootstrap accounts apply` — converge `[bootstrap.users]` and\n `[bootstrap.groups]` (Linux)\n1. `mise bootstrap plugins apply` — install `[bootstrap.plugins]`\n 1.7. `[bootstrap.hooks.pre-packages]` — optional setup hook\n2. Install built-in-manager entries from `[bootstrap.packages]`\n3. `mise bootstrap files apply` — converge `[bootstrap.files]` and\n `[bootstrap.directories]`\n4. `mise bootstrap services apply` — converge `[bootstrap.services]`\n systemd system services (Linux)\n5. `mise bootstrap firewall apply` — converge `[bootstrap.linux.firewall]`\n host firewall policy and rules (Linux)\n6. `mise bootstrap compose apply` — converge `[bootstrap.compose]`\n Docker Compose projects\n7. `mise bootstrap repos apply` — clone/converge `[bootstrap.repos]`\n surrounded by `pre-repos`/`post-repos` hooks\n8. `mise bootstrap dotfiles apply` — apply dotfiles from `[dotfiles]`\n surrounded by `pre-dotfiles`/`post-dotfiles` hooks\n9. `mise bootstrap mise-shell-activate apply` — configure shell activation\n from `[bootstrap.mise_shell_activate]`\n10. `mise bootstrap macos defaults apply` — write\n `[bootstrap.macos.defaults]` entries (macOS)\n surrounded by `pre-defaults`/`post-defaults` hooks\n11. `mise bootstrap macos launchd-agents apply` — install/load\n `[bootstrap.macos.launchd.agents]`\n12. `mise bootstrap linux systemd-units apply` — install/start\n `[bootstrap.linux.systemd.units]`\n13. `mise bootstrap user apply` — set `[bootstrap.user].login_shell`\n (Unix)\n surrounded by `pre-user`/`post-user` hooks\n14. `mise install` — install missing tools from `[tools]`\n surrounded by `pre-tools`/`post-tools` hooks; package-plugin entries\n from `[bootstrap.packages]` install afterward, followed by\n `[bootstrap.hooks.post-packages]`\n15. `mise run bootstrap` — if a task named `bootstrap` is defined\n16. `[bootstrap.hooks.final]` — optional final hook\n\nThe declarative steps converge — anything already in its desired state\nis skipped, so re-running is safe. The `bootstrap` task runs on every\ninvocation; keep it idempotent. Use it for any project-specific setup\nthat doesn't fit the declarative sections (seeding databases, auth flows,\netc.) — it runs with the installed tools on PATH.\n\nUse `--skip ` to skip named parts, or `--only ` to run just\nnamed parts. Both flags can be repeated or comma-separated, but they\ncannot be used together."}, + {Key: ArgBinPathsToolVersion, Short: "Tool(s) to look up\ne.g.: ruby@3", Long: "Tool(s) to look up\ne.g.: ruby@3"}, + {Key: CmdBootstrap, Short: "Set up a machine for the current config in one command", Long: "Set up a machine for the current config in one command\n\nRuns the bootstrap steps for the current config in order:\n\n0. `mise bootstrap accounts apply` — converge `[bootstrap.users]` and\n `[bootstrap.groups]` (Linux)\n1. `mise bootstrap plugins apply` — install `[bootstrap.plugins]`\n 1.7. `[bootstrap.hooks.pre-packages]` — optional setup hook\n2. Install built-in-manager entries from `[bootstrap.packages]`\n3. `mise bootstrap files apply` — converge `[bootstrap.files]` and\n `[bootstrap.directories]`\n4. `mise bootstrap services apply` — converge `[bootstrap.services]`\n systemd system services (Linux)\n5. `mise bootstrap firewall apply` — converge `[bootstrap.linux.firewall]`\n host firewall policy and rules (Linux)\n6. `mise bootstrap compose apply` — converge `[bootstrap.compose]`\n Docker Compose projects\n7. `mise bootstrap repos apply` — clone/converge `[bootstrap.repos]`\n surrounded by `pre-repos`/`post-repos` hooks\n8. `mise bootstrap dotfiles apply` — apply dotfiles from `[dotfiles]`\n surrounded by `pre-dotfiles`/`post-dotfiles` hooks\n9. `mise bootstrap mise-shell-activate apply` — configure shell activation\n from `[bootstrap.mise_shell_activate]`\n10. `mise bootstrap macos defaults apply` — write\n `[bootstrap.macos.defaults]` entries (macOS)\n surrounded by `pre-defaults`/`post-defaults` hooks\n11. `mise bootstrap macos launchd-agents apply` — install/load\n `[bootstrap.macos.launchd.agents]`\n12. `mise bootstrap linux systemd-units apply` — install/start\n `[bootstrap.linux.systemd.units]`\n13. `mise bootstrap user apply` — set `[bootstrap.user].login_shell`\n (Unix)\n surrounded by `pre-user`/`post-user` hooks\n14. `mise install` — install missing tools from `[tools]`\n surrounded by `pre-tools`/`post-tools` hooks; package-plugin entries\n from `[bootstrap.packages]` install afterward, followed by\n `[bootstrap.hooks.post-packages]`\n15. `mise run bootstrap` — if a task named `bootstrap` is defined\n16. `[bootstrap.hooks.final]` — optional final hook\n\nThe declarative steps converge — anything already in its desired state\nis skipped, so re-running is safe. The `bootstrap` task runs on every\ninvocation; keep it idempotent. Use it for any project-specific setup\nthat doesn't fit the declarative sections (seeding databases, auth flows,\netc.) — it runs with the installed tools on PATH.\n\nUse `--skip ` to skip named parts, or `--only ` to run just\nnamed parts. Both flags can be repeated or comma-separated, but they\ncannot be used together.", VisibleAliases: []string{"bs"}}, {Key: FlagBootstrapDryRun, Short: "Print what would happen without installing anything", Long: "Print what would happen without installing anything"}, {Key: FlagBootstrapYes, Short: "Skip confirmation prompts", Long: "Skip confirmation prompts"}, {Key: FlagBootstrapForceDotfiles, Short: "Overwrite existing files that conflict with whole-file dotfile entries", Long: "Overwrite existing files that conflict with whole-file dotfile entries"}, - {Key: FlagBootstrapOnly, Repeatable: true, ValueName: "ONLY", ValueDemanded: true, Short: "Run only one or more bootstrap parts", Long: "Run only one or more bootstrap parts\n\nCan be passed multiple times or as a comma-separated list. Cannot be used with `--skip`."}, + {Key: FlagBootstrapOnly, Repeatable: true, ValueName: "ONLY", ValueDemanded: true, Short: "Run only one or more bootstrap parts", Long: "Run only one or more bootstrap parts\n\nCan be passed multiple times or as a comma-separated list. Cannot be used with `--skip`.", Choices: []string{"plugins", "packages", "accounts", "files", "services", "firewall", "compose", "repos", "dotfiles", "mise-shell-activate", "shell", "macos-defaults", "defaults", "macos-launchd-agents", "launchd", "linux-systemd-units", "systemd", "user", "tools", "task", "final-hook"}}, {Key: FlagBootstrapPromptSecrets, Short: "Prompt securely for missing bootstrap secret inputs", Long: "Prompt securely for missing bootstrap secret inputs"}, - {Key: FlagBootstrapSkip, Repeatable: true, ValueName: "SKIP", ValueDemanded: true, Short: "Skip one or more bootstrap parts", Long: "Skip one or more bootstrap parts\n\nCan be passed multiple times or as a comma-separated list."}, + {Key: FlagBootstrapSkip, Repeatable: true, ValueName: "SKIP", ValueDemanded: true, Short: "Skip one or more bootstrap parts", Long: "Skip one or more bootstrap parts\n\nCan be passed multiple times or as a comma-separated list.", Choices: []string{"plugins", "packages", "accounts", "files", "services", "firewall", "compose", "repos", "dotfiles", "mise-shell-activate", "shell", "macos-defaults", "defaults", "macos-launchd-agents", "launchd", "linux-systemd-units", "systemd", "user", "tools", "task", "final-hook"}}, {Key: FlagBootstrapUpdate, Short: "Refresh package manager metadata and update configured repos", Long: "Refresh package manager metadata and update configured repos"}, {Key: CmdBootstrapApplyAccountPlan, Hide: true}, {Key: CmdBootstrapApplyServicePlan, Hide: true}, @@ -4952,9 +4952,9 @@ var HelpText = argv.HelpTable{ {Key: FlagBootstrapDotfilesEditSource, ValueName: "PATH", ValueDemanded: true, Short: "Source path to use if the target is not yet managed", Long: "Source path to use if the target is not yet managed"}, {Key: FlagBootstrapDotfilesEditYes, Short: "Skip the confirmation prompt when adding an unmanaged target", Long: "Skip the confirmation prompt when adding an unmanaged target"}, {Key: ArgBootstrapDotfilesEditTarget, Demanded: true, Short: "Target to edit", Long: "Target to edit"}, - {Key: CmdBootstrapDotfilesStatus, Short: "Show the status of dotfiles from `[dotfiles]`"}, + {Key: CmdBootstrapDotfilesStatus, Short: "Show the status of dotfiles from `[dotfiles]`", VisibleAliases: []string{"ls"}}, {Key: FlagBootstrapDotfilesStatusJson, Short: "Output in JSON format", Long: "Output in JSON format"}, - {Key: FlagBootstrapDotfilesStatusMissing, Short: "Exit with code 1 if any configured dotfiles are not in their desired", Long: "Exit with code 1 if any configured dotfiles are not in their desired\nstate (missing, source missing, differs)"}, + {Key: FlagBootstrapDotfilesStatusMissing, Short: "Exit with code 1 if any configured dotfiles are not in their desired\nstate (missing, source missing, differs)", Long: "Exit with code 1 if any configured dotfiles are not in their desired\nstate (missing, source missing, differs)"}, {Key: ArgBootstrapDotfilesStatusTarget, Short: "Only show these targets", Long: "Only show these targets"}, {Key: CmdBootstrapDotfilesUnapply, Short: "Remove dotfiles applied from `[dotfiles]`", Long: "Remove dotfiles applied from `[dotfiles]`\n\nRemoves configured whole-file entries and edits while preserving files\nmise cannot identify as managed. Modified copies, templates, and plain-line\nedits require `--force`."}, {Key: FlagBootstrapDotfilesUnapplyForce, Short: "Remove modified or otherwise ambiguous managed files and lines", Long: "Remove modified or otherwise ambiguous managed files and lines"}, @@ -5022,7 +5022,7 @@ var HelpText = argv.HelpTable{ {Key: FlagBootstrapMiseShellActivateStatusJson, Short: "Output in JSON format", Long: "Output in JSON format"}, {Key: FlagBootstrapMiseShellActivateStatusMissing, Short: "Exit with code 1 if any configured shell activation is not in its desired state", Long: "Exit with code 1 if any configured shell activation is not in its desired state"}, {Key: CmdBootstrapPackages, Short: "Manage bootstrap system packages from `[bootstrap.packages]`"}, - {Key: CmdBootstrapPackagesApply, Short: "Apply system packages from `[bootstrap.packages]`", Long: "Apply system packages from `[bootstrap.packages]`\n\nChecks which configured packages are missing and installs them with the\nsystem package manager. Built-in system managers may elevate with sudo when\nnot running as root (see `system_packages.sudo`); package plugins never do.\n\nPackages can also be given explicitly in `manager:package` form (e.g.\n`apk:zlib-dev`, `apt:curl`, `brew:jq`); they are installed whether or not they appear in\nthe config. Explicit packages and `--manager` scope the run to packages\nonly. `install` is accepted as an alias for this command."}, + {Key: CmdBootstrapPackagesApply, Short: "Apply system packages from `[bootstrap.packages]`", Long: "Apply system packages from `[bootstrap.packages]`\n\nChecks which configured packages are missing and installs them with the\nsystem package manager. Built-in system managers may elevate with sudo when\nnot running as root (see `system_packages.sudo`); package plugins never do.\n\nPackages can also be given explicitly in `manager:package` form (e.g.\n`apk:zlib-dev`, `apt:curl`, `brew:jq`); they are installed whether or not they appear in\nthe config. Explicit packages and `--manager` scope the run to packages\nonly. `install` is accepted as an alias for this command.", VisibleAliases: []string{"i"}}, {Key: FlagBootstrapPackagesApplyManager, ValueName: "MANAGER", ValueDemanded: true, Short: "Only install packages for this built-in or plugin manager", Long: "Only install packages for this built-in or plugin manager"}, {Key: FlagBootstrapPackagesApplyDryRun, Short: "Print the commands that would run without running them", Long: "Print the commands that would run without running them"}, {Key: FlagBootstrapPackagesApplyYes, Short: "Skip the confirmation prompt", Long: "Skip the confirmation prompt"}, @@ -5035,7 +5035,7 @@ var HelpText = argv.HelpTable{ {Key: FlagBootstrapPackagesBrewTapPath, ValueName: "PATH", ValueDemanded: true, Short: "Write to this config file or directory", Long: "Write to this config file or directory"}, {Key: ArgBootstrapPackagesBrewTapTap, Demanded: true, Short: "Tap name, e.g. `owner/repo`", Long: "Tap name, e.g. `owner/repo`"}, {Key: ArgBootstrapPackagesBrewTapUrl, Short: "GitHub URL for the tap. Defaults to https://github.com//homebrew-.git", Long: "GitHub URL for the tap. Defaults to https://github.com//homebrew-.git"}, - {Key: CmdBootstrapPackagesBrewUntap, Short: "Remove Homebrew tap URLs from [bootstrap.brew.taps]"}, + {Key: CmdBootstrapPackagesBrewUntap, Short: "Remove Homebrew tap URLs from [bootstrap.brew.taps]", VisibleAliases: []string{"remove", "rm"}}, {Key: FlagBootstrapPackagesBrewUntapLocal, Short: "Write to the local config instead of the global config", Long: "Write to the local config instead of the global config"}, {Key: FlagBootstrapPackagesBrewUntapDryRun, Short: "Print the config change without writing it", Long: "Print the config change without writing it"}, {Key: FlagBootstrapPackagesBrewUntapPath, ValueName: "PATH", ValueDemanded: true, Short: "Write to this config file or directory", Long: "Write to this config file or directory"}, @@ -5043,23 +5043,23 @@ var HelpText = argv.HelpTable{ {Key: CmdBootstrapPackagesImport, Short: "Import installed system packages into `[bootstrap.packages]`", Long: "Import installed system packages into `[bootstrap.packages]`\n\nCurrently supports Homebrew formulae only. By default, imports linked\nformulae whose active keg receipt says they were installed on request.\nPass `--all` to import every linked formula, including dependencies."}, {Key: FlagBootstrapPackagesImportEnv, ValueName: "ENV", ValueDemanded: true, Short: "Write to the config file for this environment (mise..toml)", Long: "Write to the config file for this environment (mise..toml)"}, {Key: FlagBootstrapPackagesImportGlobal, Short: "Write to the global config (~/.config/mise/config.toml)", Long: "Write to the global config (~/.config/mise/config.toml)"}, - {Key: FlagBootstrapPackagesImportManager, ValueName: "MANAGER", ValueDemanded: true, Short: "Only import packages for this manager. Currently only `brew` is supported", Long: "Only import packages for this manager. Currently only `brew` is supported"}, + {Key: FlagBootstrapPackagesImportManager, ValueName: "MANAGER", ValueDemanded: true, Short: "Only import packages for this manager. Currently only `brew` is supported", Long: "Only import packages for this manager. Currently only `brew` is supported", Choices: []string{"brew"}, Default: []string{"brew"}}, {Key: FlagBootstrapPackagesImportAll, Short: "Import every linked formula, including dependencies", Long: "Import every linked formula, including dependencies"}, {Key: FlagBootstrapPackagesImportDryRun, Short: "Print the config change without writing config", Long: "Print the config change without writing config"}, {Key: FlagBootstrapPackagesImportPath, ValueName: "PATH", ValueDemanded: true, Short: "Write to this config file or directory", Long: "Write to this config file or directory"}, {Key: CmdBootstrapPackagesPrune, Short: "Prune installed system packages no longer declared in `[bootstrap.packages]`", Long: "Prune installed system packages no longer declared in `[bootstrap.packages]`\n\nCurrently supports Homebrew formulae only. Pruning removes linked formulae\nthat are not needed by the current config or by trusted, loadable tracked\nconfigs."}, - {Key: FlagBootstrapPackagesPruneManager, ValueName: "MANAGER", ValueDemanded: true, Short: "Only prune packages for this manager. Currently only `brew` is supported", Long: "Only prune packages for this manager. Currently only `brew` is supported"}, + {Key: FlagBootstrapPackagesPruneManager, ValueName: "MANAGER", ValueDemanded: true, Short: "Only prune packages for this manager. Currently only `brew` is supported", Long: "Only prune packages for this manager. Currently only `brew` is supported", Choices: []string{"brew"}, Default: []string{"brew"}}, {Key: FlagBootstrapPackagesPruneDryRun, Short: "Print what would be removed without deleting anything", Long: "Print what would be removed without deleting anything"}, {Key: FlagBootstrapPackagesPruneYes, Short: "Skip the confirmation prompt", Long: "Skip the confirmation prompt"}, - {Key: CmdBootstrapPackagesStatus, Short: "Show the status of system packages from `[bootstrap.packages]`"}, + {Key: CmdBootstrapPackagesStatus, Short: "Show the status of system packages from `[bootstrap.packages]`", VisibleAliases: []string{"ls"}}, {Key: FlagBootstrapPackagesStatusJson, Short: "Output in JSON format", Long: "Output in JSON format"}, {Key: FlagBootstrapPackagesStatusMissing, Short: "Exit with code 1 if any configured packages are not in their desired state", Long: "Exit with code 1 if any configured packages are not in their desired state"}, - {Key: CmdBootstrapPackagesUpgrade, Short: "Upgrade installed bootstrap packages from `[bootstrap.packages]`", Long: "Upgrade installed bootstrap packages from `[bootstrap.packages]`\n\nRefreshes package manager metadata and upgrades the configured packages\nthat are already installed: apk/apt/dnf/pacman upgrade to the newest available\nversion (apk, apt, and dnf honor a version pinned in config), brew pours the\nformula's current bottle and replaces the old keg, brew-cask installs\nthe current cask artifact, flatpak updates applications and runtimes, and mas upgrades App Store apps. Packages that\nare not installed yet are skipped — use `mise bootstrap packages apply`\nfor those.\n\nPackages can also be given explicitly in `manager:package` form."}, + {Key: CmdBootstrapPackagesUpgrade, Short: "Upgrade installed bootstrap packages from `[bootstrap.packages]`", Long: "Upgrade installed bootstrap packages from `[bootstrap.packages]`\n\nRefreshes package manager metadata and upgrades the configured packages\nthat are already installed: apk/apt/dnf/pacman upgrade to the newest available\nversion (apk, apt, and dnf honor a version pinned in config), brew pours the\nformula's current bottle and replaces the old keg, brew-cask installs\nthe current cask artifact, flatpak updates applications and runtimes, and mas upgrades App Store apps. Packages that\nare not installed yet are skipped — use `mise bootstrap packages apply`\nfor those.\n\nPackages can also be given explicitly in `manager:package` form.", VisibleAliases: []string{"up"}}, {Key: FlagBootstrapPackagesUpgradeManager, ValueName: "MANAGER", ValueDemanded: true, Short: "Only upgrade packages for this built-in or plugin manager", Long: "Only upgrade packages for this built-in or plugin manager"}, {Key: FlagBootstrapPackagesUpgradeDryRun, Short: "Print the commands that would run without running them", Long: "Print the commands that would run without running them"}, {Key: FlagBootstrapPackagesUpgradeYes, Short: "Skip the confirmation prompt", Long: "Skip the confirmation prompt"}, {Key: ArgBootstrapPackagesUpgradePackage, Short: "Packages in `manager:package` form; defaults to everything configured in [bootstrap.packages]", Long: "Packages in `manager:package` form; defaults to everything configured in [bootstrap.packages]"}, - {Key: CmdBootstrapPackagesUse, Short: "Add bootstrap packages to [bootstrap.packages] and install them", Long: "Add bootstrap packages to [bootstrap.packages] and install them\n\nLike `mise use` for tools: writes `\"manager:package\" = \"version\"` entries\nto mise.toml (the local config by default, the global one with `-g`) and\nthen installs whatever is missing.\n\nVersions are pinned with `@`: `mise bootstrap packages use apt:curl@8.5.0-2`. Without\n`@` (or with `@latest`) no pin is written. brew formulae and casks\nversion through their names instead (for example `brew:postgresql@17`,\n`brew-cask:temurin@17`), where `@` is part of the Homebrew name rather than\na mise version selector. mas uses numeric ADAM IDs and does not support pins."}, + {Key: CmdBootstrapPackagesUse, Short: "Add bootstrap packages to [bootstrap.packages] and install them", Long: "Add bootstrap packages to [bootstrap.packages] and install them\n\nLike `mise use` for tools: writes `\"manager:package\" = \"version\"` entries\nto mise.toml (the local config by default, the global one with `-g`) and\nthen installs whatever is missing.\n\nVersions are pinned with `@`: `mise bootstrap packages use apt:curl@8.5.0-2`. Without\n`@` (or with `@latest`) no pin is written. brew formulae and casks\nversion through their names instead (for example `brew:postgresql@17`,\n`brew-cask:temurin@17`), where `@` is part of the Homebrew name rather than\na mise version selector. mas uses numeric ADAM IDs and does not support pins.", VisibleAliases: []string{"u"}}, {Key: FlagBootstrapPackagesUseEnv, ValueName: "ENV", ValueDemanded: true, Short: "Write to the config file for this environment (mise..toml)", Long: "Write to the config file for this environment (mise..toml)"}, {Key: FlagBootstrapPackagesUseGlobal, Short: "Write to the global config (~/.config/mise/config.toml) instead of the local one", Long: "Write to the global config (~/.config/mise/config.toml) instead of the local one"}, {Key: FlagBootstrapPackagesUseDryRun, Short: "Print the commands that would run without writing config or installing", Long: "Print the commands that would run without writing config or installing"}, @@ -5078,7 +5078,7 @@ var HelpText = argv.HelpTable{ {Key: CmdBootstrapRemote, Short: "Bootstrap one or more machines over OpenSSH"}, {Key: FlagBootstrapRemoteAll, Short: "Select every configured inventory host", Long: "Select every configured inventory host"}, {Key: FlagBootstrapRemoteBootstrapCommand, ValueName: "COMMAND", ValueDemanded: true, Short: "Explicit remote shell command that installs mise and places it on PATH", Long: "Explicit remote shell command that installs mise and places it on PATH"}, - {Key: FlagBootstrapRemoteConnectTimeout, ValueName: "CONNECT_TIMEOUT", ValueDemanded: true, Short: "SSH connection timeout in seconds", Long: "SSH connection timeout in seconds"}, + {Key: FlagBootstrapRemoteConnectTimeout, ValueName: "CONNECT_TIMEOUT", ValueDemanded: true, Short: "SSH connection timeout in seconds", Long: "SSH connection timeout in seconds", Default: []string{"10"}}, {Key: FlagBootstrapRemoteExclude, Repeatable: true, ValueName: "PATTERN", ValueDemanded: true, Short: "Additional archive pattern to exclude; repeat for multiple patterns", Long: "Additional archive pattern to exclude; repeat for multiple patterns"}, {Key: FlagBootstrapRemoteFailFast, Short: "Stop after the first failed target", Long: "Stop after the first failed target"}, {Key: FlagBootstrapRemoteForceDotfiles, Short: "Allow remote dotfile conflicts to be replaced", Long: "Allow remote dotfile conflicts to be replaced"}, @@ -5087,11 +5087,11 @@ var HelpText = argv.HelpTable{ {Key: FlagBootstrapRemoteDryRun, Short: "Print the remote bootstrap changes without applying them", Long: "Print the remote bootstrap changes without applying them"}, {Key: FlagBootstrapRemoteKeepStaging, Short: "Keep the remote staging directory for debugging", Long: "Keep the remote staging directory for debugging"}, {Key: FlagBootstrapRemoteMiseBin, ValueName: "MISE_BIN", ValueDemanded: true, Short: "Local mise binary to upload (escape hatch for custom architectures)", Long: "Local mise binary to upload (escape hatch for custom architectures)"}, - {Key: FlagBootstrapRemoteOnly, Repeatable: true, ValueName: "ONLY", ValueDemanded: true, Short: "Run only one or more remote bootstrap parts", Long: "Run only one or more remote bootstrap parts"}, + {Key: FlagBootstrapRemoteOnly, Repeatable: true, ValueName: "ONLY", ValueDemanded: true, Short: "Run only one or more remote bootstrap parts", Long: "Run only one or more remote bootstrap parts", Choices: []string{"plugins", "packages", "accounts", "files", "services", "firewall", "compose", "repos", "dotfiles", "mise-shell-activate", "shell", "macos-defaults", "defaults", "macos-launchd-agents", "launchd", "linux-systemd-units", "systemd", "user", "tools", "task", "final-hook"}}, {Key: FlagBootstrapRemotePort, ValueName: "PORT", ValueDemanded: true, Short: "SSH port override", Long: "SSH port override"}, {Key: FlagBootstrapRemotePromptSecrets, Short: "Prompt securely for missing secret inputs on the remote host", Long: "Prompt securely for missing secret inputs on the remote host"}, {Key: FlagBootstrapRemoteRemoteMise, ValueName: "COMMAND", ValueDemanded: true, Short: "Existing mise executable name or path; relative paths use the staged project", Long: "Existing mise executable name or path; relative paths use the staged project"}, - {Key: FlagBootstrapRemoteSkip, Repeatable: true, ValueName: "SKIP", ValueDemanded: true, Short: "Skip one or more remote bootstrap parts", Long: "Skip one or more remote bootstrap parts"}, + {Key: FlagBootstrapRemoteSkip, Repeatable: true, ValueName: "SKIP", ValueDemanded: true, Short: "Skip one or more remote bootstrap parts", Long: "Skip one or more remote bootstrap parts", Choices: []string{"plugins", "packages", "accounts", "files", "services", "firewall", "compose", "repos", "dotfiles", "mise-shell-activate", "shell", "macos-defaults", "defaults", "macos-launchd-agents", "launchd", "linux-systemd-units", "systemd", "user", "tools", "task", "final-hook"}}, {Key: FlagBootstrapRemoteSource, ValueName: "SOURCE", ValueDemanded: true, Short: "Local directory archived and sent to each target", Long: "Local directory archived and sent to each target"}, {Key: FlagBootstrapRemoteSshOption, Repeatable: true, ValueName: "OPTION", ValueDemanded: true, Short: "OpenSSH `-o` option; repeat for multiple options", Long: "OpenSSH `-o` option; repeat for multiple options"}, {Key: FlagBootstrapRemoteTag, Repeatable: true, ValueName: "TAG", ValueDemanded: true, Short: "Select configured hosts with this tag; repeat to match any tag", Long: "Select configured hosts with this tag; repeat to match any tag"}, @@ -5125,7 +5125,7 @@ var HelpText = argv.HelpTable{ {Key: CmdBootstrapServicesStatus, Short: "Show configured Linux system service state"}, {Key: FlagBootstrapServicesStatusJson, Short: "Output in JSON format", Long: "Output in JSON format"}, {Key: FlagBootstrapServicesStatusMissing, Short: "Exit with code 1 when any service is not converged", Long: "Exit with code 1 when any service is not converged"}, - {Key: CmdBootstrapStatus, Short: "Show the aggregate bootstrap status"}, + {Key: CmdBootstrapStatus, Short: "Show the aggregate bootstrap status", VisibleAliases: []string{"ls"}}, {Key: FlagBootstrapStatusJson, Short: "Output in JSON format", Long: "Output in JSON format"}, {Key: FlagBootstrapStatusMissing, Short: "Exit with code 1 if any configured bootstrap state is not in its desired state", Long: "Exit with code 1 if any configured bootstrap state is not in its desired state"}, {Key: FlagBootstrapStatusPromptSecrets, Short: "Prompt securely for missing bootstrap secret inputs", Long: "Prompt securely for missing bootstrap secret inputs"}, @@ -5144,12 +5144,12 @@ var HelpText = argv.HelpTable{ {Key: FlagBootstrapUserStatusJson, Short: "Output in JSON format", Long: "Output in JSON format"}, {Key: FlagBootstrapUserStatusMissing, Short: "Exit with code 1 if any configured user setting is not in its desired state", Long: "Exit with code 1 if any configured user setting is not in its desired state"}, {Key: CmdCache, Short: "Manage the mise cache", Long: "Manage the mise cache\n\nRun `mise cache` with no args to view the current cache directory."}, - {Key: CmdCacheClear, Short: "Deletes all cache files in mise"}, + {Key: CmdCacheClear, Short: "Deletes all cache files in mise", VisibleAliases: []string{"c"}}, {Key: FlagCacheClearOutdate, Hide: true, Short: "Mark all cache files as old", Long: "Mark all cache files as old"}, {Key: FlagCacheClearTask, ValueName: "TASK", ValueDemanded: true, Short: "Clear output cache entries for a task name or pattern", Long: "Clear output cache entries for a task name or pattern"}, {Key: ArgCacheClearTool, Short: "Tool(s) to clear cache for e.g.: node, python", Long: "Tool(s) to clear cache for e.g.: node, python"}, - {Key: CmdCachePath, Short: "Show the cache directory path"}, - {Key: CmdCachePrune, Short: "Removes stale mise cache files", Long: "Removes stale mise cache files\n\nBy default, this command will remove files that have not been accessed in 30 days.\nChange this with the MISE_CACHE_PRUNE_AGE environment variable."}, + {Key: CmdCachePath, Short: "Show the cache directory path", VisibleAliases: []string{"dir"}}, + {Key: CmdCachePrune, Short: "Removes stale mise cache files", Long: "Removes stale mise cache files\n\nBy default, this command will remove files that have not been accessed in 30 days.\nChange this with the MISE_CACHE_PRUNE_AGE environment variable.", VisibleAliases: []string{"p"}}, {Key: FlagCachePruneVerbose, Repeatable: true, Short: "Show pruned files", Long: "Show pruned files"}, {Key: FlagCachePruneDryRun, Short: "Just show what would be pruned", Long: "Just show what would be pruned"}, {Key: ArgCachePruneTool, Short: "Tool(s) to prune cache for e.g.: node, python", Long: "Tool(s) to prune cache for e.g.: node, python"}, @@ -5157,24 +5157,24 @@ var HelpText = argv.HelpTable{ {Key: FlagCacheTaskJson, Short: "Output in JSON format", Long: "Output in JSON format"}, {Key: ArgCacheTaskTask, Demanded: true, Short: "Task name or pattern to inspect", Long: "Task name or pattern to inspect"}, {Key: CmdCompletion, Short: "Generate shell completions"}, - {Key: FlagCompletionShell, Hide: true, ValueName: "SHELL_TYPE", ValueDemanded: true, Short: "Shell type to generate completions for", Long: "Shell type to generate completions for"}, + {Key: FlagCompletionShell, Hide: true, ValueName: "SHELL_TYPE", ValueDemanded: true, Short: "Shell type to generate completions for", Long: "Shell type to generate completions for", Choices: []string{"bash", "fish", "powershell", "zsh"}}, {Key: FlagCompletionIncludeBashCompletionLib, Short: "Include the bash completion library in the bash completion script", Long: "Include the bash completion library in the bash completion script\n\nThis is required for completions to work in bash, but it is not included by default\nyou may source it separately or enable this flag to enable it in the script."}, - {Key: FlagCompletionUsage, Hide: true, Short: "Always use usage for completions.", Long: "Always use usage for completions.\nCurrently, usage is the default for fish and bash but not zsh since it has a few quirks\nto work out first.\n\nThis requires the `usage` CLI to be installed.\nhttps://usage.jdx.dev"}, - {Key: ArgCompletionShell, Short: "Shell type to generate completions for", Long: "Shell type to generate completions for"}, - {Key: CmdConfig, Short: "Manage config files"}, + {Key: FlagCompletionUsage, Hide: true, Short: "Always use usage for completions.\nCurrently, usage is the default for fish and bash but not zsh since it has a few quirks\nto work out first.", Long: "Always use usage for completions.\nCurrently, usage is the default for fish and bash but not zsh since it has a few quirks\nto work out first.\n\nThis requires the `usage` CLI to be installed.\nhttps://usage.jdx.dev"}, + {Key: ArgCompletionShell, Short: "Shell type to generate completions for", Long: "Shell type to generate completions for", Choices: []string{"bash", "fish", "powershell", "zsh"}}, + {Key: CmdConfig, Short: "Manage config files", VisibleAliases: []string{"cfg"}}, {Key: FlagConfigJson, Short: "Output in JSON format", Long: "Output in JSON format"}, {Key: FlagConfigNoHeader, Short: "Do not print table header", Long: "Do not print table header"}, {Key: FlagConfigTrackedConfigs, Short: "List all tracked config files", Long: "List all tracked config files"}, {Key: CmdConfigGet, Short: "Display the value of a setting in a mise.toml file"}, {Key: FlagConfigGetFile, ValueName: "FILE", ValueDemanded: true, Short: "The path to the mise.toml file to read", Long: "The path to the mise.toml file to read\n\nCan be a file path or directory. If a directory is provided, the config file in that directory is used.\n\nIf not provided, the nearest mise.toml file will be used"}, {Key: ArgConfigGetKey, Short: "The path of the config to display", Long: "The path of the config to display"}, - {Key: CmdConfigLs, Short: "List config files currently in use"}, + {Key: CmdConfigLs, Short: "List config files currently in use", VisibleAliases: []string{"list"}}, {Key: FlagConfigLsJson, Short: "Output in JSON format", Long: "Output in JSON format"}, {Key: FlagConfigLsNoHeader, Short: "Do not print table header", Long: "Do not print table header"}, {Key: FlagConfigLsTrackedConfigs, Short: "List all tracked config files", Long: "List all tracked config files"}, {Key: CmdConfigSet, Short: "Set the value of a setting in a mise.toml file"}, {Key: FlagConfigSetFile, ValueName: "FILE", ValueDemanded: true, Short: "The path to the mise.toml file to edit", Long: "The path to the mise.toml file to edit\n\nCan be a file path or directory. If a directory is provided, the config file in that directory is used.\n\nIf not provided, the nearest mise.toml file will be used"}, - {Key: FlagConfigSetType, ValueName: "TYPE", ValueDemanded: true}, + {Key: FlagConfigSetType, ValueName: "TYPE", ValueDemanded: true, Choices: []string{"infer", "string", "integer", "float", "bool", "list", "set"}, Default: []string{"infer"}}, {Key: ArgConfigSetKey, Demanded: true, Short: "The path of the config to display", Long: "The path of the config to display"}, {Key: ArgConfigSetValue, Short: "The value to set the key to (optional if provided as KEY=VALUE)", Long: "The value to set the key to (optional if provided as KEY=VALUE)"}, {Key: CmdCurrent, Hide: true, Short: "Shows current active and installed runtime versions", Long: "Shows current active and installed runtime versions\n\nThis is similar to `mise ls --current`, but this only shows the runtime\nand/or version. It's designed to fit into scripts more easily."}, @@ -5207,35 +5207,35 @@ var HelpText = argv.HelpTable{ {Key: FlagDotfilesEditSource, ValueName: "PATH", ValueDemanded: true, Short: "Source path to use if the target is not yet managed", Long: "Source path to use if the target is not yet managed"}, {Key: FlagDotfilesEditYes, Short: "Skip the confirmation prompt when adding an unmanaged target", Long: "Skip the confirmation prompt when adding an unmanaged target"}, {Key: ArgDotfilesEditTarget, Demanded: true, Short: "Target to edit", Long: "Target to edit"}, - {Key: CmdDotfilesStatus, Hide: true, Short: "Show the status of dotfiles from `[dotfiles]`"}, + {Key: CmdDotfilesStatus, Hide: true, Short: "Show the status of dotfiles from `[dotfiles]`", VisibleAliases: []string{"ls"}}, {Key: FlagDotfilesStatusJson, Short: "Output in JSON format", Long: "Output in JSON format"}, - {Key: FlagDotfilesStatusMissing, Short: "Exit with code 1 if any configured dotfiles are not in their desired", Long: "Exit with code 1 if any configured dotfiles are not in their desired\nstate (missing, source missing, differs)"}, + {Key: FlagDotfilesStatusMissing, Short: "Exit with code 1 if any configured dotfiles are not in their desired\nstate (missing, source missing, differs)", Long: "Exit with code 1 if any configured dotfiles are not in their desired\nstate (missing, source missing, differs)"}, {Key: ArgDotfilesStatusTarget, Short: "Only show these targets", Long: "Only show these targets"}, {Key: CmdDotfilesUnapply, Hide: true, Short: "Remove dotfiles applied from `[dotfiles]`", Long: "Remove dotfiles applied from `[dotfiles]`\n\nRemoves configured whole-file entries and edits while preserving files\nmise cannot identify as managed. Modified copies, templates, and plain-line\nedits require `--force`."}, {Key: FlagDotfilesUnapplyForce, Short: "Remove modified or otherwise ambiguous managed files and lines", Long: "Remove modified or otherwise ambiguous managed files and lines"}, {Key: FlagDotfilesUnapplyDryRun, Short: "Print the actions that would run without writing anything", Long: "Print the actions that would run without writing anything"}, {Key: FlagDotfilesUnapplyYes, Short: "Skip the confirmation prompt", Long: "Skip the confirmation prompt"}, {Key: ArgDotfilesUnapplyTarget, Short: "Only unapply these targets", Long: "Only unapply these targets"}, - {Key: CmdDoctor, Short: "Check mise installation for possible problems"}, + {Key: CmdDoctor, Short: "Check mise installation for possible problems", VisibleAliases: []string{"dr"}}, {Key: FlagDoctorJson}, {Key: CmdDoctorPath, Short: "Print the current PATH entries mise is providing"}, {Key: FlagDoctorPathFull, Short: "Print all entries including those not provided by mise", Long: "Print all entries including those not provided by mise"}, {Key: CmdEn, Short: "Starts a new shell with the mise environment built from the current configuration", Long: "Starts a new shell with the mise environment built from the current configuration\n\nThis is an alternative to `mise activate` that allows you to explicitly start a mise session.\nIt will have the tools and environment variables in the configs loaded.\nNote that changing directories will not update the mise environment."}, {Key: FlagEnShell, ValueName: "SHELL", ValueDemanded: true, Short: "Shell to start", Long: "Shell to start\n\nDefaults to $SHELL"}, - {Key: ArgEnDir, Short: "Directory to start the shell in", Long: "Directory to start the shell in"}, - {Key: CmdEnv, Short: "Exports env vars to activate mise a single time", Long: "Exports env vars to activate mise a single time\n\nUse this if you don't want to permanently install mise. It's not necessary to\nuse this if you have `mise activate` in your shell rc file."}, + {Key: ArgEnDir, Short: "Directory to start the shell in", Long: "Directory to start the shell in", Default: []string{"."}}, + {Key: CmdEnv, Short: "Exports env vars to activate mise a single time", Long: "Exports env vars to activate mise a single time\n\nUse this if you don't want to permanently install mise. It's not necessary to\nuse this if you have `mise activate` in your shell rc file.", VisibleAliases: []string{"e"}}, {Key: FlagEnvDotenv, Short: "Output in dotenv format", Long: "Output in dotenv format"}, {Key: FlagEnvJson, Short: "Output in JSON format", Long: "Output in JSON format"}, - {Key: FlagEnvShell, ValueName: "SHELL", ValueDemanded: true, Short: "Shell type to generate environment variables for", Long: "Shell type to generate environment variables for"}, + {Key: FlagEnvShell, ValueName: "SHELL", ValueDemanded: true, Short: "Shell type to generate environment variables for", Long: "Shell type to generate environment variables for", Choices: []string{"bash", "elvish", "fish", "nu", "xonsh", "zsh", "pwsh"}}, {Key: FlagEnvJsonExtended, Short: "Output in JSON format with additional information (source, tool)", Long: "Output in JSON format with additional information (source, tool)"}, {Key: FlagEnvRedacted, Short: "Only show redacted environment variables", Long: "Only show redacted environment variables"}, {Key: FlagEnvValues, Short: "Only show values of environment variables", Long: "Only show values of environment variables"}, {Key: ArgEnvToolVersion, Short: "Tool(s) to use", Long: "Tool(s) to use"}, - {Key: CmdExec, Short: "Execute a command with tool(s) set", Long: "Execute a command with tool(s) set\n\nuse this to avoid modifying the shell session or running ad-hoc commands with mise tools set.\n\nTools will be loaded from mise.toml, though they can be overridden with args\nNote that only the plugin specified will be overridden, so if a `mise.toml` file\nincludes \"node 20\" but you run `mise exec python@3.11`; it will still load node@20.\n\nThe \"--\" separates runtimes from the commands to pass along to the subprocess."}, + {Key: CmdExec, Short: "Execute a command with tool(s) set", Long: "Execute a command with tool(s) set\n\nuse this to avoid modifying the shell session or running ad-hoc commands with mise tools set.\n\nTools will be loaded from mise.toml, though they can be overridden with args\nNote that only the plugin specified will be overridden, so if a `mise.toml` file\nincludes \"node 20\" but you run `mise exec python@3.11`; it will still load node@20.\n\nThe \"--\" separates runtimes from the commands to pass along to the subprocess.", VisibleAliases: []string{"x"}}, {Key: FlagExecCommand, ValueName: "C", ValueDemanded: true, Short: "Command string to execute", Long: "Command string to execute"}, - {Key: FlagExecJobs, ValueName: "JOBS", ValueDemanded: true, Short: "Number of jobs to run in parallel", Long: "Number of jobs to run in parallel\n[default: 4]"}, - {Key: FlagExecAllowEnv, Repeatable: true, ValueName: "VAR", ValueDemanded: true, Short: "Allow specific env var through (implies --deny-env for everything else)", Long: "Allow specific env var through (implies --deny-env for everything else)\nSupports wildcards, e.g. --allow-env='MYAPP_*'"}, - {Key: FlagExecAllowNet, Repeatable: true, ValueName: "HOST", ValueDemanded: true, Short: "Allow network to specific host (implies --deny-net for everything else)", Long: "Allow network to specific host (implies --deny-net for everything else)\nmacOS only in v1; on Linux falls back to allowing all network"}, + {Key: FlagExecJobs, ValueName: "JOBS", ValueDemanded: true, Short: "Number of jobs to run in parallel\n[default: 4]", Long: "Number of jobs to run in parallel\n[default: 4]"}, + {Key: FlagExecAllowEnv, Repeatable: true, ValueName: "VAR", ValueDemanded: true, Short: "Allow specific env var through (implies --deny-env for everything else)\nSupports wildcards, e.g. --allow-env='MYAPP_*'", Long: "Allow specific env var through (implies --deny-env for everything else)\nSupports wildcards, e.g. --allow-env='MYAPP_*'"}, + {Key: FlagExecAllowNet, Repeatable: true, ValueName: "HOST", ValueDemanded: true, Short: "Allow network to specific host (implies --deny-net for everything else)\nmacOS only in v1; on Linux falls back to allowing all network", Long: "Allow network to specific host (implies --deny-net for everything else)\nmacOS only in v1; on Linux falls back to allowing all network"}, {Key: FlagExecAllowRead, Repeatable: true, ValueName: "PATH", ValueDemanded: true, Short: "Allow reads from specific path (implies --deny-read for everything else)", Long: "Allow reads from specific path (implies --deny-read for everything else)"}, {Key: FlagExecAllowWrite, Repeatable: true, ValueName: "PATH", ValueDemanded: true, Short: "Allow writes to specific path (implies --deny-write for everything else)", Long: "Allow writes to specific path (implies --deny-write for everything else)"}, {Key: FlagExecDenyAll, Short: "Block reads, writes, network, and env vars", Long: "Block reads, writes, network, and env vars"}, @@ -5252,12 +5252,12 @@ var HelpText = argv.HelpTable{ {Key: FlagFmtAll, Short: "Format all files from the current directory", Long: "Format all files from the current directory"}, {Key: FlagFmtCheck, Short: "Check if the configs are formatted, no formatting is done", Long: "Check if the configs are formatted, no formatting is done"}, {Key: FlagFmtStdin, Short: "Read config from stdin and write its formatted version into stdout", Long: "Read config from stdin and write its formatted version into stdout"}, - {Key: CmdGenerate, Short: "Generate files for various tools/services"}, + {Key: CmdGenerate, Short: "Generate files for various tools/services", VisibleAliases: []string{"gen"}}, {Key: CmdGenerateBootstrap, Short: "Generate a script to download+execute mise", Long: "Generate a script to download+execute mise\n\nThis is designed to be used in a project where contributors may not have mise installed."}, {Key: FlagGenerateBootstrapLocalize, Short: "Sandboxes mise internal directories like MISE_DATA_DIR and MISE_CACHE_DIR into a `.mise` directory in the project", Long: "Sandboxes mise internal directories like MISE_DATA_DIR and MISE_CACHE_DIR into a `.mise` directory in the project\n\nThis is necessary if users may use a different version of mise outside the project."}, {Key: FlagGenerateBootstrapVersion, ValueName: "VERSION", ValueDemanded: true, Short: "Specify mise version to fetch", Long: "Specify mise version to fetch"}, {Key: FlagGenerateBootstrapWrite, ValueName: "WRITE", ValueDemanded: true, Short: "instead of outputting the script to stdout, write to a file and make it executable", Long: "instead of outputting the script to stdout, write to a file and make it executable"}, - {Key: FlagGenerateBootstrapLocalizedDir, ValueName: "LOCALIZED_DIR", ValueDemanded: true, Short: "Directory to put localized data into", Long: "Directory to put localized data into"}, + {Key: FlagGenerateBootstrapLocalizedDir, ValueName: "LOCALIZED_DIR", ValueDemanded: true, Short: "Directory to put localized data into", Long: "Directory to put localized data into", Default: []string{".mise"}}, {Key: CmdGenerateConfig, Short: "Generate a mise.toml file"}, {Key: FlagGenerateConfigGlobal, Short: "Generate the global config file (~/.config/mise/config.toml)", Long: "Generate the global config file (~/.config/mise/config.toml)"}, {Key: FlagGenerateConfigDryRun, Short: "Show what would be generated without writing to file", Long: "Show what would be generated without writing to file"}, @@ -5268,36 +5268,36 @@ var HelpText = argv.HelpTable{ {Key: FlagGenerateDevcontainerMountMiseData, Short: "Bind the mise-data-volume to the devcontainer", Long: "Bind the mise-data-volume to the devcontainer"}, {Key: FlagGenerateDevcontainerName, ValueName: "NAME", ValueDemanded: true, Short: "The name of the devcontainer", Long: "The name of the devcontainer"}, {Key: FlagGenerateDevcontainerWrite, Short: "write to .devcontainer/devcontainer.json", Long: "write to .devcontainer/devcontainer.json"}, - {Key: CmdGenerateGitPreCommit, Short: "Generate a git pre-commit hook", Long: "Generate a git pre-commit hook\n\nThis command generates a git pre-commit hook that runs a mise task like `mise run pre-commit`\nwhen you commit changes to your repository.\n\nStaged files are passed to the task as `STAGED`.\n\nFor more advanced pre-commit functionality, see mise's sister project: https://hk.jdx.dev/"}, - {Key: FlagGenerateGitPreCommitTask, ValueName: "TASK", ValueDemanded: true, Short: "The task to run when the pre-commit hook is triggered", Long: "The task to run when the pre-commit hook is triggered"}, + {Key: CmdGenerateGitPreCommit, Short: "Generate a git pre-commit hook", Long: "Generate a git pre-commit hook\n\nThis command generates a git pre-commit hook that runs a mise task like `mise run pre-commit`\nwhen you commit changes to your repository.\n\nStaged files are passed to the task as `STAGED`.\n\nFor more advanced pre-commit functionality, see mise's sister project: https://hk.jdx.dev/", VisibleAliases: []string{"pre-commit"}}, + {Key: FlagGenerateGitPreCommitTask, ValueName: "TASK", ValueDemanded: true, Short: "The task to run when the pre-commit hook is triggered", Long: "The task to run when the pre-commit hook is triggered", Default: []string{"pre-commit"}}, {Key: FlagGenerateGitPreCommitWrite, Short: "write to .git/hooks/pre-commit and make it executable", Long: "write to .git/hooks/pre-commit and make it executable"}, - {Key: FlagGenerateGitPreCommitHook, ValueName: "HOOK", ValueDemanded: true, Short: "Which hook to generate (saves to .git/hooks/$hook)", Long: "Which hook to generate (saves to .git/hooks/$hook)"}, + {Key: FlagGenerateGitPreCommitHook, ValueName: "HOOK", ValueDemanded: true, Short: "Which hook to generate (saves to .git/hooks/$hook)", Long: "Which hook to generate (saves to .git/hooks/$hook)", Default: []string{"pre-commit"}}, {Key: CmdGenerateGithubAction, Short: "Generate a GitHub Action workflow file", Long: "Generate a GitHub Action workflow file\n\nThis command generates a GitHub Action workflow file that runs a mise task like `mise run ci`\nwhen you push changes to your repository."}, - {Key: FlagGenerateGithubActionTask, ValueName: "TASK", ValueDemanded: true, Short: "The task to run when the workflow is triggered", Long: "The task to run when the workflow is triggered"}, + {Key: FlagGenerateGithubActionTask, ValueName: "TASK", ValueDemanded: true, Short: "The task to run when the workflow is triggered", Long: "The task to run when the workflow is triggered", Default: []string{"ci"}}, {Key: FlagGenerateGithubActionWrite, Short: "write to .github/workflows/$name.yml", Long: "write to .github/workflows/$name.yml"}, - {Key: FlagGenerateGithubActionName, ValueName: "NAME", ValueDemanded: true, Short: "the name of the workflow to generate", Long: "the name of the workflow to generate"}, + {Key: FlagGenerateGithubActionName, ValueName: "NAME", ValueDemanded: true, Short: "the name of the workflow to generate", Long: "the name of the workflow to generate", Default: []string{"ci"}}, {Key: CmdGenerateTaskDocs, Short: "Generate documentation for tasks in a project"}, {Key: FlagGenerateTaskDocsInject, Short: "inserts the documentation into an existing file", Long: "inserts the documentation into an existing file\n\nThis will look for a special comment, ``, and replace it with the generated documentation.\nIt will replace everything between the comment and the next comment, `` so it can be\nrun multiple times on the same file to update the documentation.\nThe file must already contain both comments; mise errors instead of modifying the file if they are missing."}, {Key: FlagGenerateTaskDocsIndex, Short: "write only an index of tasks, intended for use with `--multi`", Long: "write only an index of tasks, intended for use with `--multi`"}, {Key: FlagGenerateTaskDocsMulti, Short: "render each task as a separate document, requires `--output` to be a directory", Long: "render each task as a separate document, requires `--output` to be a directory"}, {Key: FlagGenerateTaskDocsOutput, ValueName: "OUTPUT", ValueDemanded: true, Short: "writes the generated docs to a file/directory", Long: "writes the generated docs to a file/directory"}, {Key: FlagGenerateTaskDocsRoot, ValueName: "ROOT", ValueDemanded: true, Short: "root directory to search for tasks", Long: "root directory to search for tasks"}, - {Key: FlagGenerateTaskDocsStyle, ValueName: "STYLE", ValueDemanded: true}, + {Key: FlagGenerateTaskDocsStyle, ValueName: "STYLE", ValueDemanded: true, Choices: []string{"simple", "detailed"}, Default: []string{"simple"}}, {Key: CmdGenerateTaskStubs, Short: "Generates shims to run mise tasks", Long: "Generates shims to run mise tasks\n\nBy default, this will build shims like ./bin/. These can be paired with `mise generate bootstrap`\nso contributors to a project can execute mise tasks without installing mise into their system."}, - {Key: FlagGenerateTaskStubsDir, ValueName: "DIR", ValueDemanded: true, Short: "Directory to create task stubs inside of", Long: "Directory to create task stubs inside of"}, - {Key: FlagGenerateTaskStubsMiseBin, ValueName: "MISE_BIN", ValueDemanded: true, Short: "Path to a mise bin to use when running the task stub.", Long: "Path to a mise bin to use when running the task stub.\n\nUse `--mise-bin=./bin/mise` to use a mise bin generated from `mise generate bootstrap`"}, + {Key: FlagGenerateTaskStubsDir, ValueName: "DIR", ValueDemanded: true, Short: "Directory to create task stubs inside of", Long: "Directory to create task stubs inside of", Default: []string{"bin"}}, + {Key: FlagGenerateTaskStubsMiseBin, ValueName: "MISE_BIN", ValueDemanded: true, Short: "Path to a mise bin to use when running the task stub.", Long: "Path to a mise bin to use when running the task stub.\n\nUse `--mise-bin=./bin/mise` to use a mise bin generated from `mise generate bootstrap`", Default: []string{"mise"}}, {Key: CmdGenerateToolStub, Short: "Generate a tool stub for HTTP-based tools", Long: "Generate a tool stub for HTTP-based tools\n\nThis command generates tool stubs that can automatically download and execute\ntools from HTTP URLs. It can detect checksums, file sizes, and binary paths\nautomatically by downloading and analyzing the tool.\n\nWhen generating stubs with platform-specific URLs, the command will append new\nplatforms to existing stub files rather than overwriting them. This allows you\nto incrementally build cross-platform tool stubs."}, {Key: FlagGenerateToolStubBin, ValueName: "BIN", ValueDemanded: true, Short: "Binary path within the extracted archive", Long: "Binary path within the extracted archive\n\nIf not specified and the archive is downloaded, will auto-detect the most likely binary"}, {Key: FlagGenerateToolStubBootstrap, Short: "Wrap stub in a bootstrap script that installs mise if not already present", Long: "Wrap stub in a bootstrap script that installs mise if not already present\n\nWhen enabled, generates a bash script that:\n1. Checks if mise is installed at the expected path\n2. If not, downloads and installs mise using the embedded installer\n3. Executes the tool stub using mise"}, {Key: FlagGenerateToolStubBootstrapVersion, ValueName: "BOOTSTRAP_VERSION", ValueDemanded: true, Short: "Specify mise version for the bootstrap script", Long: "Specify mise version for the bootstrap script\n\nBy default, uses the latest version from the install script.\nUse this to pin to a specific version (e.g., \"2025.1.0\")."}, {Key: FlagGenerateToolStubFetch, Short: "Fetch checksums and sizes for an existing tool stub file", Long: "Fetch checksums and sizes for an existing tool stub file\n\nThis reads an existing stub file and fills in any missing checksum/size fields by downloading the files. URLs must already be present in the stub."}, - {Key: FlagGenerateToolStubHttp, ValueName: "HTTP", ValueDemanded: true, Short: "HTTP backend type to use", Long: "HTTP backend type to use"}, + {Key: FlagGenerateToolStubHttp, ValueName: "HTTP", ValueDemanded: true, Short: "HTTP backend type to use", Long: "HTTP backend type to use", Default: []string{"http"}}, {Key: FlagGenerateToolStubLock, Short: "Resolve and embed lockfile data (exact version + platform URLs/checksums) into an existing stub file for reproducible installs without runtime API calls", Long: "Resolve and embed lockfile data (exact version + platform URLs/checksums) into an existing stub file for reproducible installs without runtime API calls"}, {Key: FlagGenerateToolStubPlatformBin, Repeatable: true, ValueName: "PLATFORM_BIN", ValueDemanded: true, Short: "Platform-specific binary paths in the format platform:path", Long: "Platform-specific binary paths in the format platform:path\n\nExamples: --platform-bin windows-x64:tool.exe --platform-bin linux-x64:bin/tool"}, {Key: FlagGenerateToolStubPlatformUrl, Repeatable: true, ValueName: "PLATFORM_URL", ValueDemanded: true, Short: "Platform-specific URLs in the format platform:url or just url (auto-detect platform)", Long: "Platform-specific URLs in the format platform:url or just url (auto-detect platform)\n\nWhen the output file already exists, new platforms will be appended to the existing platforms table. Existing platform URLs will be updated if specified again.\n\nIf only a URL is provided (without platform:), the platform will be automatically detected from the URL filename.\n\nExamples: --platform-url linux-x64:https://... --platform-url https://nodejs.org/dist/v22.17.1/node-v22.17.1-darwin-arm64.tar.gz"}, {Key: FlagGenerateToolStubSkipDownload, Short: "Skip downloading for checksum and binary path detection (faster but less informative)", Long: "Skip downloading for checksum and binary path detection (faster but less informative)"}, {Key: FlagGenerateToolStubUrl, ValueName: "URL", ValueDemanded: true, Short: "URL for downloading the tool", Long: "URL for downloading the tool\n\nExample: https://github.com/owner/repo/releases/download/v2.0.0/tool-linux-x64.tar.gz"}, - {Key: FlagGenerateToolStubVersion, ValueName: "VERSION", ValueDemanded: true, Short: "Version of the tool", Long: "Version of the tool"}, + {Key: FlagGenerateToolStubVersion, ValueName: "VERSION", ValueDemanded: true, Short: "Version of the tool", Long: "Version of the tool", Default: []string{"latest"}}, {Key: ArgGenerateToolStubOutput, Demanded: true, Short: "Output file path for the tool stub", Long: "Output file path for the tool stub"}, {Key: CmdGithub, Hide: true, Short: "GitHub related commands"}, {Key: CmdGithubToken, Hide: true, Short: "Display the GitHub token mise will use for a given host", Long: "Display the GitHub token mise will use for a given host\n\nShows which token source mise would use, useful for debugging\nauthentication issues. The token is masked by default."}, @@ -5305,21 +5305,21 @@ var HelpText = argv.HelpTable{ {Key: FlagGithubTokenRaw, Short: "Print only the token value", Long: "Print only the token value"}, {Key: FlagGithubTokenRefresh, Short: "Mint a fresh OAuth token even if the cached one has not expired, via the refresh-token grant or a new device-code flow", Long: "Mint a fresh OAuth token even if the cached one has not expired, via the refresh-token grant or a new device-code flow"}, {Key: FlagGithubTokenUnmask, Short: "Show the full unmasked token", Long: "Show the full unmasked token"}, - {Key: ArgGithubTokenHost, Short: "GitHub hostname", Long: "GitHub hostname"}, + {Key: ArgGithubTokenHost, Short: "GitHub hostname", Long: "GitHub hostname", Default: []string{"github.com"}}, {Key: CmdGlobal, Hide: true, Short: "Sets/gets the global tool version(s)", Long: "Sets/gets the global tool version(s)\n\nDisplays the contents of global config after writing.\nThe file is `$HOME/.config/mise/config.toml` by default. It can be changed with `$MISE_GLOBAL_CONFIG_FILE`.\nIf `$MISE_GLOBAL_CONFIG_FILE` is set to anything that ends in `.toml`, it will be parsed as `mise.toml`.\nOtherwise, it will be parsed as a `.tool-versions` file.\n\nUse MISE_ASDF_COMPAT=1 to default the global config to ~/.tool-versions\n\nUse `mise local` to set a tool version locally in the current directory."}, - {Key: FlagGlobalFuzzy, Short: "Save fuzzy version to `~/.tool-versions`", Long: "Save fuzzy version to `~/.tool-versions`\ne.g.: `mise global --fuzzy node@20` will save `node 20` to ~/.tool-versions\nthis is the default behavior unless MISE_ASDF_COMPAT=1"}, + {Key: FlagGlobalFuzzy, Short: "Save fuzzy version to `~/.tool-versions`\ne.g.: `mise global --fuzzy node@20` will save `node 20` to ~/.tool-versions\nthis is the default behavior unless MISE_ASDF_COMPAT=1", Long: "Save fuzzy version to `~/.tool-versions`\ne.g.: `mise global --fuzzy node@20` will save `node 20` to ~/.tool-versions\nthis is the default behavior unless MISE_ASDF_COMPAT=1"}, {Key: FlagGlobalPath, Short: "Get the path of the global config file", Long: "Get the path of the global config file"}, - {Key: FlagGlobalPin, Short: "Save exact version to `~/.tool-versions`", Long: "Save exact version to `~/.tool-versions`\ne.g.: `mise global --pin node@20` will save `node 20.0.0` to ~/.tool-versions"}, + {Key: FlagGlobalPin, Short: "Save exact version to `~/.tool-versions`\ne.g.: `mise global --pin node@20` will save `node 20.0.0` to ~/.tool-versions", Long: "Save exact version to `~/.tool-versions`\ne.g.: `mise global --pin node@20` will save `node 20.0.0` to ~/.tool-versions"}, {Key: FlagGlobalRemove, Repeatable: true, ValueName: "TOOL", ValueDemanded: true, Short: "Remove the tool(s) from ~/.tool-versions", Long: "Remove the tool(s) from ~/.tool-versions"}, - {Key: ArgGlobalToolVersion, Short: "Tool(s) to add to .tool-versions", Long: "Tool(s) to add to .tool-versions\ne.g.: node@20\nIf this is a single tool with no version, the current value of the global\n.tool-versions will be displayed"}, + {Key: ArgGlobalToolVersion, Short: "Tool(s) to add to .tool-versions\ne.g.: node@20\nIf this is a single tool with no version, the current value of the global\n.tool-versions will be displayed", Long: "Tool(s) to add to .tool-versions\ne.g.: node@20\nIf this is a single tool with no version, the current value of the global\n.tool-versions will be displayed"}, {Key: CmdHookEnv, Hide: true, Short: "[internal] called by activate hook to update env vars directory change"}, {Key: FlagHookEnvForce, Short: "Skip early exit check", Long: "Skip early exit check"}, {Key: FlagHookEnvQuiet, Short: "Hide warnings such as when a tool is not installed", Long: "Hide warnings such as when a tool is not installed"}, - {Key: FlagHookEnvShell, ValueName: "SHELL", ValueDemanded: true, Short: "Shell type to generate script for", Long: "Shell type to generate script for"}, - {Key: FlagHookEnvReason, Hide: true, ValueName: "REASON", ValueDemanded: true, Short: "Reason for calling hook-env (e.g., \"precmd\", \"chpwd\")", Long: "Reason for calling hook-env (e.g., \"precmd\", \"chpwd\")"}, + {Key: FlagHookEnvShell, ValueName: "SHELL", ValueDemanded: true, Short: "Shell type to generate script for", Long: "Shell type to generate script for", Choices: []string{"bash", "elvish", "fish", "nu", "xonsh", "zsh", "pwsh"}}, + {Key: FlagHookEnvReason, Hide: true, ValueName: "REASON", ValueDemanded: true, Short: "Reason for calling hook-env (e.g., \"precmd\", \"chpwd\")", Long: "Reason for calling hook-env (e.g., \"precmd\", \"chpwd\")", Choices: []string{"precmd", "chpwd"}}, {Key: FlagHookEnvStatus, Hide: true, Short: "Show \"mise: @\" message when changing directories", Long: "Show \"mise: @\" message when changing directories"}, {Key: CmdHookNotFound, Hide: true, Short: "[internal] called by shell when a command is not found"}, - {Key: FlagHookNotFoundShell, ValueName: "SHELL", ValueDemanded: true, Short: "Shell type to generate script for", Long: "Shell type to generate script for"}, + {Key: FlagHookNotFoundShell, ValueName: "SHELL", ValueDemanded: true, Short: "Shell type to generate script for", Long: "Shell type to generate script for", Choices: []string{"bash", "elvish", "fish", "nu", "xonsh", "zsh", "pwsh"}}, {Key: ArgHookNotFoundBin, Demanded: true, Short: "Attempted bin to run", Long: "Attempted bin to run"}, {Key: CmdImplode, Short: "Removes mise CLI and all related data", Long: "Removes mise CLI and all related data\n\nSkips config directory by default."}, {Key: FlagImplodeDryRun, Short: "List directories that would be removed without actually removing them", Long: "List directories that would be removed without actually removing them"}, @@ -5329,9 +5329,9 @@ var HelpText = argv.HelpTable{ {Key: FlagEditDryRun, Short: "Show what would be generated without writing to file", Long: "Show what would be generated without writing to file"}, {Key: FlagEditToolVersions, ValueName: "TOOL_VERSIONS", ValueDemanded: true, Short: "Path to a .tool-versions file to import tools from", Long: "Path to a .tool-versions file to import tools from"}, {Key: ArgEditPath, Short: "Path to the config file to create", Long: "Path to the config file to create"}, - {Key: CmdInstall, Short: "Install a tool version", Long: "Install a tool version\n\nInstalls a tool version to `~/.local/share/mise/installs//`\nInstalling alone will not activate the tools so they won't be in PATH.\nTo install and/or activate in one command, use `mise use` which will create a `mise.toml` file\nin the current directory to activate this tool when inside the directory.\nAlternatively, run `mise exec @ -- ` to execute a tool without creating config files.\n\nTools will be installed in parallel. To disable, set `--jobs=1` or `MISE_JOBS=1`"}, + {Key: CmdInstall, Short: "Install a tool version", Long: "Install a tool version\n\nInstalls a tool version to `~/.local/share/mise/installs//`\nInstalling alone will not activate the tools so they won't be in PATH.\nTo install and/or activate in one command, use `mise use` which will create a `mise.toml` file\nin the current directory to activate this tool when inside the directory.\nAlternatively, run `mise exec @ -- ` to execute a tool without creating config files.\n\nTools will be installed in parallel. To disable, set `--jobs=1` or `MISE_JOBS=1`", VisibleAliases: []string{"i"}}, {Key: FlagInstallForce, Short: "Force reinstall even if already installed", Long: "Force reinstall even if already installed"}, - {Key: FlagInstallJobs, ValueName: "JOBS", ValueDemanded: true, Short: "Number of jobs to run in parallel", Long: "Number of jobs to run in parallel\n[default: 4]"}, + {Key: FlagInstallJobs, ValueName: "JOBS", ValueDemanded: true, Short: "Number of jobs to run in parallel\n[default: 4]", Long: "Number of jobs to run in parallel\n[default: 4]"}, {Key: FlagInstallDryRun, Short: "Show what would be installed without actually installing", Long: "Show what would be installed without actually installing"}, {Key: FlagInstallVerbose, Repeatable: true, Short: "Show installation output", Long: "Show installation output\n\nThis argument will print backend output such as download, configuration, and compilation output."}, {Key: FlagInstallDryRunCode, Short: "Like --dry-run but exits with code 1 if there are tools to install", Long: "Like --dry-run but exits with code 1 if there are tools to install\n\nThis is useful for scripts to check if tools need to be installed."}, @@ -5349,28 +5349,28 @@ var HelpText = argv.HelpTable{ {Key: FlagLatestMinimumReleaseAge, ValueName: "MINIMUM_RELEASE_AGE", ValueDemanded: true, Short: "Only consider versions released before this date or older than this duration", Long: "Only consider versions released before this date or older than this duration\n\nSupports absolute dates like \"2024-06-01\" and relative durations like \"90d\" or \"1y\".\nOverrides per-tool `minimum_release_age` options and the global `minimum_release_age` setting."}, {Key: ArgLatestToolVersion, Demanded: true, Short: "Tool to get the latest version of", Long: "Tool to get the latest version of"}, {Key: ArgLatestAsdfVersion, Hide: true, Short: "The version prefix to use when querying the latest version same as the first argument after the \"@\" used for asdf compatibility", Long: "The version prefix to use when querying the latest version same as the first argument after the \"@\" used for asdf compatibility"}, - {Key: CmdLink, Short: "Symlinks a tool version into mise", Long: "Symlinks a tool version into mise\n\nUse this for adding installs either custom compiled outside mise or built with a different tool."}, + {Key: CmdLink, Short: "Symlinks a tool version into mise", Long: "Symlinks a tool version into mise\n\nUse this for adding installs either custom compiled outside mise or built with a different tool.", VisibleAliases: []string{"ln"}}, {Key: FlagLinkForce, Short: "Overwrite an existing tool version if it exists", Long: "Overwrite an existing tool version if it exists"}, {Key: ArgLinkToolVersion, Demanded: true, Short: "Tool name and version to create a symlink for", Long: "Tool name and version to create a symlink for"}, - {Key: ArgLinkPath, Demanded: true, Short: "The local path to the tool version", Long: "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0"}, + {Key: ArgLinkPath, Demanded: true, Short: "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0", Long: "The local path to the tool version\ne.g.: ~/.nvm/versions/node/v20.0.0"}, {Key: CmdLocal, Hide: true, Short: "Sets/gets tool version in local .tool-versions or mise.toml", Long: "Sets/gets tool version in local .tool-versions or mise.toml\n\nUse this to set a tool's version when within a directory\nUse `mise global` to set a tool version globally\nThis uses `.tool-version` by default unless there is a `mise.toml` file or if `MISE_USE_TOML`\nis set. A future v2 release of mise will default to using `mise.toml`."}, - {Key: FlagLocalParent, Short: "Recurse up to find a .tool-versions file rather than using the current directory only", Long: "Recurse up to find a .tool-versions file rather than using the current directory only\nby default this command will only set the tool in the current directory (\"$PWD/.tool-versions\")"}, + {Key: FlagLocalParent, Short: "Recurse up to find a .tool-versions file rather than using the current directory only\nby default this command will only set the tool in the current directory (\"$PWD/.tool-versions\")", Long: "Recurse up to find a .tool-versions file rather than using the current directory only\nby default this command will only set the tool in the current directory (\"$PWD/.tool-versions\")"}, {Key: FlagLocalFuzzy, Short: "Save fuzzy version to `.tool-versions` e.g.: `mise local --fuzzy node@20` will save `node 20` to .tool-versions This is the default behavior unless MISE_ASDF_COMPAT=1", Long: "Save fuzzy version to `.tool-versions` e.g.: `mise local --fuzzy node@20` will save `node 20` to .tool-versions This is the default behavior unless MISE_ASDF_COMPAT=1"}, {Key: FlagLocalPath, Short: "Get the path of the config file", Long: "Get the path of the config file"}, - {Key: FlagLocalPin, Short: "Save exact version to `.tool-versions`", Long: "Save exact version to `.tool-versions`\ne.g.: `mise local --pin node@20` will save `node 20.0.0` to .tool-versions"}, + {Key: FlagLocalPin, Short: "Save exact version to `.tool-versions`\ne.g.: `mise local --pin node@20` will save `node 20.0.0` to .tool-versions", Long: "Save exact version to `.tool-versions`\ne.g.: `mise local --pin node@20` will save `node 20.0.0` to .tool-versions"}, {Key: FlagLocalRemove, Repeatable: true, ValueName: "TOOL", ValueDemanded: true, Short: "Remove the tool(s) from .tool-versions", Long: "Remove the tool(s) from .tool-versions"}, - {Key: ArgLocalToolVersion, Short: "Tool(s) to add to .tool-versions/mise.toml", Long: "Tool(s) to add to .tool-versions/mise.toml\ne.g.: node@20\nif this is a single tool with no version,\nthe current value of .tool-versions/mise.toml will be displayed"}, + {Key: ArgLocalToolVersion, Short: "Tool(s) to add to .tool-versions/mise.toml\ne.g.: node@20\nif this is a single tool with no version,\nthe current value of .tool-versions/mise.toml will be displayed", Long: "Tool(s) to add to .tool-versions/mise.toml\ne.g.: node@20\nif this is a single tool with no version,\nthe current value of .tool-versions/mise.toml will be displayed"}, {Key: CmdLock, Short: "Update lockfile checksums and URLs for all specified platforms", Long: "Update lockfile checksums and URLs for all specified platforms\n\nUpdates checksums and download URLs for all platforms already specified in the lockfile.\nIf no lockfile exists, shows what would be created based on the current configuration.\nThis allows you to refresh lockfile data for platforms other than the one you're currently on.\nOperates on the lockfile in the current config root. Use TOOL arguments to target specific tools."}, - {Key: FlagLockGlobal, Short: "Target only global config lockfiles (~/.config/mise/mise.lock and system config)", Long: "Target only global config lockfiles (~/.config/mise/mise.lock and system config)\nBy default, only the active project config root is locked"}, + {Key: FlagLockGlobal, Short: "Target only global config lockfiles (~/.config/mise/mise.lock and system config)\nBy default, only the active project config root is locked", Long: "Target only global config lockfiles (~/.config/mise/mise.lock and system config)\nBy default, only the active project config root is locked"}, {Key: FlagLockJobs, ValueName: "JOBS", ValueDemanded: true, Short: "Number of jobs to run in parallel", Long: "Number of jobs to run in parallel"}, {Key: FlagLockDryRun, Short: "Show what would be updated without making changes", Long: "Show what would be updated without making changes"}, - {Key: FlagLockPlatform, Repeatable: true, ValueName: "PLATFORM", ValueDemanded: true, Short: "Comma-separated list of platforms to target", Long: "Comma-separated list of platforms to target\ne.g.: linux-x64,macos-arm64,windows-x64\nIf not specified, all platforms already in lockfile will be updated"}, + {Key: FlagLockPlatform, Repeatable: true, ValueName: "PLATFORM", ValueDemanded: true, Short: "Comma-separated list of platforms to target\ne.g.: linux-x64,macos-arm64,windows-x64\nIf not specified, all platforms already in lockfile will be updated", Long: "Comma-separated list of platforms to target\ne.g.: linux-x64,macos-arm64,windows-x64\nIf not specified, all platforms already in lockfile will be updated"}, {Key: FlagLockBump, Short: "Re-resolve fuzzy version selectors against the latest available versions", Long: "Re-resolve fuzzy version selectors against the latest available versions\n\nBy default, `mise lock` refreshes metadata for the currently locked versions.\nWith this flag, selectors like \"latest\", \"lts\", or prefixes like \"20\" are\nre-resolved against the latest matching remote versions, so the lockfile\nadvances without installing anything. Config files are never modified:\nexactly pinned versions resolve to themselves and stay unchanged\n(use `mise upgrade --bump` to rewrite pins in mise.toml)."}, {Key: FlagLockJson, Short: "Output version changes as JSON", Long: "Output version changes as JSON\n\nPrints an array of objects describing lockfile version changes:\nname, backend, lockfile, old_versions, new_versions.\nVersion lists keep config/lockfile order; they are not sorted.\nOnly version-level changes are reported: checksum/URL refreshes for\nunchanged versions produce no entries, so plain `mise lock --json`\ntypically prints `[]` while still updating the lockfile.\nSuppresses the human-readable output. Combine with `--dry-run` to\ndetect available updates without writing the lockfile."}, - {Key: FlagLockLocal, Short: "Update mise.local.lock instead of mise.lock", Long: "Update mise.local.lock instead of mise.lock\nUse for tools defined in .local.toml configs"}, + {Key: FlagLockLocal, Short: "Update mise.local.lock instead of mise.lock\nUse for tools defined in .local.toml configs", Long: "Update mise.local.lock instead of mise.lock\nUse for tools defined in .local.toml configs"}, {Key: FlagLockMinimumReleaseAge, ValueName: "MINIMUM_RELEASE_AGE", ValueDemanded: true, Short: "Only lock versions released before this age or date", Long: "Only lock versions released before this age or date\n\nSupports absolute dates like \"2024-06-01\" and relative durations like \"90d\" or \"1y\".\nThis only affects fuzzy version matches like \"20\" or \"latest\".\nExplicitly pinned versions like \"22.5.0\" are not filtered.\nExisting matching lockfile entries are preserved and are not downgraded solely by this flag."}, - {Key: ArgLockTool, Short: "Tool(s) to update in lockfile", Long: "Tool(s) to update in lockfile\ne.g.: node python\nIf not specified, all tools in lockfile will be updated"}, - {Key: CmdLs, Short: "List installed and active tool versions", Long: "List installed and active tool versions\n\nThis command lists tools that mise \"knows about\".\nThese may be tools that are currently installed, or those\nthat are in a config file (active) but may or may not be installed.\n\nIt's a useful command to get the current state of your tools."}, + {Key: ArgLockTool, Short: "Tool(s) to update in lockfile\ne.g.: node python\nIf not specified, all tools in lockfile will be updated", Long: "Tool(s) to update in lockfile\ne.g.: node python\nIf not specified, all tools in lockfile will be updated"}, + {Key: CmdLs, Short: "List installed and active tool versions", Long: "List installed and active tool versions\n\nThis command lists tools that mise \"knows about\".\nThese may be tools that are currently installed, or those\nthat are in a config file (active) but may or may not be installed.\n\nIt's a useful command to get the current state of your tools.", VisibleAliases: []string{"list"}}, {Key: FlagLsCurrent, Short: "Only show tool versions currently specified in a mise.toml", Long: "Only show tool versions currently specified in a mise.toml"}, {Key: FlagLsGlobal, Short: "Only show tool versions currently specified in the global mise.toml", Long: "Only show tool versions currently specified in the global mise.toml"}, {Key: FlagLsInstalled, Short: "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)", Long: "Only show tool versions that are installed (Hides tools defined in mise.toml but not installed)"}, @@ -5391,15 +5391,15 @@ var HelpText = argv.HelpTable{ {Key: FlagLsRemoteMinimumReleaseAge, ValueName: "MINIMUM_RELEASE_AGE", ValueDemanded: true, Short: "Only show versions released before this age or date", Long: "Only show versions released before this age or date\n\nSupports absolute dates like \"2024-06-01\" and relative durations like \"90d\" or \"1y\"."}, {Key: FlagLsRemoteJson, Short: "Output in JSON format (includes version metadata like created_at timestamps when available)", Long: "Output in JSON format (includes version metadata like created_at timestamps when available)"}, {Key: FlagLsRemoteNoVersionsHost, Short: "Disable checking the mise-versions host", Long: "Disable checking the mise-versions host"}, - {Key: FlagLsRemotePrerelease, Short: "Include pre-release versions in the output for backends that report", Long: "Include pre-release versions in the output for backends that report\nupstream prerelease metadata or opt in to regex-based prerelease\ndetection. Equivalent to setting `MISE_PRERELEASES=1` or the\n`prereleases` setting for the duration of this command."}, + {Key: FlagLsRemotePrerelease, Short: "Include pre-release versions in the output for backends that report\nupstream prerelease metadata or opt in to regex-based prerelease\ndetection. Equivalent to setting `MISE_PRERELEASES=1` or the\n`prereleases` setting for the duration of this command.", Long: "Include pre-release versions in the output for backends that report\nupstream prerelease metadata or opt in to regex-based prerelease\ndetection. Equivalent to setting `MISE_PRERELEASES=1` or the\n`prereleases` setting for the duration of this command."}, {Key: FlagLsRemoteStrictMetadata, Short: "Fail if release metadata fetches fail", Long: "Fail if release metadata fetches fail\n\nRequires --json and --no-versions-host.\n\nThis prevents metadata consumers from accepting empty fallback results\nwhen a backend's metadata-producing upstream request fails."}, {Key: ArgLsRemoteToolVersion, Short: "Tool to get versions for", Long: "Tool to get versions for"}, - {Key: ArgLsRemotePrefix, Short: "The version prefix to use when querying the latest version", Long: "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\""}, + {Key: ArgLsRemotePrefix, Short: "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\"", Long: "The version prefix to use when querying the latest version\nsame as the first argument after the \"@\""}, {Key: CmdMcp, Short: "Run Model Context Protocol (MCP) server", Long: "Run Model Context Protocol (MCP) server\n\nThis command starts an MCP server that exposes mise functionality\nto AI assistants over stdin/stdout using JSON-RPC protocol.\n\nThe MCP server provides access to:\n- Installed and available tools\n- Task definitions and execution\n- Environment variables\n- Configuration information\n- Task execution via the run_task tool\n\nResources available:\n- mise://tools - List all tools (use ?include_inactive=true to include inactive tools)\n- mise://tasks - List all tasks with their configurations\n- mise://env - List all environment variables\n- mise://config - Show configuration files and project root\n\nTools available:\n- list_commands - Every mise command, with its declared effect on the world\n- install_tool - Install a tool with an optional version (not yet implemented)\n- run_task - Execute a mise task with optional arguments\n\nNote: This is primarily intended for integration with AI assistants like Claude,\nCursor, or other tools that support the Model Context Protocol."}, {Key: CmdOci, Short: "[experimental] Build OCI container images from a mise.toml", Long: "[experimental] Build OCI container images from a mise.toml\n\nEach tool becomes its own OCI layer, so bumping any single tool version\nonly invalidates one content-addressable blob — unlike a Dockerfile where\nchanging an early `RUN` invalidates every layer above it.\n\nThis command is experimental and requires `mise settings experimental=true`\n(or `MISE_EXPERIMENTAL=1`). Behavior, flags, and output layout may change\nin future releases."}, {Key: CmdOciBuild, Short: "[experimental] Build an OCI image from the current mise.toml", Long: "[experimental] Build an OCI image from the current mise.toml\n\nEach tool version becomes its own content-addressable OCI layer. Bumping a\ntool version only invalidates that tool's layer — other tools, the base\nimage, and config are reused unchanged. The output directory conforms to\nthe OCI image-layout spec and can be consumed by `skopeo`, `crane`, or\n`podman load`.\n\nRequires `mise settings experimental=true` (or `MISE_EXPERIMENTAL=1`)."}, {Key: FlagOciBuildCopy, Repeatable: true, ValueName: "HOST_PATH:IMAGE_PATH", ValueDemanded: true, Short: "Copy a host file, directory, or symlink into the image (repeatable, HOST:IMAGE)", Long: "Copy a host file, directory, or symlink into the image (repeatable, HOST:IMAGE)"}, - {Key: FlagOciBuildOutput, ValueName: "OUTPUT", ValueDemanded: true, Short: "Output directory for the OCI image layout", Long: "Output directory for the OCI image layout"}, + {Key: FlagOciBuildOutput, ValueName: "OUTPUT", ValueDemanded: true, Short: "Output directory for the OCI image layout", Long: "Output directory for the OCI image layout", Default: []string{"./mise-oci"}}, {Key: FlagOciBuildFrom, ValueName: "FROM", ValueDemanded: true, Short: "Base image reference (overrides [oci].from and the oci.default_from setting)", Long: "Base image reference (overrides [oci].from and the oci.default_from setting)"}, {Key: FlagOciBuildIncludeGlobal, Short: "Also include tools from the global / system config (default: project-only)", Long: "Also include tools from the global / system config (default: project-only)\n\nBy default `mise oci build` only packages tools declared in the project's mise config (and any parent configs at-or-below the project root, e.g. a monorepo root config). Personal dev tools in `~/.config/mise/config.toml` are excluded so they don't bake into a project image. Pass `--include-global` to revert to the old \"merge all loaded configs\" behavior."}, {Key: FlagOciBuildTag, ValueName: "TAG", ValueDemanded: true, Short: "Tag to record in the image index (the org.opencontainers.image.ref.name annotation)", Long: "Tag to record in the image index (the org.opencontainers.image.ref.name annotation)"}, @@ -5418,7 +5418,7 @@ var HelpText = argv.HelpTable{ {Key: FlagOciPushUpdateIndex, Short: "Maintain the tag as a multi-arch image index", Long: "Maintain the tag as a multi-arch image index\n\nPushes this build's manifest by digest and points the tag at an OCI image index containing one entry per platform, preserving entries other architectures pushed. Run `mise oci push --update-index` from one runner per platform to assemble a multi-arch tag."}, {Key: ArgOciPushRef, Demanded: true, Short: "Destination registry reference (e.g. `ghcr.io/me/devenv:latest`)", Long: "Destination registry reference (e.g. `ghcr.io/me/devenv:latest`)"}, {Key: CmdOciRun, Short: "[experimental] Build an OCI image from the current mise.toml and run a command in it", Long: "[experimental] Build an OCI image from the current mise.toml and run a command in it\n\nEquivalent to `mise oci build` followed by `docker run` / `podman run`.\nThe built image is loaded into the local container engine (podman pulls\nthe OCI layout natively; docker receives it via `docker load`) and the\ngiven command is executed inside it with stdin/stdout/stderr inherited.\n\nRequires `mise settings experimental=true` (or `MISE_EXPERIMENTAL=1`) and\none of: `podman`, `docker`."}, - {Key: FlagOciRunEngine, ValueName: "ENGINE", ValueDemanded: true, Short: "Container engine to use (`auto`, `podman`, or `docker`)", Long: "Container engine to use (`auto`, `podman`, or `docker`)"}, + {Key: FlagOciRunEngine, ValueName: "ENGINE", ValueDemanded: true, Short: "Container engine to use (`auto`, `podman`, or `docker`)", Long: "Container engine to use (`auto`, `podman`, or `docker`)", Choices: []string{"auto", "podman", "docker"}, Default: []string{"auto"}}, {Key: FlagOciRunFrom, ValueName: "FROM", ValueDemanded: true, Short: "Base image reference for the build (ignored with --image-dir)", Long: "Base image reference for the build (ignored with --image-dir)"}, {Key: FlagOciRunImageDir, ValueName: "IMAGE_DIR", ValueDemanded: true, Short: "Use an already-built OCI image layout instead of building fresh", Long: "Use an already-built OCI image layout instead of building fresh"}, {Key: FlagOciRunIncludeGlobal, Short: "Also include tools from the global / system config (default: project-only)", Long: "Also include tools from the global / system config (default: project-only)\n\nSee `mise oci build --help` for details."}, @@ -5439,46 +5439,46 @@ var HelpText = argv.HelpTable{ {Key: FlagOutdatedLocal, Short: "Only show outdated tools defined in local config files", Long: "Only show outdated tools defined in local config files\n\nThis will only show tools that are defined in project-local mise.toml and\nwill skip tools defined in the global config (~/.config/mise/config.toml)."}, {Key: FlagOutdatedMonorepo, Short: "Placeholder for future monorepo outdated checks; `mise outdated --monorepo` is not implemented yet.", Long: "Placeholder for future monorepo outdated checks; `mise outdated --monorepo` is not implemented yet."}, {Key: FlagOutdatedNoHeader, Short: "Don't show table header", Long: "Don't show table header"}, - {Key: ArgOutdatedToolVersion, Short: "Tool(s) to show outdated versions for", Long: "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"}, + {Key: ArgOutdatedToolVersion, Short: "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", Long: "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"}, {Key: CmdPatrons, Short: "Show the individuals supporting mise as Patron-tier members", Long: "Show the individuals supporting mise as Patron-tier members\n\nLists the individuals on the Patron tier from .\nThe list refreshes daily; supporting terminals will render each patron's\nname as a clickable link via OSC 8 hyperlinks.\n\nTo appear here, become a patron at ."}, {Key: FlagPatronsJson, Short: "Output in JSON format", Long: "Output in JSON format"}, {Key: FlagPatronsRefresh, Short: "Bypass the local cache and re-fetch", Long: "Bypass the local cache and re-fetch"}, - {Key: CmdPlugins, Short: "Manage plugins"}, + {Key: CmdPlugins, Short: "Manage plugins", VisibleAliases: []string{"p"}}, {Key: FlagPluginsAll, Hide: true, Short: "list all available remote plugins", Long: "list all available remote plugins\n\nsame as `mise plugins ls-remote`"}, - {Key: FlagPluginsCore, Short: "The built-in plugins only", Long: "The built-in plugins only\nNormally these are not shown"}, - {Key: FlagPluginsUrls, Short: "Show the git url for each plugin", Long: "Show the git url for each plugin\ne.g.: https://github.com/mise-plugins/vfox-cmake.git"}, - {Key: FlagPluginsRefs, Hide: true, Short: "Show the git refs for each plugin", Long: "Show the git refs for each plugin\ne.g.: main 1234abc"}, + {Key: FlagPluginsCore, Short: "The built-in plugins only\nNormally these are not shown", Long: "The built-in plugins only\nNormally these are not shown"}, + {Key: FlagPluginsUrls, Short: "Show the git url for each plugin\ne.g.: https://github.com/mise-plugins/vfox-cmake.git", Long: "Show the git url for each plugin\ne.g.: https://github.com/mise-plugins/vfox-cmake.git"}, + {Key: FlagPluginsRefs, Hide: true, Short: "Show the git refs for each plugin\ne.g.: main 1234abc", Long: "Show the git refs for each plugin\ne.g.: main 1234abc"}, {Key: FlagPluginsUser, Short: "List installed plugins", Long: "List installed plugins\n\nThis is the default behavior but can be used with --core\nto show core and user plugins"}, - {Key: CmdPluginsInstall, Short: "Install a plugin", Long: "Install a plugin\n\nnote that mise can automatically install plugins when you install a tool\ne.g.: `mise install cmake@3.30` will autoinstall the cmake plugin\n\nThis behavior can be modified in ~/.config/mise/config.toml"}, - {Key: FlagPluginsInstallAll, Short: "Install all missing plugins", Long: "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url"}, + {Key: CmdPluginsInstall, Short: "Install a plugin", Long: "Install a plugin\n\nnote that mise can automatically install plugins when you install a tool\ne.g.: `mise install cmake@3.30` will autoinstall the cmake plugin\n\nThis behavior can be modified in ~/.config/mise/config.toml", VisibleAliases: []string{"i", "a", "add"}}, + {Key: FlagPluginsInstallAll, Short: "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url", Long: "Install all missing plugins\nThis will only install plugins that have matching shorthands.\ni.e.: they don't need the full git repo url"}, {Key: FlagPluginsInstallForce, Short: "Reinstall even if plugin exists", Long: "Reinstall even if plugin exists"}, {Key: FlagPluginsInstallJobs, ValueName: "JOBS", ValueDemanded: true, Short: "Number of jobs to run in parallel", Long: "Number of jobs to run in parallel"}, {Key: FlagPluginsInstallVerbose, Repeatable: true, Short: "Show installation output", Long: "Show installation output"}, - {Key: ArgPluginsInstallNewPlugin, Short: "The name of the plugin to install", Long: "The name of the plugin to install\ne.g.: cmake, poetry\nCan specify multiple plugins: `mise plugins install cmake poetry`"}, + {Key: ArgPluginsInstallNewPlugin, Short: "The name of the plugin to install\ne.g.: cmake, poetry\nCan specify multiple plugins: `mise plugins install cmake poetry`", Long: "The name of the plugin to install\ne.g.: cmake, poetry\nCan specify multiple plugins: `mise plugins install cmake poetry`"}, {Key: ArgPluginsInstallGitUrl, Short: "The git url of the plugin", Long: "The git url of the plugin"}, {Key: ArgPluginsInstallRest, Hide: true}, - {Key: CmdPluginsLink, Short: "Symlinks a plugin into mise", Long: "Symlinks a plugin into mise\n\nThis is used for developing a plugin."}, + {Key: CmdPluginsLink, Short: "Symlinks a plugin into mise", Long: "Symlinks a plugin into mise\n\nThis is used for developing a plugin.", VisibleAliases: []string{"ln"}}, {Key: FlagPluginsLinkForce, Short: "Overwrite existing plugin", Long: "Overwrite existing plugin"}, - {Key: ArgPluginsLinkName, Demanded: true, Short: "The name of the plugin", Long: "The name of the plugin\ne.g.: cmake, poetry"}, - {Key: ArgPluginsLinkDir, Short: "The local path to the plugin", Long: "The local path to the plugin\ne.g.: ./vfox-cmake"}, - {Key: CmdPluginsLs, Short: "List installed plugins", Long: "List installed plugins\n\nCan also show remotely available plugins to install."}, - {Key: FlagPluginsLsAll, Hide: true, Short: "List all available remote plugins", Long: "List all available remote plugins\nSame as `mise plugins ls-remote`"}, - {Key: FlagPluginsLsCore, Hide: true, Short: "The built-in plugins only", Long: "The built-in plugins only\nNormally these are not shown"}, - {Key: FlagPluginsLsOutdated, Short: "Show plugins with available updates", Long: "Show plugins with available updates\nChecks the remote for newer versions and only displays plugins that are outdated"}, - {Key: FlagPluginsLsUrls, Short: "Show the git url for each plugin", Long: "Show the git url for each plugin\ne.g.: https://github.com/mise-plugins/vfox-cmake.git"}, - {Key: FlagPluginsLsRefs, Hide: true, Short: "Show the git refs for each plugin", Long: "Show the git refs for each plugin\ne.g.: main 1234abc"}, + {Key: ArgPluginsLinkName, Demanded: true, Short: "The name of the plugin\ne.g.: cmake, poetry", Long: "The name of the plugin\ne.g.: cmake, poetry"}, + {Key: ArgPluginsLinkDir, Short: "The local path to the plugin\ne.g.: ./vfox-cmake", Long: "The local path to the plugin\ne.g.: ./vfox-cmake"}, + {Key: CmdPluginsLs, Short: "List installed plugins", Long: "List installed plugins\n\nCan also show remotely available plugins to install.", VisibleAliases: []string{"list"}}, + {Key: FlagPluginsLsAll, Hide: true, Short: "List all available remote plugins\nSame as `mise plugins ls-remote`", Long: "List all available remote plugins\nSame as `mise plugins ls-remote`"}, + {Key: FlagPluginsLsCore, Hide: true, Short: "The built-in plugins only\nNormally these are not shown", Long: "The built-in plugins only\nNormally these are not shown"}, + {Key: FlagPluginsLsOutdated, Short: "Show plugins with available updates\nChecks the remote for newer versions and only displays plugins that are outdated", Long: "Show plugins with available updates\nChecks the remote for newer versions and only displays plugins that are outdated"}, + {Key: FlagPluginsLsUrls, Short: "Show the git url for each plugin\ne.g.: https://github.com/mise-plugins/vfox-cmake.git", Long: "Show the git url for each plugin\ne.g.: https://github.com/mise-plugins/vfox-cmake.git"}, + {Key: FlagPluginsLsRefs, Hide: true, Short: "Show the git refs for each plugin\ne.g.: main 1234abc", Long: "Show the git refs for each plugin\ne.g.: main 1234abc"}, {Key: FlagPluginsLsUser, Hide: true, Short: "List installed plugins", Long: "List installed plugins"}, - {Key: CmdPluginsLsRemote, Short: "List all available remote plugins", Long: "\nList all available remote plugins\n\nThe full list is here: https://github.com/jdx/mise/blob/main/registry/\n\nExamples:\n\n $ mise plugins ls-remote\n"}, + {Key: CmdPluginsLsRemote, Short: "List all available remote plugins", Long: "\nList all available remote plugins\n\nThe full list is here: https://github.com/jdx/mise/blob/main/registry/\n\nExamples:\n\n $ mise plugins ls-remote\n", VisibleAliases: []string{"list-remote", "list-all"}}, {Key: FlagPluginsLsRemoteUrls, Short: "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git", Long: "Show the git url for each plugin e.g.: https://github.com/mise-plugins/mise-poetry.git"}, {Key: FlagPluginsLsRemoteOnlyNames, Short: "Only show the name of each plugin by default it will show a \"*\" next to installed plugins", Long: "Only show the name of each plugin by default it will show a \"*\" next to installed plugins"}, - {Key: CmdPluginsUninstall, Short: "Removes a plugin"}, + {Key: CmdPluginsUninstall, Short: "Removes a plugin", VisibleAliases: []string{"remove", "rm"}}, {Key: FlagPluginsUninstallAll, Short: "Remove all plugins", Long: "Remove all plugins"}, {Key: FlagPluginsUninstallPurge, Short: "Also remove the plugin's installs, downloads, and cache", Long: "Also remove the plugin's installs, downloads, and cache"}, {Key: ArgPluginsUninstallPlugin, Short: "Plugin(s) to remove", Long: "Plugin(s) to remove"}, - {Key: CmdPluginsUpdate, Short: "Updates a plugin to the latest version", Long: "Updates a plugin to the latest version\n\nnote: this updates the plugin itself, not the runtime versions"}, - {Key: FlagPluginsUpdateJobs, ValueName: "JOBS", ValueDemanded: true, Short: "Number of jobs to run in parallel", Long: "Number of jobs to run in parallel\nDefault: 4"}, + {Key: CmdPluginsUpdate, Short: "Updates a plugin to the latest version", Long: "Updates a plugin to the latest version\n\nnote: this updates the plugin itself, not the runtime versions", VisibleAliases: []string{"up", "upgrade"}}, + {Key: FlagPluginsUpdateJobs, ValueName: "JOBS", ValueDemanded: true, Short: "Number of jobs to run in parallel\nDefault: 4", Long: "Number of jobs to run in parallel\nDefault: 4"}, {Key: ArgPluginsUpdatePlugin, Short: "Plugin(s) to update", Long: "Plugin(s) to update"}, - {Key: CmdDeps, Short: "[experimental] Manage project dependencies", Long: "[experimental] Manage project dependencies\n\nRuns all applicable dependency install steps for the current project.\nThis checks if dependency lockfiles are newer than installed outputs\n(e.g., package-lock.json vs node_modules/) and runs install commands\nif needed.\n\nProviders with `auto = true` are automatically invoked before `mise x` and `mise run`\nunless skipped with the --no-deps flag."}, + {Key: CmdDeps, Short: "[experimental] Manage project dependencies", Long: "[experimental] Manage project dependencies\n\nRuns all applicable dependency install steps for the current project.\nThis checks if dependency lockfiles are newer than installed outputs\n(e.g., package-lock.json vs node_modules/) and runs install commands\nif needed.\n\nProviders with `auto = true` are automatically invoked before `mise x` and `mise run`\nunless skipped with the --no-deps flag.", VisibleAliases: []string{"dep"}}, {Key: FlagDepsExplain, Short: "Show why a provider is fresh or stale (requires a provider argument)", Long: "Show why a provider is fresh or stale (requires a provider argument)"}, {Key: FlagDepsForce, Short: "Force run all deps steps even if outputs are fresh", Long: "Force run all deps steps even if outputs are fresh"}, {Key: FlagDepsDryRun, Short: "Only check if deps install is needed, don't run commands", Long: "Only check if deps install is needed, don't run commands"}, @@ -5520,24 +5520,24 @@ var HelpText = argv.HelpTable{ {Key: FlagReshimForce, Short: "Removes all shims before reshimming", Long: "Removes all shims before reshimming"}, {Key: ArgReshimTool, Hide: true}, {Key: ArgReshimVersion, Hide: true}, - {Key: CmdRun, Short: "Run task(s)", Long: "Run task(s)\n\nThis command will run a task, or multiple tasks in parallel.\nTasks may have dependencies on other tasks or on source files.\nIf source is configured on a task, it will only run if the source\nfiles have changed.\n\nTasks can be defined in mise.toml or as standalone scripts.\nIn mise.toml, tasks take this form:\n\n [tasks.build]\n run = \"npm run build\"\n sources = [\"src/**/*.ts\"]\n outputs = [\"dist/**/*.js\"]\n\nAlternatively, tasks can be defined as standalone scripts.\nThese must be located in `mise-tasks`, `.mise-tasks`, `.mise/tasks`, `mise/tasks` or\n`.config/mise/tasks`.\nThe name of the script will be the name of the tasks.\n\n $ cat .mise/tasks/build<