1
0
forked from drath/libratbag

tools: ratbagctl: shout the usage if the parsing is incomplete

Too easy to trigger ("ratbagctl.devel profile" is just enough), so we
probably better have a proper usage call here.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Benjamin Tissoires
2017-08-21 18:06:33 +02:00
committed by Peter Hutterer
parent 0db7ba0c85
commit 58957667e1
2 changed files with 14 additions and 2 deletions

View File

@@ -52,7 +52,13 @@ def main(argv):
if cmd.help:
parser.print_help()
else:
cmd.func(ratbagd, cmd)
try:
f = cmd.func
except AttributeError:
parser.print_help()
return
else:
f(ratbagd, cmd)
finally:
try:
if cmd.keepalive:

View File

@@ -1356,7 +1356,13 @@ def main(argv):
r = open_ratbagd()
if r is not None:
cmd.func(r, cmd)
try:
f = cmd.func
except AttributeError:
parser.print_help()
return
else:
f(r, cmd)
if __name__ == "__main__":
main(sys.argv[1:])