Skip to content

Commit 359f18f

Browse files
Add {} variable having same meaning as {0}
1 parent 3a6436a commit 359f18f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

scripts/generate_manual.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,19 @@ $ rust-parallel gzip -k ::: *.html
6262

6363
echo '### Automatic Variables'
6464

65-
echo 'When using commands from arguments, numbered variables `{0}`, `{1}`, etc are automatically available based on the number of arguments. `{0}` will be replaced by the entire input line, and other groups match individual argument groups. This is useful for building more complex command lines. For example:
65+
echo 'When using commands from arguments, numbered variables `{0}`, `{1}`, etc are automatically available based on the number of arguments. `{0}` will be replaced by the entire input line, and other groups match individual argument groups. `{}` is the same as `{0}`. This is useful for building more complex command lines. For example:
6666
'
6767

6868
echo '```
6969
$ rust-parallel echo group0={0} group1={1} group2={2} group3={3} group2again={2} ::: A B ::: C D ::: E F G'
7070
$RUST_PARALLEL echo group0={0} group1={1} group2={2} group3={3} group2again={2} ::: A B ::: C D ::: E F G
7171
echo '```'
7272

73+
echo '```
74+
$ rust-parallel echo entireline={} group1={1} group2={2} group3={3} group2again={2} ::: A B ::: C D ::: E F G'
75+
$RUST_PARALLEL echo entireline={} group1={1} group2={2} group3={3} group2again={2} ::: A B ::: C D ::: E F G
76+
echo '```'
77+
7378
echo 'Internally these variables are implemented using an auto-generated [regular expression](#regular-expression). If a regular expression is manually specified this will override the auto-generated one.'
7479

7580
echo '## Commands from stdin
@@ -305,22 +310,22 @@ Regular expressions can be specified by the `-r` or `--regex` command line argum
305310
306311
### Named Capture Groups
307312
308-
In these examples using command line arguments `{url}` and `{filename}` are named capture groups. `{0}` is a numbered capture group.
313+
In these examples using command line arguments `{url}` and `{filename}` are named capture groups. `{}` is a variable meaning the entire input line.
309314
'
310315

311316
echo '```'
312317
echo -e '$ rust-parallel -r \x27(?P<url>.*),(?P<filename>.*)\x27 echo got url={url} filename={filename} ::: URL1,filename1 URL2,filename2'
313318
$RUST_PARALLEL -r '(?P<url>.*),(?P<filename>.*)' echo got url={url} filename={filename} ::: URL1,filename1 URL2,filename2
314319

315320
echo
316-
echo -e '$ rust-parallel -r \x27(?P<url>.*) (?P<filename>.*)\x27 echo got url={url} filename={filename} full input={0} ::: URL1 URL2 ::: filename1 filename2'
317-
$RUST_PARALLEL -r '(?P<url>.*) (?P<filename>.*)' echo got url={url} filename={filename} full input={0} ::: URL1 URL2 ::: filename1 filename2
321+
echo -e '$ rust-parallel -r \x27(?P<url>.*) (?P<filename>.*)\x27 echo got url={url} filename={filename} full input={} ::: URL1 URL2 ::: filename1 filename2'
322+
$RUST_PARALLEL -r '(?P<url>.*) (?P<filename>.*)' echo got url={url} filename={filename} full input={} ::: URL1 URL2 ::: filename1 filename2
318323

319324
echo '```'
320325

321326
echo '### Numbered Capture Groups
322327
323-
In the next example input file arguments `{0}` `{1}` `{2}` `{3}` are numbered capture groups, and the input is a csv file:'
328+
In the next example input file arguments `{1}` `{2}` `{3}` are numbered capture groups, `{}` is a variable meaning the entire input line. The input is a csv file:'
324329

325330
echo '```'
326331
echo '$ cat >./test <<EOL
@@ -335,8 +340,8 @@ foo3,bar3,baz3
335340
EOL
336341

337342
echo
338-
echo -e '$ cat test | rust-parallel -r \x27(.*),(.*),(.*)\x27 echo got arg1={1} arg2={2} arg3={3} full input={0}'
339-
cat test | $RUST_PARALLEL -r '(.*),(.*),(.*)' echo got arg1={1} arg2={2} arg3={3} full input={0}
343+
echo -e '$ cat test | rust-parallel -r \x27(.*),(.*),(.*)\x27 echo got arg1={1} arg2={2} arg3={3} full input={}'
344+
cat test | $RUST_PARALLEL -r '(.*),(.*),(.*)' echo got arg1={1} arg2={2} arg3={3} full input={}
340345

341346
echo '```'
342347

0 commit comments

Comments
 (0)