miller/go/src/cli
2021-03-31 20:11:21 -04:00
..
mlrcli.go Neatens for parser-experimental, and go test ./... 2021-03-24 00:07:20 -04:00
mlrcli_parse.go Port mlr --help-function foo from C to Go 2021-03-31 20:11:21 -04:00
mlrcli_transformers.go Port top verb from C to Go 2021-03-17 00:49:27 -04:00
mlrcli_usage.go Regression-test v2 infra (#462) 2021-03-31 01:03:59 -04:00
README.md more of same 2021-02-14 01:25:32 -05:00

Logic for parsing the Miller command line.

  • src/cli is the flag-parsing logic for supporting Miller's command-line interface. When you type something like mlr --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 of put then filter, and a JSON record-writer.
  • src/cliutil contains datatypes for the CLI-parser, which was split out to avoid a Go package-import cycle.
  • I don't use the Go flag package here, although I do use it within the transformers' subcommand flag-handling. The flag package is quite fine; Miller's command-line processing is multi-purpose between serving CLI needs per se as well as for manpage/docfile generation, and I found it simplest to roll my own command-line handling here.