miller/internal/pkg/climain
John Kerl 7a97c9b868
Performance improvement by JIT type inference (#786)
* JIT mlrval type-interfence: mlrval package

* mlrmap refactor

* complete merge from #779

* iterating

* mlrval/format.go

* mlrval/copy.go

* bifs/arithmetic_test.go

* iterate on bifs/collections_test.go

* mlrval_cmp.go

* mlrval JSON iterate

* iterate applying mlrval refactors to dependent packages

* first clean compile in a long while on this branch

* results of first post-compile profiling

* testing

* bugfix in ofmt formatting

* bugfix in octal-supporess

* go fmt

* neaten

* regression tests all passing
2021-12-20 23:56:04 -05:00
..
doc.go Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00
mlrcli_mlrrc.go More Go-package restructuring (#748) 2021-11-12 12:49:55 -05:00
mlrcli_parse.go Performance improvement by JIT type inference (#786) 2021-12-20 23:56:04 -05:00
mlrcli_shebang.go Fix auto-insert of -- for mlr -s feature (forgotten on previous commit) 2021-11-24 18:21:24 -05:00
README.md Standardize Go-package structure (#746) 2021-11-11 14:15:13 -05:00

Logic for parsing the Miller command line.

  • internal/pkg/climain 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.
  • internal/pkg/cli 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. 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. More importantly, some Miller verbs such as sort take flags more than once -- mlr sort -f field1 -n field2 -f field3 -- which is not supported by the flag package.