From 2cd46141cd87249404d3a90db5abb92e134a5df8 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sun, 17 Dec 2017 20:52:46 +0100 Subject: Add err=True to the error message --- patternutils/commands/pmatch.py | 6 +++--- 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: -- cgit v1.3.1