From: Mark Hymers Date: Sat, 18 Apr 2009 12:28:21 +0000 (+0100) Subject: add automatic mode for cleanups X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=ca08a2fab86fdcb63f297c8ab8425e01b1176bba;p=dak.git add automatic mode for cleanups Signed-off-by: Mark Hymers --- diff --git a/dak/transitions.py b/dak/transitions.py index 1a5355ba..3a1e2c82 100755 --- a/dak/transitions.py +++ b/dak/transitions.py @@ -66,14 +66,15 @@ def init(): Cnf = utils.get_conf() - Arguments = [('h',"help","Edit-Transitions::Options::Help"), + Arguments = [('a',"automatic","Edit-Transitions::Options::Automatic"), + ('h',"help","Edit-Transitions::Options::Help"), ('e',"edit","Edit-Transitions::Options::Edit"), ('i',"import","Edit-Transitions::Options::Import", "HasArg"), ('c',"check","Edit-Transitions::Options::Check"), ('s',"sudo","Edit-Transitions::Options::Sudo"), ('n',"no-action","Edit-Transitions::Options::No-Action")] - for i in ["help", "no-action", "edit", "import", "check", "sudo"]: + for i in ["automatic", "help", "no-action", "edit", "import", "check", "sudo"]: if not Cnf.has_key("Edit-Transitions::Options::%s" % (i)): Cnf["Edit-Transitions::Options::%s" % (i)] = "" @@ -107,6 +108,7 @@ Options: -i, --import check and import transitions from file -c, --check check the transitions file, remove outdated entries -S, --sudo use sudo to update transitions file + -a, --automatic don't prompt (only affects check). -n, --no-action don't do anything (only affects check)""" sys.exit(exit_code) @@ -389,7 +391,7 @@ def edit_transitions(): def check_transitions(transitions): """ Check if the defined transitions still apply and remove those that no longer do. - @note: Asks the user for confirmation first. + @note: Asks the user for confirmation first unless -a has been set. """ to_dump = 0 @@ -432,6 +434,8 @@ def check_transitions(transitions): if Options["no-action"]: answer="n" + elif Options["automatic"]: + answer="y" else: answer = utils.our_raw_input(prompt).lower()