Commit 681c0539 authored by Adrian Reber's avatar Adrian Reber Committed by Andrei Vagin

crit: display help message when using python3

Running crit with python2 gives following minimal help message:

 $ crit/crit
 usage: crit [-h] {decode,encode,info,x,show} ...
 crit: error: too few arguments

Using a python3 only system crit shows the following error:

 $ crit/crit
 Traceback (most recent call last):
   File "crit/crit", line 6, in <module>
     cli.main()
   File "/home/criu/crit/pycriu/cli.py", line 334, in main
     opts["func"](opts)
 KeyError: 'func'

Using this patch the python3 output changes to:

 $ crit/crit
 usage: crit [-h] {decode,encode,info,x,show} ...
 crit: error: too few arguments
Suggested-by: 's avatarAndrei Vagin <avagin@gmail.com>
Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
parent 58fbe6de
......@@ -331,6 +331,11 @@ def main():
opts = vars(parser.parse_args())
if not opts:
sys.stderr.write(parser.format_usage())
sys.stderr.write("crit: error: too few arguments\n")
sys.exit(1)
opts["func"](opts)
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment