diff --git a/docs/src/manpage.md b/docs/src/manpage.md index 19cb2de072..283d6dd976 100644 --- a/docs/src/manpage.md +++ b/docs/src/manpage.md @@ -50,7 +50,7 @@ MILLER(1) MILLER(1) insertion-ordered hash map. This encompasses a variety of data formats, including but not limited to the familiar CSV, TSV, and JSON. (Miller can handle positionally-indexed data as a special case.) This - manpage documents mlr 6.10.0. + manpage documents mlr 6.10.0-dev. 1mEXAMPLES0m mlr --icsv --opprint cat example.csv @@ -220,19 +220,18 @@ MILLER(1) MILLER(1) is_numeric is_present is_string joink joinkv joinv json_parse json_stringify kurtosis latin1_to_utf8 leafcount leftpad length localtime2gmt localtime2nsec localtime2sec log log10 log1p logifit lstrip madd mapdiff mapexcept mapselect - mapsum match matchx max maxlen md5 mean meaneb median mexp min minlen mmul - mode msub nsec2gmt nsec2gmtdate nsec2localdate nsec2localtime null_count os - percentile percentiles pow qnorm reduce regextract regextract_or_else rightpad - round roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate - sec2localtime select sgn sha1 sha256 sha512 sin sinh skewness sort - sort_collection splita splitax splitkv splitkvx splitnv splitnvx sqrt ssub - stddev strfntime strfntime_local strftime strftime_local string strip strlen - strpntime strpntime_local strptime strptime_local sub substr substr0 substr1 - sum sum2 sum3 sum4 sysntime system systime systimeint tan tanh tolower toupper - truncate typeof unflatten unformat unformatx upntime uptime urand urand32 - urandelement urandint urandrange utf8_to_latin1 variance version ! != !=~ % & - && * ** + - . .* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | - || ~ + mapsum max maxlen md5 mean meaneb median mexp min minlen mmul mode msub + nsec2gmt nsec2gmtdate nsec2localdate nsec2localtime null_count os percentile + percentiles pow qnorm reduce regextract regextract_or_else rightpad round + roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate sec2localtime + select sgn sha1 sha256 sha512 sin sinh skewness sort sort_collection splita + splitax splitkv splitkvx splitnv splitnvx sqrt ssub stddev strfntime + strfntime_local strftime strftime_local string strip strlen strpntime + strpntime_local strptime strptime_local sub substr substr0 substr1 sum sum2 + sum3 sum4 sysntime system systime systimeint tan tanh tolower toupper truncate + typeof unflatten unformat unformatx upntime uptime urand urand32 urandelement + urandint urandrange utf8_to_latin1 variance version ! != !=~ % & && * ** + - . + .* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | || ~ 1mCOMMENTS-IN-DATA FLAGS0m Miller lets you put comments in your data, such as @@ -569,6 +568,7 @@ MILLER(1) MILLER(1) since direct-to-screen output for large files has its own overhead. --no-hash-records See --hash-records. + --norc Do not load a .mlrrc file. --nr-progress-mod {m} With m a positive integer: print filename and record count to os.Stderr every m input records. --ofmt {format} E.g. `%.18f`, `%.0f`, `%9.6e`. Please use @@ -2651,16 +2651,6 @@ MILLER(1) MILLER(1) 1mmapsum0m (class=collections #args=variadic) With 0 args, returns empty map. With >= 1 arg, returns a map with key-value pairs from all arguments. Rightmost collisions win, e.g. 'mapsum({1:2,3:4},{1:5})' is '{1:5,3:4}'. - 1mmatch0m - (class=string #args=2) TODO: WRITE ME - Example: - TODO: WRITE ME - - 1mmatchx0m - (class=string #args=2) TODO: WRITE ME - Example: - TODO: WRITE ME - 1mmax0m (class=math #args=variadic) Max of n numbers; null loses. The min and max functions also recurse into arrays and maps, so they can be used to get min/max stats on array/map values. @@ -3660,5 +3650,5 @@ MILLER(1) MILLER(1) - 2023-12-16 MILLER(1) + 2023-12-19 MILLER(1) diff --git a/docs/src/manpage.txt b/docs/src/manpage.txt index 7f3a122af7..b79cc6bca0 100644 --- a/docs/src/manpage.txt +++ b/docs/src/manpage.txt @@ -29,7 +29,7 @@ MILLER(1) MILLER(1) insertion-ordered hash map. This encompasses a variety of data formats, including but not limited to the familiar CSV, TSV, and JSON. (Miller can handle positionally-indexed data as a special case.) This - manpage documents mlr 6.10.0. + manpage documents mlr 6.10.0-dev. 1mEXAMPLES0m mlr --icsv --opprint cat example.csv @@ -199,19 +199,18 @@ MILLER(1) MILLER(1) is_numeric is_present is_string joink joinkv joinv json_parse json_stringify kurtosis latin1_to_utf8 leafcount leftpad length localtime2gmt localtime2nsec localtime2sec log log10 log1p logifit lstrip madd mapdiff mapexcept mapselect - mapsum match matchx max maxlen md5 mean meaneb median mexp min minlen mmul - mode msub nsec2gmt nsec2gmtdate nsec2localdate nsec2localtime null_count os - percentile percentiles pow qnorm reduce regextract regextract_or_else rightpad - round roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate - sec2localtime select sgn sha1 sha256 sha512 sin sinh skewness sort - sort_collection splita splitax splitkv splitkvx splitnv splitnvx sqrt ssub - stddev strfntime strfntime_local strftime strftime_local string strip strlen - strpntime strpntime_local strptime strptime_local sub substr substr0 substr1 - sum sum2 sum3 sum4 sysntime system systime systimeint tan tanh tolower toupper - truncate typeof unflatten unformat unformatx upntime uptime urand urand32 - urandelement urandint urandrange utf8_to_latin1 variance version ! != !=~ % & - && * ** + - . .* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | - || ~ + mapsum max maxlen md5 mean meaneb median mexp min minlen mmul mode msub + nsec2gmt nsec2gmtdate nsec2localdate nsec2localtime null_count os percentile + percentiles pow qnorm reduce regextract regextract_or_else rightpad round + roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate sec2localtime + select sgn sha1 sha256 sha512 sin sinh skewness sort sort_collection splita + splitax splitkv splitkvx splitnv splitnvx sqrt ssub stddev strfntime + strfntime_local strftime strftime_local string strip strlen strpntime + strpntime_local strptime strptime_local sub substr substr0 substr1 sum sum2 + sum3 sum4 sysntime system systime systimeint tan tanh tolower toupper truncate + typeof unflatten unformat unformatx upntime uptime urand urand32 urandelement + urandint urandrange utf8_to_latin1 variance version ! != !=~ % & && * ** + - . + .* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | || ~ 1mCOMMENTS-IN-DATA FLAGS0m Miller lets you put comments in your data, such as @@ -548,6 +547,7 @@ MILLER(1) MILLER(1) since direct-to-screen output for large files has its own overhead. --no-hash-records See --hash-records. + --norc Do not load a .mlrrc file. --nr-progress-mod {m} With m a positive integer: print filename and record count to os.Stderr every m input records. --ofmt {format} E.g. `%.18f`, `%.0f`, `%9.6e`. Please use @@ -2630,16 +2630,6 @@ MILLER(1) MILLER(1) 1mmapsum0m (class=collections #args=variadic) With 0 args, returns empty map. With >= 1 arg, returns a map with key-value pairs from all arguments. Rightmost collisions win, e.g. 'mapsum({1:2,3:4},{1:5})' is '{1:5,3:4}'. - 1mmatch0m - (class=string #args=2) TODO: WRITE ME - Example: - TODO: WRITE ME - - 1mmatchx0m - (class=string #args=2) TODO: WRITE ME - Example: - TODO: WRITE ME - 1mmax0m (class=math #args=variadic) Max of n numbers; null loses. The min and max functions also recurse into arrays and maps, so they can be used to get min/max stats on array/map values. @@ -3639,4 +3629,4 @@ MILLER(1) MILLER(1) - 2023-12-16 MILLER(1) + 2023-12-19 MILLER(1) diff --git a/docs/src/reference-main-flag-list.md b/docs/src/reference-main-flag-list.md index f9ce597ff0..a53d1565e6 100644 --- a/docs/src/reference-main-flag-list.md +++ b/docs/src/reference-main-flag-list.md @@ -278,6 +278,7 @@ These are flags which don't fit into any other category. * `--no-dedupe-field-names`: By default, if an input record has a field named `x` and another also named `x`, the second will be renamed `x_2`, and so on. With this flag provided, the second `x`'s value will replace the first `x`'s value when the record is read. This flag has no effect on JSON input records, where duplicate keys always result in the last one's value being retained. * `--no-fflush`: Let buffered output not be written after every output record. The default is flush output after every record if the output is to the terminal, or less often if the output is to a file or a pipe. The default is a significant performance optimization for large files. Use this flag to allow less-frequent updates when output is to the terminal. This is unlikely to be a noticeable performance improvement, since direct-to-screen output for large files has its own overhead. * `--no-hash-records`: See --hash-records. +* `--norc`: Do not load a .mlrrc file. * `--nr-progress-mod {m}`: With m a positive integer: print filename and record count to os.Stderr every m input records. * `--ofmt {format}`: E.g. `%.18f`, `%.0f`, `%9.6e`. Please use sprintf-style codes (https://pkg.go.dev/fmt) for floating-point numbers. If not specified, default formatting is used. See also the `fmtnum` function and the `format-values` verb. * `--ofmte {n}`: Use --ofmte 6 as shorthand for --ofmt %.6e, etc. diff --git a/man/manpage.txt b/man/manpage.txt index 7f3a122af7..b79cc6bca0 100644 --- a/man/manpage.txt +++ b/man/manpage.txt @@ -29,7 +29,7 @@ MILLER(1) MILLER(1) insertion-ordered hash map. This encompasses a variety of data formats, including but not limited to the familiar CSV, TSV, and JSON. (Miller can handle positionally-indexed data as a special case.) This - manpage documents mlr 6.10.0. + manpage documents mlr 6.10.0-dev. 1mEXAMPLES0m mlr --icsv --opprint cat example.csv @@ -199,19 +199,18 @@ MILLER(1) MILLER(1) is_numeric is_present is_string joink joinkv joinv json_parse json_stringify kurtosis latin1_to_utf8 leafcount leftpad length localtime2gmt localtime2nsec localtime2sec log log10 log1p logifit lstrip madd mapdiff mapexcept mapselect - mapsum match matchx max maxlen md5 mean meaneb median mexp min minlen mmul - mode msub nsec2gmt nsec2gmtdate nsec2localdate nsec2localtime null_count os - percentile percentiles pow qnorm reduce regextract regextract_or_else rightpad - round roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate - sec2localtime select sgn sha1 sha256 sha512 sin sinh skewness sort - sort_collection splita splitax splitkv splitkvx splitnv splitnvx sqrt ssub - stddev strfntime strfntime_local strftime strftime_local string strip strlen - strpntime strpntime_local strptime strptime_local sub substr substr0 substr1 - sum sum2 sum3 sum4 sysntime system systime systimeint tan tanh tolower toupper - truncate typeof unflatten unformat unformatx upntime uptime urand urand32 - urandelement urandint urandrange utf8_to_latin1 variance version ! != !=~ % & - && * ** + - . .* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | - || ~ + mapsum max maxlen md5 mean meaneb median mexp min minlen mmul mode msub + nsec2gmt nsec2gmtdate nsec2localdate nsec2localtime null_count os percentile + percentiles pow qnorm reduce regextract regextract_or_else rightpad round + roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate sec2localtime + select sgn sha1 sha256 sha512 sin sinh skewness sort sort_collection splita + splitax splitkv splitkvx splitnv splitnvx sqrt ssub stddev strfntime + strfntime_local strftime strftime_local string strip strlen strpntime + strpntime_local strptime strptime_local sub substr substr0 substr1 sum sum2 + sum3 sum4 sysntime system systime systimeint tan tanh tolower toupper truncate + typeof unflatten unformat unformatx upntime uptime urand urand32 urandelement + urandint urandrange utf8_to_latin1 variance version ! != !=~ % & && * ** + - . + .* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | || ~ 1mCOMMENTS-IN-DATA FLAGS0m Miller lets you put comments in your data, such as @@ -548,6 +547,7 @@ MILLER(1) MILLER(1) since direct-to-screen output for large files has its own overhead. --no-hash-records See --hash-records. + --norc Do not load a .mlrrc file. --nr-progress-mod {m} With m a positive integer: print filename and record count to os.Stderr every m input records. --ofmt {format} E.g. `%.18f`, `%.0f`, `%9.6e`. Please use @@ -2630,16 +2630,6 @@ MILLER(1) MILLER(1) 1mmapsum0m (class=collections #args=variadic) With 0 args, returns empty map. With >= 1 arg, returns a map with key-value pairs from all arguments. Rightmost collisions win, e.g. 'mapsum({1:2,3:4},{1:5})' is '{1:5,3:4}'. - 1mmatch0m - (class=string #args=2) TODO: WRITE ME - Example: - TODO: WRITE ME - - 1mmatchx0m - (class=string #args=2) TODO: WRITE ME - Example: - TODO: WRITE ME - 1mmax0m (class=math #args=variadic) Max of n numbers; null loses. The min and max functions also recurse into arrays and maps, so they can be used to get min/max stats on array/map values. @@ -3639,4 +3629,4 @@ MILLER(1) MILLER(1) - 2023-12-16 MILLER(1) + 2023-12-19 MILLER(1) diff --git a/man/mlr.1 b/man/mlr.1 index 4f0644ed76..fd05c9f8d2 100644 --- a/man/mlr.1 +++ b/man/mlr.1 @@ -2,12 +2,12 @@ .\" Title: mlr .\" Author: [see the "AUTHOR" section] .\" Generator: ./mkman.rb -.\" Date: 2023-12-16 +.\" Date: 2023-12-19 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "MILLER" "1" "2023-12-16" "\ \&" "\ \&" +.TH "MILLER" "1" "2023-12-19" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Portability definitions .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -47,7 +47,7 @@ on integer-indexed fields: if the natural data structure for the latter is the array, then Miller's natural data structure is the insertion-ordered hash map. This encompasses a variety of data formats, including but not limited to the familiar CSV, TSV, and JSON. (Miller can handle positionally-indexed data as -a special case.) This manpage documents mlr 6.10.0. +a special case.) This manpage documents mlr 6.10.0-dev. .SH "EXAMPLES" .sp @@ -246,19 +246,18 @@ is_nonempty_map is_not_array is_not_empty is_not_map is_not_null is_null is_numeric is_present is_string joink joinkv joinv json_parse json_stringify kurtosis latin1_to_utf8 leafcount leftpad length localtime2gmt localtime2nsec localtime2sec log log10 log1p logifit lstrip madd mapdiff mapexcept mapselect -mapsum match matchx max maxlen md5 mean meaneb median mexp min minlen mmul -mode msub nsec2gmt nsec2gmtdate nsec2localdate nsec2localtime null_count os -percentile percentiles pow qnorm reduce regextract regextract_or_else rightpad -round roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate -sec2localtime select sgn sha1 sha256 sha512 sin sinh skewness sort -sort_collection splita splitax splitkv splitkvx splitnv splitnvx sqrt ssub -stddev strfntime strfntime_local strftime strftime_local string strip strlen -strpntime strpntime_local strptime strptime_local sub substr substr0 substr1 -sum sum2 sum3 sum4 sysntime system systime systimeint tan tanh tolower toupper -truncate typeof unflatten unformat unformatx upntime uptime urand urand32 -urandelement urandint urandrange utf8_to_latin1 variance version ! != !=~ % & -&& * ** + - . .* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | -|| ~ +mapsum max maxlen md5 mean meaneb median mexp min minlen mmul mode msub +nsec2gmt nsec2gmtdate nsec2localdate nsec2localtime null_count os percentile +percentiles pow qnorm reduce regextract regextract_or_else rightpad round +roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate sec2localtime +select sgn sha1 sha256 sha512 sin sinh skewness sort sort_collection splita +splitax splitkv splitkvx splitnv splitnvx sqrt ssub stddev strfntime +strfntime_local strftime strftime_local string strip strlen strpntime +strpntime_local strptime strptime_local sub substr substr0 substr1 sum sum2 +sum3 sum4 sysntime system systime systimeint tan tanh tolower toupper truncate +typeof unflatten unformat unformatx upntime uptime urand urand32 urandelement +urandint urandrange utf8_to_latin1 variance version ! != !=~ % & && * ** + - . +\&.* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | || ~ .fi .if n \{\ .RE @@ -667,6 +666,7 @@ These are flags which don't fit into any other category. since direct-to-screen output for large files has its own overhead. --no-hash-records See --hash-records. +--norc Do not load a .mlrrc file. --nr-progress-mod {m} With m a positive integer: print filename and record count to os.Stderr every m input records. --ofmt {format} E.g. `%.18f`, `%.0f`, `%9.6e`. Please use @@ -3939,28 +3939,6 @@ localtime2sec("2001-02-03 04:05:06", "Asia/Istanbul") = 981165906" .fi .if n \{\ .RE -.SS "match" -.if n \{\ -.RS 0 -.\} -.nf - (class=string #args=2) TODO: WRITE ME -Example: -TODO: WRITE ME -.fi -.if n \{\ -.RE -.SS "matchx" -.if n \{\ -.RS 0 -.\} -.nf - (class=string #args=2) TODO: WRITE ME -Example: -TODO: WRITE ME -.fi -.if n \{\ -.RE .SS "max" .if n \{\ .RS 0 diff --git a/pkg/cli/option_parse.go b/pkg/cli/option_parse.go index c9732b0255..5b8414f5df 100644 --- a/pkg/cli/option_parse.go +++ b/pkg/cli/option_parse.go @@ -3102,5 +3102,13 @@ has its own overhead.`, *pargi += 2 }, }, + + { + name: "--norc", + help: "Do not load a .mlrrc file.", + parser: func(args []string, argc int, pargi *int, options *TOptions) { + *pargi += 1 + }, + }, }, } diff --git a/pkg/climain/mlrcli_parse.go b/pkg/climain/mlrcli_parse.go index 9e8679eef0..586c94d78b 100644 --- a/pkg/climain/mlrcli_parse.go +++ b/pkg/climain/mlrcli_parse.go @@ -151,8 +151,8 @@ func parseCommandLinePassOne( os.Exit(0) } else if args[argi] == "--norc" { - flagSequences = append(flagSequences, args[oargi:argi]) argi += 1 + flagSequences = append(flagSequences, args[oargi:argi]) } else if cli.FLAG_TABLE.Parse(args, argc, &argi, options) { flagSequences = append(flagSequences, args[oargi:argi]) diff --git a/test/cases/cli-norc/0001/cmd b/test/cases/cli-norc/0001/cmd new file mode 100644 index 0000000000..57174b0ece --- /dev/null +++ b/test/cases/cli-norc/0001/cmd @@ -0,0 +1 @@ +mlr --norc -n cat diff --git a/test/cases/cli-norc/0001/experr b/test/cases/cli-norc/0001/experr new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/cases/cli-norc/0001/expout b/test/cases/cli-norc/0001/expout new file mode 100644 index 0000000000..e69de29bb2