diff options
| -rw-r--r-- | patternutils/commands/pjson.py | 7 | ||||
| -rw-r--r-- | patternutils/commands/pmatch.py | 7 | ||||
| -rw-r--r-- | patternutils/commands/prss.py | 7 |
3 files changed, 12 insertions, 9 deletions
diff --git a/patternutils/commands/pjson.py b/patternutils/commands/pjson.py index a7bf069..66a626f 100644 --- a/patternutils/commands/pjson.py +++ b/patternutils/commands/pjson.py @@ -105,7 +105,8 @@ def pjson( else: matches.append(line) - if (abort_on_no_key and has_no_key) or (abort_on_no_match and has_no_match): - raise SystemExit + if not stream: + if (abort_on_no_key and has_no_key) or (abort_on_no_match and has_no_match): + raise SystemExit - click.echo(utils.json_dumps(matches, human_readable)) + click.echo(utils.json_dumps(matches, human_readable)) diff --git a/patternutils/commands/pmatch.py b/patternutils/commands/pmatch.py index 8a2e89f..c217c36 100644 --- a/patternutils/commands/pmatch.py +++ b/patternutils/commands/pmatch.py @@ -135,9 +135,10 @@ def pmatch( else: matches.append(match) - if has_invalid_matches and abort_on_no_match: - raise SystemExit - click.echo(utils.json_dumps(matches, human_readable)) + if not stream: + if has_invalid_matches and abort_on_no_match: + raise SystemExit + click.echo(utils.json_dumps(matches, human_readable)) if __name__ == "__main__": diff --git a/patternutils/commands/prss.py b/patternutils/commands/prss.py index 6c7d88b..a176587 100644 --- a/patternutils/commands/prss.py +++ b/patternutils/commands/prss.py @@ -132,10 +132,11 @@ def prss( else: matches.append(m) - if abort_on_no_file and has_no_file: - raise SystemExit + if not stream: + if abort_on_no_file and has_no_file: + raise SystemExit - click.echo(utils.json_dumps(matches, human_readable)) + click.echo(utils.json_dumps(matches, human_readable)) if __name__ == "__main__": |
