mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 02:14:13 +00:00
Argument parsing is different in mlr -s scripts (#1817)
This commit is contained in:
parent
34c9d764d8
commit
d30501a69b
4 changed files with 12 additions and 11 deletions
|
|
@ -234,7 +234,7 @@ then fraction -f count
|
|||
|
||||
Points:
|
||||
|
||||
* Same as above, where the `#!` line isn't needed. (But you can include a `#!` line; `mlr -s` will simply see it as a comment line.).
|
||||
* Same as above, where the `#!` line isn't needed. (But you can include a `#!` line; `mlr -s` will simply see it as a comment line.)
|
||||
* As above, you don't need all the backslashing for line-continuations.
|
||||
* As above, you don't need the explicit `--` or `"$@"`.
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ GENMD-EOF
|
|||
|
||||
Points:
|
||||
|
||||
* Same as above, where the `#!` line isn't needed. (But you can include a `#!` line; `mlr -s` will simply see it as a comment line.).
|
||||
* Same as above, where the `#!` line isn't needed. (But you can include a `#!` line; `mlr -s` will simply see it as a comment line.)
|
||||
* As above, you don't need all the backslashing for line-continuations.
|
||||
* As above, you don't need the explicit `--` or `"$@"`.
|
||||
|
||||
|
|
|
|||
|
|
@ -94,11 +94,21 @@ func ParseCommandLine(
|
|||
) {
|
||||
// mlr -s scriptfile {data-file names ...} means take the contents of
|
||||
// scriptfile as if it were command-line items.
|
||||
|
||||
args, err = maybeInterpolateDashS(args)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
// Expand "-xyz" into "-x -y -z" while leaving "--xyz" intact. This is a
|
||||
// keystroke-saver for the user.
|
||||
//
|
||||
// This is OK to do globally here since Miller is quite consistent (in
|
||||
// main, verbs, and auxents) that multi-character options start with two
|
||||
// dashes, e.g. "--csv". (The sole exception is the sort verb's -nf/-nr
|
||||
// which are handled specially there.)
|
||||
args = lib.Getoptify(args)
|
||||
|
||||
// Pass one as described at the top of this file.
|
||||
flagSequences, terminalSequence, verbSequences, dataFileNames := parseCommandLinePassOne(args)
|
||||
|
||||
|
|
|
|||
|
|
@ -36,15 +36,6 @@ func Main() MainReturn {
|
|||
// otherwise, we only raw ANSI escape sequences like ←[0;30m 0←[0m ←[0;31m 1
|
||||
platform.EnableAnsiEscapeSequences()
|
||||
|
||||
// Expand "-xyz" into "-x -y -z" while leaving "--xyz" intact. This is a
|
||||
// keystroke-saver for the user.
|
||||
//
|
||||
// This is OK to do globally here since Miller is quite consistent (in
|
||||
// main, verbs, and auxents) that multi-character options start with two
|
||||
// dashes, e.g. "--csv". (The sole exception is the sort verb's -nf/-nr
|
||||
// which are handled specially there.)
|
||||
os.Args = lib.Getoptify(os.Args)
|
||||
|
||||
// 'mlr repl' or 'mlr lecat' or any other non-miller-per-se toolery which
|
||||
// is delivered (for convenience) within the mlr executable. If argv[1] is
|
||||
// found then this function will not return.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue