Commit c342884a authored by bescoto's avatar bescoto

Updated argument parsing (test-server, better error messages)


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@404 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent 05b43732
...@@ -156,11 +156,15 @@ def check_action(): ...@@ -156,11 +156,15 @@ def check_action():
'list-changed-since', 'check-destination-dir'], 'list-changed-since', 'check-destination-dir'],
2: ['backup', 'restore', 'restore-as-of']} 2: ['backup', 'restore', 'restore-as-of']}
l = len(args) l = len(args)
if not action: assert l == 2, args # cannot tell backup or restore yet if l == 0 and action not in arg_action_dict[l]:
elif action == 'calculate-average': commandline_error("No arguments given")
if l == 0: commandline_error("No arguments given") elif not action:
if l == 2: pass # Will determine restore or backup later
else:
commandline_error("Switches missing or wrong number of arguments")
elif action == 'test-server': pass # test-server takes any number of args
elif l > 2 or action not in arg_action_dict[l]: elif l > 2 or action not in arg_action_dict[l]:
commandline_error("Wrong number of arguments given. See man page.") commandline_error("Wrong number of arguments given.")
def final_set_action(rps): def final_set_action(rps):
"""If no action set, decide between backup and restore at this point""" """If no action set, decide between backup and restore at this point"""
......
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