From: Konstantin Stepanov Date: Wed, 22 Dec 2010 12:33:18 +0000 (+0200) Subject: dbuscrontab: ability to pass config file to edit for -e action X-Git-Tag: v1.5.0~5 X-Git-Url: http://git.maemo.org/git/?p=dbuscron;a=commitdiff_plain;h=9bc74508aeaece3a4fdc21d29361556f792379b5 dbuscrontab: ability to pass config file to edit for -e action --- diff --git a/dbuscron/shell/edit.py b/dbuscron/shell/edit.py index 607619f..e47dcc0 100644 --- a/dbuscron/shell/edit.py +++ b/dbuscron/shell/edit.py @@ -58,6 +58,10 @@ def run(): try: if action == '-e': + # 0. get custom config file to edit + if len(sys.argv) > 2: + conffile = sys.argv[2] + # 1. create temporary config file copy temp_file = create_temp_file(conffile) mod_time = os.path.getmtime(temp_file) @@ -102,12 +106,13 @@ def run(): else: print """ Usage: - %(myname)s { -e | -l } + %(myname)s { -e | -l | -k } [config-file] - -e edit %(conffile)s file - -l list contents of %(conffile)s file - -k check %(conffile)s's syntax + -e edit config file + -l list contents of config file + -k check config file's syntax + Default for config-file is %(conffile)s """ % dict(myname=os.path.basename(sys.argv[0]), conffile=conffile) except SystemError, e: