Make --jlistwrap / --jvstack as legacy flags, since now --json and --jsonl

This commit is contained in:
John Kerl 2022-01-09 00:04:30 -05:00
parent b048c85a13
commit 44a2e4dc48
8 changed files with 78 additions and 101 deletions

View file

@ -149,7 +149,6 @@ HELP OPTIONS
mlr help file-format-flags
mlr help flatten-unflatten-flags
mlr help format-conversion-keystroke-saver-flags
mlr help json-only-flags
mlr help legacy-flags
mlr help miscellaneous-flags
mlr help output-colorization-flags
@ -436,20 +435,14 @@ FORMAT-CONVERSION KEYSTROKE-SAVER FLAGS
-p Keystroke-saver for `--nidx --fs space --repifs`.
-T Keystroke-saver for `--nidx --fs tab`.
JSON-ONLY FLAGS
These are flags which are applicable to JSON format.
--jlistwrap or --jl Wrap JSON output in outermost `[ ]`.
--jvstack Put one key-value pair per line for JSON output
(multi-line output).
--no-jvstack Put objects/arrays all on one line for JSON output.
LEGACY FLAGS
These are flags which don't do anything in the current Miller version.
They are accepted as no-op flags in order to keep old scripts from breaking.
--jknquoteint Type information from JSON input files is now
preserved throughout the processing stream.
--jlistwrap or --jl Wrap JSON output in outermost `[ ]`. This is the
default for JSON output format.
--jquoteall Type information from JSON input files is now
preserved throughout the processing stream.
--json-fatal-arrays-on-input
@ -461,8 +454,15 @@ LEGACY FLAGS
--jsonx The `--jvstack` flag is now default true in Miller 6.
--jvquoteall Type information from JSON input files is now
preserved throughout the processing stream.
--jvstack Put one key-value pair per line for JSON output
(multi-line output). This is the default for JSON
output format.
--mmap Miller no longer uses memory-mapping to access data
files.
--no-jlistwrap Wrap JSON output in outermost `[ ]`. This is the
default for JSON Lines output format.
--no-jvstack Put objects/arrays all on one line for JSON output.
This is the default for JSON Lines output format.
--no-mmap Miller no longer uses memory-mapping to access data
files.
--ojsonx The `--jvstack` flag is now default true in Miller 6.

View file

@ -128,7 +128,6 @@ HELP OPTIONS
mlr help file-format-flags
mlr help flatten-unflatten-flags
mlr help format-conversion-keystroke-saver-flags
mlr help json-only-flags
mlr help legacy-flags
mlr help miscellaneous-flags
mlr help output-colorization-flags
@ -415,20 +414,14 @@ FORMAT-CONVERSION KEYSTROKE-SAVER FLAGS
-p Keystroke-saver for `--nidx --fs space --repifs`.
-T Keystroke-saver for `--nidx --fs tab`.
JSON-ONLY FLAGS
These are flags which are applicable to JSON format.
--jlistwrap or --jl Wrap JSON output in outermost `[ ]`.
--jvstack Put one key-value pair per line for JSON output
(multi-line output).
--no-jvstack Put objects/arrays all on one line for JSON output.
LEGACY FLAGS
These are flags which don't do anything in the current Miller version.
They are accepted as no-op flags in order to keep old scripts from breaking.
--jknquoteint Type information from JSON input files is now
preserved throughout the processing stream.
--jlistwrap or --jl Wrap JSON output in outermost `[ ]`. This is the
default for JSON output format.
--jquoteall Type information from JSON input files is now
preserved throughout the processing stream.
--json-fatal-arrays-on-input
@ -440,8 +433,15 @@ LEGACY FLAGS
--jsonx The `--jvstack` flag is now default true in Miller 6.
--jvquoteall Type information from JSON input files is now
preserved throughout the processing stream.
--jvstack Put one key-value pair per line for JSON output
(multi-line output). This is the default for JSON
output format.
--mmap Miller no longer uses memory-mapping to access data
files.
--no-jlistwrap Wrap JSON output in outermost `[ ]`. This is the
default for JSON Lines output format.
--no-jvstack Put objects/arrays all on one line for JSON output.
This is the default for JSON Lines output format.
--no-mmap Miller no longer uses memory-mapping to access data
files.
--ojsonx The `--jvstack` flag is now default true in Miller 6.

View file

@ -57,7 +57,6 @@ Flags:
mlr help file-format-flags
mlr help flatten-unflatten-flags
mlr help format-conversion-keystroke-saver-flags
mlr help json-only-flags
mlr help legacy-flags
mlr help miscellaneous-flags
mlr help output-colorization-flags

View file

