Let + be an alias for then (#1049)

This commit is contained in:
John Kerl 2022-07-04 17:23:19 -04:00 committed by GitHub
parent 23aefb5646
commit 418f6d80aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -21,3 +21,5 @@ GENMD-INCLUDE-ESCAPED(data/then-chaining-performance.txt)
There are two reasons to use then-chaining: one is for performance, although I don't expect this to be a win in all cases. Using then-chaining avoids redundant string-parsing and string-formatting at each pipeline step: instead input records are parsed once, they are fed through each pipeline stage in memory, and then output records are formatted once.
The other reason to use then-chaining is for simplicity: you don't have re-type formatting flags (e.g. `--csv --fs tab`) at every pipeline stage.
As of Miller 6.3.0, `+` is an alias for `then`.

View file

@ -162,10 +162,10 @@ func parseCommandLinePassOne(
os.Exit(1)
}
} else if onFirst || args[argi] == "then" {
} else if onFirst || args[argi] == "then" || args[argi] == "+" {
// The first verb in the then-chain can *optionally* be preceded by
// 'then'. The others one *must* be.
if args[argi] == "then" {
if args[argi] == "then" || args[argi] == "+" {
cli.CheckArgCount(args, argi, argc, 1)
oargi++
argi++