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

repl: Give error if repl is used in non-repl mode

This commit is contained in:
Mattias Wadman 2021-09-07 18:02:14 +02:00
parent ec98fd315a
commit 44d8b66a8e
2 changed files with 9 additions and 2 deletions

View File

@ -331,8 +331,11 @@ def _repl_iter($opts): _repl($opts);
def _repl_iter: _repl({}); def _repl_iter: _repl({});
# just gives error, call appearing last will be renamed to _repl_iter # just gives error, call appearing last will be renamed to _repl_iter
def repl($_): error("repl must be last"); def repl($_):
def repl: error("repl must be last"); if options.repl then error("repl must be last")
else error("repl can't be used in non-repl mode")
end;
def repl: repl(null);
def _cli_expr_on_error: def _cli_expr_on_error:

View File

@ -58,3 +58,7 @@ $ fq -i '[1,2,3]'
[1,2,3] [1,2,3]
> [number, ...][3]> ^D > [number, ...][3]> ^D
[number, ...][3]> ^D [number, ...][3]> ^D
$ fq -n repl
exitcode: 5
stderr:
error: repl can't be used in non-repl mode