diff options
| author | Dennis Fink | 2020-12-12 17:02:52 +0100 |
|---|---|---|
| committer | Dennis Fink | 2020-12-12 17:02:52 +0100 |
| commit | c3c714ae285cd42b0c7a2e102c590f316fcca835 (patch) | |
| tree | 5a3893ec76ea6d27fef4843c5d4ddfb5fb728b17 | |
| parent | 33d280bd59fc29be4e077964cbb54d0fd7c9eb24 (diff) | |
| download | patternutils-c3c714ae285cd42b0c7a2e102c590f316fcca835.tar.gz patternutils-c3c714ae285cd42b0c7a2e102c590f316fcca835.zip | |
Fix stream in pjson, pmatch and prss
Diffstat (limited to '')
| -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__": |
