Skip to content

Commit

Permalink
Add help strings for -a/-r in sub/gsub/ssub (#1721)
Browse files Browse the repository at this point in the history
* Help strings for `-a`/`-r` in `sub`/`gsub`/`ssub`

* `mlr regtest -p test/cases/cli-help` to update expected outputs

* artifacts from `make dev`
  • Loading branch information
johnkerl authored Nov 23, 2024
1 parent 5c65edb commit 9f77bbe
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 10 deletions.
8 changes: 7 additions & 1 deletion docs/src/manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -1275,6 +1275,8 @@ This is simply a copy of what you should see on running `man mlr` at a command p
See also the `sub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

1mhaving-fields0m
Expand Down Expand Up @@ -1910,6 +1912,8 @@ This is simply a copy of what you should see on running `man mlr` at a command p
the old string, like the `ssub` DSL function. See also the `gsub` and `sub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

1mstats10m
Expand Down Expand Up @@ -2057,6 +2061,8 @@ This is simply a copy of what you should see on running `man mlr` at a command p
See also the `gsub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

1msummary0m
Expand Down Expand Up @@ -3731,5 +3737,5 @@ This is simply a copy of what you should see on running `man mlr` at a command p
MIME Type for Comma-Separated Values (CSV) Files, the Miller docsite
https://miller.readthedocs.io

2024-10-17 4mMILLER24m(1)
2024-11-23 4mMILLER24m(1)
</pre>
8 changes: 7 additions & 1 deletion docs/src/manpage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,8 @@
See also the `sub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

1mhaving-fields0m
Expand Down Expand Up @@ -1889,6 +1891,8 @@
the old string, like the `ssub` DSL function. See also the `gsub` and `sub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

1mstats10m
Expand Down Expand Up @@ -2036,6 +2040,8 @@
See also the `gsub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

1msummary0m
Expand Down Expand Up @@ -3710,4 +3716,4 @@
MIME Type for Comma-Separated Values (CSV) Files, the Miller docsite
https://miller.readthedocs.io

2024-10-17 4mMILLER24m(1)
2024-11-23 4mMILLER24m(1)
1 change: 0 additions & 1 deletion docs/src/record-heterogeneity.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ If you `mlr --csv cat` this, you'll get an error message:
a,b,c
1,2,3
mlr: mlr: CSV header/data length mismatch 3 != 2 at filename data/het/ragged.csv row 3.
.
</pre>

There are two kinds of raggedness here. Since CSVs form records by zipping the
Expand Down
10 changes: 8 additions & 2 deletions docs/src/reference-verbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ Options:
Since the expression pieces are simply concatenated, please be sure to use intervening
semicolons to separate expressions.)

-s name=value: Predefines out-of-stream variable @name to have
-s name=value: Predefines out-of-stream variable @name to have
Thus mlr put -s foo=97 '$column += @foo' is like
mlr put 'begin {@foo = 97} $column += @foo'.
The value part is subject to type-inferencing.
Expand Down Expand Up @@ -1464,6 +1464,8 @@ for the old string and handling multiple matches, like the `gsub` DSL function.
See also the `sub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.
</pre>

Expand Down Expand Up @@ -2321,7 +2323,7 @@ Options:
Since the expression pieces are simply concatenated, please be sure to use intervening
semicolons to separate expressions.)

-s name=value: Predefines out-of-stream variable @name to have
-s name=value: Predefines out-of-stream variable @name to have
Thus mlr put -s foo=97 '$column += @foo' is like
mlr put 'begin {@foo = 97} $column += @foo'.
The value part is subject to type-inferencing.
Expand Down Expand Up @@ -3210,6 +3212,8 @@ Replaces old string with new string in specified field(s), without regex support
the old string, like the `ssub` DSL function. See also the `gsub` and `sub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.
</pre>

Expand Down Expand Up @@ -3714,6 +3718,8 @@ for the old string and not handling multiple matches, like the `sub` DSL functio
See also the `gsub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.
</pre>

Expand Down
8 changes: 7 additions & 1 deletion man/manpage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,8 @@
See also the `sub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

1mhaving-fields0m
Expand Down Expand Up @@ -1889,6 +1891,8 @@
the old string, like the `ssub` DSL function. See also the `gsub` and `sub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

1mstats10m
Expand Down Expand Up @@ -2036,6 +2040,8 @@
See also the `gsub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

1msummary0m
Expand Down Expand Up @@ -3710,4 +3716,4 @@
MIME Type for Comma-Separated Values (CSV) Files, the Miller docsite
https://miller.readthedocs.io

