mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
tools: ratbagctl: remove useless try/catch
ns is never reset, so once it has a subparser, it'll keep it, so the try catch is just too much Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
committed by
Peter Hutterer
parent
faaf93b194
commit
e27b1eb99f
@@ -1299,18 +1299,16 @@ class RatbagParserRoot(object):
|
||||
child.add_to_subparsers(subs)
|
||||
pr_debug(ns, "<<< {}: {} | {}".format(child.type, child.name, rest))
|
||||
|
||||
ns.subparse = None
|
||||
|
||||
while subparser:
|
||||
old_rest = rest
|
||||
ns, rest = subparser.parse_known_args(rest, namespace=ns)
|
||||
if not rest or old_rest == rest:
|
||||
break
|
||||
pr_debug(ns, ns, rest)
|
||||
try:
|
||||
subparse_call = ns.subparse
|
||||
except AttributeError:
|
||||
break
|
||||
else:
|
||||
subparser = subparse_call(rest, ns)
|
||||
if ns.subparse:
|
||||
subparser = ns.subparse(rest, ns)
|
||||
|
||||
if rest:
|
||||
self.parser.error("extra arguments: '{}'".format(" ".join(rest)))
|
||||
|
||||
Reference in New Issue
Block a user