Skip to content

Commit

Permalink
cli: jq compat, multiple -L
Browse files Browse the repository at this point in the history
  • Loading branch information
wader committed Sep 12, 2021
1 parent c8f0264 commit 85d1719
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/interp/interp.jq
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def _main:
short: "-L",
long: "--include-path",
description: "Include search path",
string: "PATH"
array: "PATH"
},
"null_output": {
short: "-0",
Expand Down Expand Up @@ -650,9 +650,7 @@ def _main:
else
# use _finally as display etc prints and results in empty
_finally(
( _include_paths([
$opts.include_path // empty
]) as $_
( _include_paths($opts.include_path) as $_
| _input_filenames($opts.filenames) as $_ # store inputs
| ( def _inputs:
( if $opts.null_input then null
Expand Down
4 changes: 4 additions & 0 deletions pkg/interp/testdata/incudepath.fqtest
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
def a: "a";
$ fq -L /library -n 'include "a"; a'
"a"
$ fq --include-path /library -n 'include "a"; a'
"a"
$ fq -L /wrong -L /library -n 'include "a"; a'
"a"
$ fq -L /wrong -n 'include "a"; a'
exitcode: 3
stderr:
Expand Down

0 comments on commit 85d1719

Please sign in to comment.