@ -218,17 +218,6 @@ Additionally:
* `-p` is a keystroke-saver for `--nidx --fs space --repifs`.
* `-T` is a keystroke-saver for `--nidx --fs tab`.
## JSON-only flags
These are flags which are applicable to JSON format.
**Flags:**
* `--jlistwrap or --jl`: Wrap JSON output in outermost `[ ]`.
* `--jvstack`: Put one key-value pair per line for JSON output (multi-line output).
* `--no-jvstack`: Put objects/arrays all on one line for JSON output.
## Legacy flags
These are flags which don't do anything in the current Miller version.
@ -238,13 +227,17 @@ They are accepted as no-op flags in order to keep old scripts from breaking.
**Flags:**
* `--jknquoteint`: Type information from JSON input files is now preserved throughout the processing stream.
* `--jlistwrap or --jl`: Wrap JSON output in outermost `[ ]`. This is the default for JSON output format.
* `--jquoteall`: Type information from JSON input files is now preserved throughout the processing stream.
* `--json-fatal-arrays-on-input`: Miller now supports arrays as of version 6.
* `--json-map-arrays-on-input`: Miller now supports arrays as of version 6.
* `--json-skip-arrays-on-input`: Miller now supports arrays as of version 6.
* `--jsonx`: The `--jvstack` flag is now default true in Miller 6.
* `--jvquoteall`: Type information from JSON input files is now preserved throughout the processing stream.
* `--jvstack`: Put one key-value pair per line for JSON output (multi-line output). This is the default for JSON output format.
* `--mmap`: Miller no longer uses memory-mapping to access data files.
* `--no-jlistwrap`: Wrap JSON output in outermost `[ ]`. This is the default for JSON Lines output format.
* `--no-jvstack`: Put objects/arrays all on one line for JSON output. This is the default for JSON Lines output format.
* `--no-mmap`: Miller no longer uses memory-mapping to access data files.
* `--ojsonx`: The `--jvstack` flag is now default true in Miller 6.
* `--quote-all`: Ignored as of version 6. Types are inferred/retained through the processing flow now.

View file

@ -91,7 +91,6 @@ var FLAG_TABLE = FlagTable{
&SeparatorFlagSection,
&FileFormatFlagSection,
&FormatConversionKeystrokeSaverFlagSection,
&JSONOnlyFlagSection,
&CSVOnlyFlagSection,
&PPRINTOnlyFlagSection,
&CompressedDataFlagSection,
@ -407,50 +406,6 @@ var SeparatorFlagSection = FlagSection{
},
}
// ================================================================
// JSON-ONLY FLAGS
func JSONOnlyPrintInfo() {
fmt.Println("These are flags which are applicable to JSON format.")
}
func init() { JSONOnlyFlagSection.Sort() }
var JSONOnlyFlagSection = FlagSection{
name: "JSON-only flags",
infoPrinter: JSONOnlyPrintInfo,
flags: []Flag{
{
name: "--jvstack",
help: "Put one key-value pair per line for JSON output (multi-line output).",
parser: func(args []string, argc int, pargi *int, options *TOptions) {
options.WriterOptions.JSONOutputMultiline = true
*pargi += 1
},
},
{
name: "--no-jvstack",
help: "Put objects/arrays all on one line for JSON output.",
parser: func(args []string, argc int, pargi *int, options *TOptions) {
options.WriterOptions.JSONOutputMultiline = false
*pargi += 1
},
},
{
name: "--jlistwrap",
altNames: []string{"--jl"},
help: "Wrap JSON output in outermost `[ ]`.",
parser: func(args []string, argc int, pargi *int, options *TOptions) {
options.WriterOptions.WrapJSONOutputInOuterList = true
*pargi += 1
},
},
},
}
// ================================================================
// PPRINT-ONLY FLAGS
@ -590,6 +545,43 @@ var LegacyFlagSection = FlagSection{
help: "Ignored as of version 6. Types are inferred/retained through the processing flow now.",
parser: NoOpParse1,
},
{
name: "--jvstack",
help: "Put one key-value pair per line for JSON output (multi-line output). This is the default for JSON output format.",
parser: func(args []string, argc int, pargi *int, options *TOptions) {
options.WriterOptions.JSONOutputMultiline = true
*pargi += 1
},
},
{
name: "--no-jvstack",
help: "Put objects/arrays all on one line for JSON output. This is the default for JSON Lines output format.",
parser: func(args []string, argc int, pargi *int, options *TOptions) {
options.WriterOptions.JSONOutputMultiline = false
*pargi += 1
},
},
{
name: "--jlistwrap",
altNames: []string{"--jl"},
help: "Wrap JSON output in outermost `[ ]`. This is the default for JSON output format.",
parser: func(args []string, argc int, pargi *int, options *TOptions) {
options.WriterOptions.WrapJSONOutputInOuterList = true
*pargi += 1
},
},
{
name: "--no-jlistwrap",
help: "Wrap JSON output in outermost `[ ]`. This is the default for JSON Lines output format.",
parser: func(args []string, argc int, pargi *int, options *TOptions) {
options.WriterOptions.WrapJSONOutputInOuterList = false
*pargi += 1
},
},
},
}

