diff --git a/pkg/interp/interp.jq b/pkg/interp/interp.jq index 40ab1ec6..d6d0e852 100644 --- a/pkg/interp/interp.jq +++ b/pkg/interp/interp.jq @@ -231,7 +231,7 @@ def _prompt: , if length > 0 then (.[0] | _type_name_error) else empty end , if length > 1 then ", ..." else empty end , "]" - , "[\(length)]" + , if length > 1 then "[\(length)]" else empty end ) end; ( [ (_options_stack | length | if . > 2 then ((.-2) * ">") + " " else empty end) @@ -243,7 +243,7 @@ def _prompt: , _preview ) end - , if length > 1 then ", ..." else empty end + , if length > 1 then ", [\(length)]" else empty end , "> " ] ) | join(""); diff --git a/pkg/interp/testdata/inputs.fqtest b/pkg/interp/testdata/inputs.fqtest index 0496dc28..b6897c9c 100644 --- a/pkg/interp/testdata/inputs.fqtest +++ b/pkg/interp/testdata/inputs.fqtest @@ -78,11 +78,11 @@ exitcode: 4 stderr: error: /a: failed to decode (probe), try -d FORMAT to force $ fq -i -d raw . /a /b /c -raw, ...> ._format +raw, [3]> ._format "raw" "raw" "raw" -raw, ...> ^D +raw, [3]> ^D $ fq -i -s -d raw . /a /b /c [raw, ...][3]> .[]._format "raw" diff --git a/pkg/interp/testdata/repl.fqtest b/pkg/interp/testdata/repl.fqtest index 84c9059f..11dab36b 100644 --- a/pkg/interp/testdata/repl.fqtest +++ b/pkg/interp/testdata/repl.fqtest @@ -12,11 +12,25 @@ null> 1 | repl 2 > number> ^D null> [1,2,3] | repl({}; .[]) -> number, ...> . +> number, [3]> . 1 2 3 -> number, ...> ^D +> number, [3]> ^D +null> [[1,2,3]] | repl({}; .[]) +> [number, ...][3]> . +[ + 1, + 2, + 3 +] +> [number, ...][3]> ^D +null> [[1]] | repl({}; .[]) +> [number]> . +[ + 1 +] +> [number]> ^D null> [] | repl({}; .[]) > empty> 1 > empty> ^D