1
1
mirror of https://github.com/wader/fq.git synced 2024-12-24 22:05:31 +03:00

interp: Refactor out string_input to own function

This commit is contained in:
Mattias Wadman 2021-11-01 11:40:24 +01:00
parent 0e8c82afb1
commit 472c1ef081

View File

@ -54,12 +54,7 @@ def input:
, _input($opts; f)
)
);
# TODO: don't rebuild options each time
( options as $opts
# TODO: refactor into def
# this is a bit strange as jq for --raw-string can return string instead
# with data from multiple inputs
| if $opts.string_input then
def _input_string($opts):
( _input_strings_lines
| if . then
# we're already iterating lines
@ -99,7 +94,13 @@ def input:
end
)
end
)
);
# TODO: don't rebuild options each time
( options as $opts
# TODO: refactor into def
# this is a bit strange as jq for --raw-string can return string instead
# with data from multiple inputs
| if $opts.string_input then _input_string($opts)
else _input($opts; decode)
end
);