Bash process substitution not working with put -f (#1583)

* Bash process substitution not working with `put -f`

* run `make dev`
This commit is contained in:
John Kerl 2024-06-08 20:37:31 -04:00 committed by GitHub
parent dc21fa3cd5
commit 6520bf4758
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 26 additions and 12 deletions

View file

@ -3731,5 +3731,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-06-08 4mMILLER24m(1)
2024-06-09 4mMILLER24m(1)
</pre>

View file

@ -3710,4 +3710,4 @@
MIME Type for Comma-Separated Values (CSV) Files, the Miller docsite
https://miller.readthedocs.io
2024-06-08 4mMILLER24m(1)
2024-06-09 4mMILLER24m(1)

View file

@ -3710,4 +3710,4 @@
MIME Type for Comma-Separated Values (CSV) Files, the Miller docsite
https://miller.readthedocs.io
2024-06-08 4mMILLER24m(1)
2024-06-09 4mMILLER24m(1)

View file

@ -2,12 +2,12 @@
.\" Title: mlr
.\" Author: [see the "AUTHOR" section]
.\" Generator: ./mkman.rb
.\" Date: 2024-06-08
.\" Date: 2024-06-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2024-06-08" "\ \&" "\ \&"
.TH "MILLER" "1" "2024-06-09" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -247,14 +247,28 @@ func transformerPutOrFilterParseCLI(
} else if opt == "-f" {
// Get a DSL string from the user-specified filename
filename := cli.VerbGetStringArgOrDie(verb, opt, args, &argi, argc)
theseDSLStrings, err := lib.LoadStringsFromFileOrDir(filename, ".mlr")
if err != nil {
fmt.Fprintf(os.Stderr, "%s %s: cannot load DSL expression from file \"%s\": ",
"mlr", verb, filename)
fmt.Println(err)
os.Exit(1)
// Miller has a two-pass command-line parser. If the user does
// `mlr put -f foo.mlr`
// then that file can be parsed both times. But if the user does
// `mlr put -f <( echo 'some expression goes here' )`
// that will read stdin. (The filename will come in as "dev/fd/63" or what have you.)
// But this file _cannot_ be read twice. So, if doConstruct==false -- we're
// on the first pass of the command-line parser -- don't bother to parse
// the DSL-contents file.
//
// See also https://github.com/johnkerl/miller/issues/1515
if doConstruct {
theseDSLStrings, err := lib.LoadStringsFromFileOrDir(filename, ".mlr")
if err != nil {
fmt.Fprintf(os.Stderr, "%s %s: cannot load DSL expression from file \"%s\": ",
"mlr", verb, filename)
fmt.Println(err)
os.Exit(1)
}
dslStrings = append(dslStrings, theseDSLStrings...)
}
dslStrings = append(dslStrings, theseDSLStrings...)
haveDSLStringsHere = true
} else if opt == "-e" {