summaryrefslogtreecommitdiff
path: root/pygments/cmdline.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-11-11 19:14:13 +0100
committerGeorg Brandl <georg@python.org>2014-11-11 19:14:13 +0100
commit7ea9ac3db778e05fe2655018ca2fc5736c837489 (patch)
tree82aea6b4ecd074502a98a2e2321a0d25f16b5713 /pygments/cmdline.py
parent6ef0dc9af1f4343f9574a589058cb6d0fa01b8d8 (diff)
downloadpygments-7ea9ac3db778e05fe2655018ca2fc5736c837489.tar.gz
Fix -H return codes and test them.
Diffstat (limited to 'pygments/cmdline.py')
-rw-r--r--pygments/cmdline.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pygments/cmdline.py b/pygments/cmdline.py
index 40c1a599..608bd859 100644
--- a/pygments/cmdline.py
+++ b/pygments/cmdline.py
@@ -146,8 +146,10 @@ def _print_help(what, name):
cls = find_filter_class(name)
print("Help on the %s filter:" % name)
print(dedent(cls.__doc__))
+ return 0
except (AttributeError, ValueError):
print("%s not found!" % what, file=sys.stderr)
+ return 1
def _print_list(what):
@@ -250,8 +252,7 @@ def main_inner(popts, args, usage):
print(usage, file=sys.stderr)
return 2
- _print_help(what, name)
- return 0
+ return _print_help(what, name)
# parse -O options
parsed_opts = _parse_options(O_opts)