mirror of
https://github.com/wader/fq.git
synced 2024-12-25 06:12:30 +03:00
interp: Refactor out string_input to own function
This commit is contained in:
parent
0e8c82afb1
commit
472c1ef081
@ -54,12 +54,7 @@ def input:
|
|||||||
, _input($opts; f)
|
, _input($opts; f)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
# TODO: don't rebuild options each time
|
def _input_string($opts):
|
||||||
( 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_strings_lines
|
( _input_strings_lines
|
||||||
| if . then
|
| if . then
|
||||||
# we're already iterating lines
|
# we're already iterating lines
|
||||||
@ -99,7 +94,13 @@ def input:
|
|||||||
end
|
end
|
||||||
)
|
)
|
||||||
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)
|
else _input($opts; decode)
|
||||||
end
|
end
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user