mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-18 00:45:47 +00:00
Add DCF (Debian Control Format) as supported file type (#1970)
* reader * record writer * pkg/output/record_writer_dcf.go * test/input/test.dcf * test/cases/io-dcf/ * pkg/cli/option_parse.go * make fmt * make dev * docs and `make dev`
This commit is contained in:
parent
a5f4c9d895
commit
daae7ff7f0
44 changed files with 579 additions and 29 deletions
|
|
@ -61,7 +61,8 @@ package cli
|
|||
func DecideFinalFlatten(writerOptions *TWriterOptions) bool {
|
||||
ofmt := writerOptions.OutputFileFormat
|
||||
if writerOptions.AutoFlatten {
|
||||
if ofmt != "json" {
|
||||
// Preserve nested/array structure for formats that support it.
|
||||
if ofmt != "json" && ofmt != "jsonl" && ofmt != "dcf" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -787,6 +787,15 @@ var FileFormatFlagSection = FlagSection{
|
|||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--idcf",
|
||||
help: "Use Debian control file (DCF) format for input data.",
|
||||
parser: func(args []string, argc int, pargi *int, options *TOptions) {
|
||||
options.ReaderOptions.InputFileFormat = "dcf"
|
||||
*pargi += 1
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--inidx",
|
||||
help: "Use NIDX format for input data.",
|
||||
|
|
@ -1021,6 +1030,15 @@ var FileFormatFlagSection = FlagSection{
|
|||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--odcf",
|
||||
help: "Use Debian control file (DCF) format for output data.",
|
||||
parser: func(args []string, argc int, pargi *int, options *TOptions) {
|
||||
options.WriterOptions.OutputFileFormat = "dcf"
|
||||
*pargi += 1
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--onidx",
|
||||
help: "Use NIDX format for output data.",
|
||||
|
|
@ -1200,6 +1218,16 @@ var FileFormatFlagSection = FlagSection{
|
|||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--dcf",
|
||||
help: "Use Debian control file (DCF) format for input and output data.",
|
||||
parser: func(args []string, argc int, pargi *int, options *TOptions) {
|
||||
options.ReaderOptions.InputFileFormat = "dcf"
|
||||
options.WriterOptions.OutputFileFormat = "dcf"
|
||||
*pargi += 1
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--nidx",
|
||||
help: "Use NIDX format for input and output data.",
|
||||
|
|
@ -1252,7 +1280,7 @@ var FileFormatFlagSection = FlagSection{
|
|||
func FormatConversionKeystrokeSaverPrintInfo() {
|
||||
fmt.Println(`As keystroke-savers for format-conversion you may use the following.
|
||||
The letters c, t, j, l, d, n, x, p, m, and y refer to formats CSV, TSV, JSON, JSON Lines,
|
||||
DKVP, NIDX, XTAB, PPRINT, markdown, and YAML, respectively.
|
||||
DKVP, NIDX, XTAB, PPRINT, markdown, and YAML, respectively. DCF is also supported (use --dcf for DCF in and out).
|
||||
|
||||
| In\out | CSV | TSV | JSON | JSONL | DKVP | NIDX | XTAB | PPRINT | Markdown | YAML |
|
||||
+----------+----------+----------+----------+-------+-------+-------+-------+--------+----------+--------+
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ var defaultFSes = map[string]string{
|
|||
"dkvp": ",",
|
||||
"json": "N/A", // not alterable; not parameterizable in JSON format
|
||||
"yaml": "N/A",
|
||||
"dcf": "N/A",
|
||||
"nidx": " ",
|
||||
"markdown": " ",
|
||||
"pprint": " ",
|
||||
|
|
@ -102,6 +103,7 @@ var defaultPSes = map[string]string{
|
|||
"dkvp": "=",
|
||||
"json": "N/A", // not alterable; not parameterizable in JSON format
|
||||
"yaml": "N/A",
|
||||
"dcf": "N/A",
|
||||
"markdown": "N/A",
|
||||
"nidx": "N/A",
|
||||
"pprint": "N/A",
|
||||
|
|
@ -116,6 +118,7 @@ var defaultRSes = map[string]string{
|
|||
"dkvp": "\n",
|
||||
"json": "N/A", // not alterable; not parameterizable in JSON format
|
||||
"yaml": "N/A",
|
||||
"dcf": "N/A",
|
||||
"markdown": "\n",
|
||||
"nidx": "\n",
|
||||
"pprint": "\n",
|
||||
|
|
@ -130,6 +133,7 @@ var defaultAllowRepeatIFSes = map[string]bool{
|
|||
"dkvp": false,
|
||||
"json": false,
|
||||
"yaml": false,
|
||||
"dcf": false,
|
||||
"markdown": false,
|
||||
"nidx": false,
|
||||
"pprint": true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue