Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash process substitution not working with put -f #1583

Merged
merged 2 commits into from
Jun 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@

1mfilter0m
Usage: mlr filter [options] {DSL expression}
Lets you use a domain-specific language to progamatically filter which

Check failure on line 1080 in docs/src/manpage.md

View workflow job for this annotation

GitHub Actions / Codespell

progamatically ==> programmatically
stream records will be output.
See also: https://miller.readthedocs.io/en/latest/reference-verbs

Expand Down Expand Up @@ -1535,7 +1535,7 @@

1mput0m
Usage: mlr put [options] {DSL expression}
Lets you use a domain-specific language to progamatically alter stream records.

Check failure on line 1538 in docs/src/manpage.md

View workflow job for this annotation

GitHub Actions / Codespell

progamatically ==> programmatically
See also: https://miller.readthedocs.io/en/latest/reference-verbs

Options:
Expand Down Expand Up @@ -3731,5 +3731,5 @@
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>
2 changes: 1 addition & 1 deletion docs/src/manpage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion man/manpage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 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-06-08
.\" Date: 2024-06-09
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2024-06-08" "\ \&" "\ \&"
.TH "MILLER" "1" "2024-06-09" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
28 changes: 21 additions & 7 deletions pkg/transformers/put_or_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
Loading