diff options
Diffstat (limited to '')
| -rw-r--r-- | patternutils/commands/patterncfg.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/patternutils/commands/patterncfg.py b/patternutils/commands/patterncfg.py index 0115ed2..8f85b8f 100644 --- a/patternutils/commands/patterncfg.py +++ b/patternutils/commands/patterncfg.py @@ -136,12 +136,19 @@ def view(name: str, command: str, color: bool) -> None: click.secho("File not found!", fg="red", err=True) raise SystemExit else: - if color: + if color and has_pygments: if filename.endswith("jinja2"): lexer = DjangoLexer else: lexer = Python3Lexer text = highlight(text, lexer(), TerminalFormatter()) + elif color and not has_pygments: + click.echo( + "Pygments is not installed!. Cannot colorize output.", + fg="red", + err=True, + ) + raise SystemExit click.echo(text[:-1]) |
