Make missing lexer error less verbose

This commit is contained in:
Oliver Bristow 2018-08-04 22:08:23 +01:00 committed by Oliver Bristow
commit b8e259add3
No known key found for this signature in database
GPG key ID: FF13F04BD2C87186

View file

@ -1050,10 +1050,7 @@ def main():
elif as_source:
logging.debug("asked for lexer: %s" % pattern.lower())
if pattern.lower() not in context["lexers"]:
logging.error("Lexer %r is not one of %s" % (
pattern,
", ".join(repr(lexer) for lexer in context["lexers"]),
))
logging.error("Lexer %r is not available. Run with \"--resources all\" to see the options.")
sys.exit(error_codes["UnknownLexer"])
lexer = get_lexer_by_name(pattern.lower())
# Python => 256 colors, python => 8 colors