View file

@ -128,7 +128,6 @@ HELP OPTIONS
mlr help file-format-flags
mlr help flatten-unflatten-flags
mlr help format-conversion-keystroke-saver-flags
mlr help json-only-flags
mlr help legacy-flags
mlr help miscellaneous-flags
mlr help output-colorization-flags
@ -415,20 +414,14 @@ FORMAT-CONVERSION KEYSTROKE-SAVER FLAGS
-p Keystroke-saver for `--nidx --fs space --repifs`.
-T Keystroke-saver for `--nidx --fs tab`.
JSON-ONLY FLAGS
These are flags which are applicable to JSON format.
--jlistwrap or --jl Wrap JSON output in outermost `[ ]`.
--jvstack Put one key-value pair per line for JSON output
(multi-line output).
--no-jvstack Put objects/arrays all on one line for JSON output.
LEGACY FLAGS
These are flags which don't do anything in the current Miller version.
They are accepted as no-op flags in order to keep old scripts from breaking.
--jknquoteint Type information from JSON input files is now
preserved throughout the processing stream.
--jlistwrap or --jl Wrap JSON output in outermost `[ ]`. This is the
default for JSON output format.
--jquoteall Type information from JSON input files is now
preserved throughout the processing stream.
--json-fatal-arrays-on-input
@ -440,8 +433,15 @@ LEGACY FLAGS
--jsonx The `--jvstack` flag is now default true in Miller 6.
--jvquoteall Type information from JSON input files is now
preserved throughout the processing stream.
--jvstack Put one key-value pair per line for JSON output
(multi-line output). This is the default for JSON
output format.
--mmap Miller no longer uses memory-mapping to access data
files.
--no-jlistwrap Wrap JSON output in outermost `[ ]`. This is the
default for JSON Lines output format.
--no-jvstack Put objects/arrays all on one line for JSON output.
This is the default for JSON Lines output format.
--no-mmap Miller no longer uses memory-mapping to access data
files.
--ojsonx The `--jvstack` flag is now default true in Miller 6.

View file

@ -163,7 +163,6 @@ Flags:
mlr help file-format-flags
mlr help flatten-unflatten-flags
mlr help format-conversion-keystroke-saver-flags
mlr help json-only-flags
mlr help legacy-flags
mlr help miscellaneous-flags
mlr help output-colorization-flags
@ -512,22 +511,6 @@ available for output only.
.fi
.if n \{\
.RE
.SH "JSON-ONLY FLAGS"
.sp
.if n \{\
.RS 0
.\}
.nf
These are flags which are applicable to JSON format.
--jlistwrap or --jl Wrap JSON output in outermost `[ ]`.
--jvstack Put one key-value pair per line for JSON output
(multi-line output).
--no-jvstack Put objects/arrays all on one line for JSON output.
.fi
.if n \{\
.RE
.SH "LEGACY FLAGS"
.sp
@ -540,6 +523,8 @@ They are accepted as no-op flags in order to keep old scripts from breaking.
--jknquoteint Type information from JSON input files is now
preserved throughout the processing stream.
--jlistwrap or --jl Wrap JSON output in outermost `[ ]`. This is the
default for JSON output format.
--jquoteall Type information from JSON input files is now
preserved throughout the processing stream.
--json-fatal-arrays-on-input
@ -551,8 +536,15 @@ They are accepted as no-op flags in order to keep old scripts from breaking.
--jsonx The `--jvstack` flag is now default true in Miller 6.
--jvquoteall Type information from JSON input files is now
preserved throughout the processing stream.
--jvstack Put one key-value pair per line for JSON output
(multi-line output). This is the default for JSON
output format.
--mmap Miller no longer uses memory-mapping to access data
files.
--no-jlistwrap Wrap JSON output in outermost `[ ]`. This is the
default for JSON Lines output format.
--no-jvstack Put objects/arrays all on one line for JSON output.
This is the default for JSON Lines output format.
--no-mmap Miller no longer uses memory-mapping to access data
files.
--ojsonx The `--jvstack` flag is now default true in Miller 6.

View file

@ -12,6 +12,7 @@ JSON LINES
o glossary
* olh
* RT cases
* --l2X and --X2l -- ?
* contact re https://jsonlines.org/on_the_web/
----------------------------------------------------------------