mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-17 16:38:54 +00:00
Emit Miller's existing help catalog (verbs, functions, flags, keywords) as structured JSON so AI agents and tooling can model Miller's surface without scraping prose. The --json token may appear anywhere on a `mlr help ...` command line; plain text help is unchanged. mlr help --json # full catalog mlr help verb cat --json # one or more verbs mlr help function splitax --json # one or more functions mlr help flag --ifs --json # one or more flags mlr help keyword ENV --json # one or more keywords Functions and flags serialize fully (name/class/arity/help/examples; section/name/alt_names/arg/help). Verbs carry a summary, ignores_input, and captured raw usage_text as a Tier-1 fallback, since per-verb options are prose-only today (each verb hand-writes its UsageFunc). Structured verb options are a planned follow-on (see #2098). This is a serialization layer over the existing registries -- no refactor of the text-help path. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| doc.go | ||
| errors.go | ||
| flag_json.go | ||
| flag_types.go | ||
| flag_types_test.go | ||
| flatten_unflatten.go | ||
| mlrcli_util.go | ||
| option_parse.go | ||
| option_types.go | ||
| README.md | ||
| separators.go | ||
| verb_utils.go | ||
Datatypes for parsing the Miller command line, and the flags table.
pkg/climainis the flag-parsing logic for supporting Miller's command-line interface. When you type something likemlr --icsv --ojson put '$sum = $a + $b' then filter '$sum > 1000' myfile.csv, it's the CLI parser which makes it possible for Miller to construct a CSV record-reader, a transformer chain ofputthenfilter, and a JSON record-writer.pkg/clicontains datatypes and the flags table for the CLI-parser, which was split out to avoid a Go package-import cycle.