mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-17 16:38:54 +00:00
By default, Miller treats "true"/"false" and IEEE special floats like "Inf", "Infinity", and "NaN" in data files as strings. This adds two opt-in flags, following the existing -S/-A/-O inference-flag family: * --infer-booleans: treat "true" and "false" (exactly those spellings, matching the DSL's and JSON's boolean literals) as booleans. * --infer-special-floats: treat "Inf", "Infinity", and "NaN" -- case-insensitively, with optional leading +/- on the first two -- as floats. Unlike -S/-A/-O, these don't replace the package-level inferrer; they augment it, so they compose with -A and -O. They intentionally have no effect with -S/--infer-none, which disables type inference entirely. Default behavior is unchanged. Includes unit tests, regression-test cases under test/cases/io-infer-flags/, and documentation updates. Addresses #965. Co-Authored-By: Claude Fable 5 <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.