2024-10-17 4mMILLER24m(1)
2024-11-23 4mMILLER24m(1)
14 changes: 10 additions & 4 deletions man/mlr.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
.\" Title: mlr
.\" Author: [see the "AUTHOR" section]
.\" Generator: ./mkman.rb
.\" Date: 2024-10-17
.\" Date: 2024-11-23
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2024-10-17" "\ \&" "\ \&"
.TH "MILLER" "1" "2024-11-23" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -1335,7 +1335,7 @@ Options:
Since the expression pieces are simply concatenated, please be sure to use intervening
semicolons to separate expressions.)

-s name=value: Predefines out-of-stream variable @name to have
-s name=value: Predefines out-of-stream variable @name to have
Thus mlr put -s foo=97 '$column += @foo' is like
mlr put 'begin {@foo = 97} $column += @foo'.
The value part is subject to type-inferencing.
Expand Down Expand Up @@ -1565,6 +1565,8 @@ for the old string and handling multiple matches, like the `gsub` DSL function.
See also the `sub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.
.fi
.if n \{\
Expand Down Expand Up @@ -1924,7 +1926,7 @@ Options:
Since the expression pieces are simply concatenated, please be sure to use intervening
semicolons to separate expressions.)

-s name=value: Predefines out-of-stream variable @name to have
-s name=value: Predefines out-of-stream variable @name to have
Thus mlr put -s foo=97 '$column += @foo' is like
mlr put 'begin {@foo = 97} $column += @foo'.
The value part is subject to type-inferencing.
Expand Down Expand Up @@ -2386,6 +2388,8 @@ Replaces old string with new string in specified field(s), without regex support
the old string, like the `ssub` DSL function. See also the `gsub` and `sub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.
.fi
.if n \{\
Expand Down Expand Up @@ -2557,6 +2561,8 @@ for the old string and not handling multiple matches, like the `sub` DSL functio
See also the `gsub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.
.fi
.if n \{\
Expand Down
6 changes: 6 additions & 0 deletions pkg/transformers/subs.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ func transformerSubUsage(
fmt.Fprintf(o, "See also the `gsub` and `ssub` verbs.\n")
fmt.Fprintf(o, "Options:\n")
fmt.Fprintf(o, "-f {a,b,c} Field names to convert.\n")
fmt.Fprintf(o, "-r {regex} Regular expression for field names to convert.\n")
fmt.Fprintf(o, "-a Convert all field names.\n")
fmt.Fprintf(o, "-h|--help Show this message.\n")
}

Expand All @@ -61,6 +63,8 @@ func transformerGsubUsage(
fmt.Fprintf(o, "See also the `sub` and `ssub` verbs.\n")
fmt.Fprintf(o, "Options:\n")
fmt.Fprintf(o, "-f {a,b,c} Field names to convert.\n")
fmt.Fprintf(o, "-r {regex} Regular expression for field names to convert.\n")
fmt.Fprintf(o, "-a Convert all field names.\n")
fmt.Fprintf(o, "-h|--help Show this message.\n")
}

Expand All @@ -72,6 +76,8 @@ func transformerSsubUsage(
fmt.Fprintf(o, "the old string, like the `ssub` DSL function. See also the `gsub` and `sub` verbs.\n")
fmt.Fprintf(o, "Options:\n")
fmt.Fprintf(o, "-f {a,b,c} Field names to convert.\n")
fmt.Fprintf(o, "-r {regex} Regular expression for field names to convert.\n")
fmt.Fprintf(o, "-a Convert all field names.\n")
fmt.Fprintf(o, "-h|--help Show this message.\n")
}

Expand Down
6 changes: 6 additions & 0 deletions test/cases/cli-help/0001/expout
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ for the old string and handling multiple matches, like the `gsub` DSL function.
See also the `sub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

================================================================
Expand Down Expand Up @@ -1058,6 +1060,8 @@ Replaces old string with new string in specified field(s), without regex support
the old string, like the `ssub` DSL function. See also the `gsub` and `sub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

================================================================
Expand Down Expand Up @@ -1209,6 +1213,8 @@ for the old string and not handling multiple matches, like the `sub` DSL functio
See also the `gsub` and `ssub` verbs.
Options:
-f {a,b,c} Field names to convert.
-r {regex} Regular expression for field names to convert.
-a Convert all field names.
-h|--help Show this message.

================================================================
Expand Down

0 comments on commit 9f77bbe

Please sign in to comment.