From edc4d8b221b9c056e153af9309ffd3647d3b1fab Mon Sep 17 00:00:00 2001 From: bescoto Date: Tue, 26 Aug 2003 22:38:16 +0000 Subject: Updated argument parsing (test-server, better error messages) git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@404 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/rdiff_backup/Main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index f9cb252..b476124 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -156,11 +156,15 @@ def check_action(): 'list-changed-since', 'check-destination-dir'], 2: ['backup', 'restore', 'restore-as-of']} l = len(args) - if not action: assert l == 2, args # cannot tell backup or restore yet - elif action == 'calculate-average': - if l == 0: commandline_error("No arguments given") + if l == 0 and action not in arg_action_dict[l]: + 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]: - commandline_error("Wrong number of arguments given. See man page.") + commandline_error("Wrong number of arguments given.") def final_set_action(rps): """If no action set, decide between backup and restore at this point""" -- cgit v1.2.1