summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthäus G. Chajdas <dev@anteru.net>2021-09-04 16:15:50 +0200
committerMatthäus G. Chajdas <dev@anteru.net>2021-09-04 16:15:50 +0200
commitdc00e102c1c1cc12f7f7fbd4eb4f0cf46f2c5297 (patch)
tree4ffc7c04a156a604f9fc5195478756c76f40306b
parent9a396ea19f789527b00def4c60419935a7a224fd (diff)
downloadpygments-git-dc00e102c1c1cc12f7f7fbd4eb4f0cf46f2c5297.tar.gz
Fix failing tests.
-rw-r--r--pygments/cmdline.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/pygments/cmdline.py b/pygments/cmdline.py
index 9e7daf62..8bd53db7 100644
--- a/pygments/cmdline.py
+++ b/pygments/cmdline.py
@@ -198,21 +198,17 @@ def main_inner(parser, argns):
if v:
arg_set.add(k)
- arg_set.remove('L')
+ arg_set.discard('L')
+ arg_set.discard('json')
# json can be only used with L, so we remove L, and check if there is
# only one option left (which must be JSON).
- if len(arg_set) == 1 and 'json' not in arg_set:
+ if arg_set:
parser.print_help(sys.stderr)
return 2
- elif len(arg_set) > 1:
- parser.print_help(sys.stderr)
- return 2
-
- json = 'json' in arg_set
# print version
- if not json:
+ if not argns.json:
main(['', '-V'])
allowed_types = {'lexer', 'formatter', 'filter', 'style'}
largs = [arg.rstrip('s') for arg in argns.L]
@@ -221,7 +217,7 @@ def main_inner(parser, argns):
return 0
if not largs:
largs = allowed_types
- if not json:
+ if not argns.json:
for arg in largs:
_print_list(arg)
else: