mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-17 16:38:54 +00:00
DKVP --incr-key option (#1839)
* Code support for --incr-key * Add source code for online help for new flag * Run `make dev`
This commit is contained in:
parent
d264f562dc
commit
fccdf215e6
9 changed files with 119 additions and 13 deletions
|
|
@ -104,6 +104,7 @@ var FLAG_TABLE = FlagTable{
|
|||
&CSVTSVOnlyFlagSection,
|
||||
&JSONOnlyFlagSection,
|
||||
&PPRINTOnlyFlagSection,
|
||||
&DKVPOnlyFlagSection,
|
||||
&CompressedDataFlagSection,
|
||||
&CommentsInDataFlagSection,
|
||||
&OutputColorizationFlagSection,
|
||||
|
|
@ -523,6 +524,31 @@ var PPRINTOnlyFlagSection = FlagSection{
|
|||
},
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// DKVP-ONLY FLAGS
|
||||
|
||||
func DKVPOnlyPrintInfo() {
|
||||
fmt.Println("These are flags which are applicable to DKVP format.")
|
||||
}
|
||||
|
||||
func init() { DKVPOnlyFlagSection.Sort() }
|
||||
|
||||
var DKVPOnlyFlagSection = FlagSection{
|
||||
name: "DKVP-only flags",
|
||||
infoPrinter: DKVPOnlyPrintInfo,
|
||||
flags: []Flag{
|
||||
|
||||
{
|
||||
name: "--incr-key",
|
||||
help: "Without this option, keyless DKVP fields are keyed by field number. For example: `a=10,b=20,30,d=40,50` is ingested as `$a=10,$b=20,$3=30,$d=40,$5=50`. With this option, they're keyed by a running counter of keyless fields. For example: `a=10,b=20,30,d=40,50` is ingested as `$a=10,$b=20,$1=30,$d=40,$2=50`.",
|
||||
parser: func(args []string, argc int, pargi *int, options *TOptions) {
|
||||
options.WriterOptions.BarredPprintOutput = true
|
||||
*pargi += 1
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// LEGACY FLAGS
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue