miller/pkg/output
John Kerl 78363f1cc3
DKVPX reader: honor --ifs and --ips instead of hard-coding comma and equals (#2172)
The DKVPX record reader set dkvpxReader.Comma = ',' unconditionally,
ignoring the resolved --ifs value; the key-value separator '=' was
likewise hard-coded in the dkvpx parser, ignoring --ips. So e.g.

  printf 'a=1;b=2\n' | mlr -i dkvpx --ifs semicolon --ojson cat

produced a single field {"a": "1;b=2"} instead of {"a": 1, "b": 2}.

Fixes:

* pkg/dkvpx.Reader gains an Equals field (default '=') alongside Comma.
* The DKVPX record reader now passes the resolved IFS/IPS through,
  validating that each is a single character (mirroring the CSV
  reader's "IFS can only be a single character" error) rather than
  silently ignoring or truncating them.
* The DKVPX record writer already emitted OFS/OPS, but its quoting
  decisions were based on the default separators, so with --ofs
  semicolon a value containing ';' went out unquoted (ambiguous) while
  a value containing ',' was quoted needlessly. Quoting now keys off
  the actual OFS/OPS.

Adds unit tests, regression cases under test/cases/io-dkvpx/, and a
note in the separators reference table.

Discovered while investigating #369; tracked in #2170.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 17:37:07 -04:00
..
channel_writer.go Lint round 5+6: staticcheck and errcheck to zero (#2130) 2026-07-03 11:42:08 -04:00
doc.go Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
file_output_handlers.go Add mlr mcp MCP server + agent playbook, with a --no-shell gate (#2098 PR7) (#2133) 2026-07-03 19:41:49 -04:00
README.md Export library code in pkg/ (#1391) 2023-09-10 17:15:13 -04:00
record_writer.go The package version must match the major tag version (#1654) 2024-09-20 12:10:11 -04:00
record_writer_csv.go Honor --ors crlf for CSV output (#1810) (#2150) 2026-07-05 20:35:32 -04:00
record_writer_csv_colorizer.go Multiple style updates (#1974) 2026-02-16 15:49:21 -05:00
record_writer_csv_test.go Honor --ors crlf for CSV output (#1810) (#2150) 2026-07-05 20:35:32 -04:00
record_writer_csvlite.go The package version must match the major tag version (#1654) 2024-09-20 12:10:11 -04:00
record_writer_dcf.go Some fixes for staticcheck (#2006) 2026-03-03 09:27:03 -05:00
record_writer_dkvp.go The package version must match the major tag version (#1654) 2024-09-20 12:10:11 -04:00
record_writer_dkvpx.go DKVPX reader: honor --ifs and --ips instead of hard-coding comma and equals (#2172) 2026-07-06 17:37:07 -04:00
record_writer_factory.go Add DKVPX file format (#2002) 2026-03-02 22:35:08 -05:00
record_writer_json_jsonl.go Fix govet lint findings; fix masked unset-on-array error path (#2129) 2026-07-03 10:31:08 -04:00
record_writer_markdown.go Right-align headers over all-numeric columns with --right-align-numeric (#380) (#2167) 2026-07-06 16:45:14 -04:00
record_writer_nidx.go The package version must match the major tag version (#1654) 2024-09-20 12:10:11 -04:00
record_writer_pprint.go Right-align headers over all-numeric columns with --right-align-numeric (#380) (#2167) 2026-07-06 16:45:14 -04:00
record_writer_tsv.go Honor --ors crlf for CSV output (#1810) (#2150) 2026-07-05 20:35:32 -04:00
record_writer_xtab.go Fix column alignment for wide and combining Unicode chars (#1520, #379) (#2061) 2026-05-17 12:12:54 -04:00
record_writer_yaml.go fix: preserve key order in YAML output (#2034) 2026-04-12 09:43:09 -04:00

Logic for formatting output records as strings to standard output.

There is one record-writer type per supported output file format, and a factory method.