From 85d17199de2bd566c82779b69c1d7ef6a92dbf09 Mon Sep 17 00:00:00 2001 From: Mattias Wadman Date: Sun, 5 Sep 2021 13:38:13 +0200 Subject: [PATCH] cli: jq compat, multiple -L --- pkg/interp/interp.jq | 6 ++---- pkg/interp/testdata/incudepath.fqtest | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/interp/interp.jq b/pkg/interp/interp.jq index 4122070f..117d2a49 100644 --- a/pkg/interp/interp.jq +++ b/pkg/interp/interp.jq @@ -498,7 +498,7 @@ def _main: short: "-L", long: "--include-path", description: "Include search path", - string: "PATH" + array: "PATH" }, "null_output": { short: "-0", @@ -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 diff --git a/pkg/interp/testdata/incudepath.fqtest b/pkg/interp/testdata/incudepath.fqtest index 7176e2d7..1f53c246 100644 --- a/pkg/interp/testdata/incudepath.fqtest +++ b/pkg/interp/testdata/incudepath.fqtest @@ -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: