diff options
| author | Dennis Fink | 2017-12-17 20:52:46 +0100 |
|---|---|---|
| committer | Dennis Fink | 2017-12-17 20:52:46 +0100 |
| commit | 2cd46141cd87249404d3a90db5abb92e134a5df8 (patch) | |
| tree | 8865ba0cf6f26235efb15283bf581e39ee18510b | |
| parent | ab04bf745e5ee109a09a4c9e6c5d2c12acdff735 (diff) | |
| download | patternutils-2cd46141cd87249404d3a90db5abb92e134a5df8.tar.gz patternutils-2cd46141cd87249404d3a90db5abb92e134a5df8.zip | |
Add err=True to the error message
| -rw-r--r-- | patternutils/commands/pmatch.py | 6 | ||||
| -rw-r--r-- | patternutils/commands/targs.py | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/patternutils/commands/pmatch.py b/patternutils/commands/pmatch.py index 544ec75..21f5557 100644 --- a/patternutils/commands/pmatch.py +++ b/patternutils/commands/pmatch.py @@ -35,7 +35,7 @@ def apply_regex( try: match = patternutils.match.apply(subject, regex_pattern) except ValueError: - click.secho('{} did not match'.format(subject), fg='red') + click.secho('{} did not match'.format(subject), fg='red', err=True) has_invalid_matches = True else: match['_path'] = f.path @@ -76,8 +76,8 @@ def pmatch( regex_pattern_c = re.compile(regex_pattern) except re.error as e: if verbose: - click.secho('Regular expression could not be compiled!', fg='red') - click.secho(e.msg, fg='red') + click.secho('Regular expression could not be compiled!', fg='red', err=True) + click.secho(e.msg, fg='red', err=True) raise SystemExit # Monkey patch walk function to include commandline options diff --git a/patternutils/commands/targs.py b/patternutils/commands/targs.py index 41334ed..bfacbfc 100644 --- a/patternutils/commands/targs.py +++ b/patternutils/commands/targs.py @@ -34,14 +34,14 @@ def targs( try: data = json.load(read_from) except json.JSONDecodeError: - click.secho('JSON not valid!', fg='red') + click.secho('JSON not valid!', fg='red', err=True) raise SystemExit use_jinja = True if template_engine == 'jinja2' else False try: render = patternutils.template.get_render_function(command, use_jinja=use_jinja) except RuntimeError: - click.secho('jinja2 not installed!', fg='red') + click.secho('jinja2 not installed!', fg='red', err=True) raise SystemExit for r in data: |
