Skip to main content

Module flagset

Module flagset 

Source
Expand description

Named sets of flag declarations, and the use node that pulls one in.

mise’s checked-in spec is 5,592 lines for 711 flags, and most of that count is the same handful of declarations written again under the next command. The derive has an answer for this — flatten — and a hand-written spec had none.

A flagset is authoring sugar, resolved while the file is read:

flagset "output" {
    flag "-v --verbose" help="Print more"
    flag "--json" help="JSON output"
}

cmd "build" {
    use "output"
    flag "--release"
}

By the time anything downstream sees the spec, build holds three ordinary flags in that order. Nothing else in the model, in help, in completions or in the generated parsers learns a new concept, which is the point: the same rule the derive follows, that a spec is the semantic model, means reuse has to disappear into what it stands for rather than becoming vocabulary every consumer must implement.

The cost of that choice is that it is one-way. A spec parsed and re-emitted contains the expanded flags, not the flagset and use nodes that produced them, the same way include does not survive a round trip.

Structs§

SpecFlagSet
A named, reusable set of flag declarations.
SpecUse
One use node: the flagsets whose declarations belong where it stands.