aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2022-07-21 13:41:34 +0200
committerLinus Nordberg <linus@nordberg.se>2022-07-21 13:42:33 +0200
commitd7cc4c8089254fa22ea8ff7e256cfdeae82c868d (patch)
tree956618e2ca67c3740612a79cd0ebb3a3d4ba4315
parent4b3658ff1fc7a9877552bd006fc09b5e25f83854 (diff)
Add command line argument --config (-f)
-rwxr-xr-xmain.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/main.py b/main.py
index 6191fbc..289292c 100755
--- a/main.py
+++ b/main.py
@@ -46,12 +46,15 @@ if __name__ == "__main__":
parser.add_argument('-v', action="store_true", help="Print verbose debugging information to the logfile")
parser.add_argument('-d', action="store_true", help="Print verbose debugging information to stderr")
parser.add_argument('--nomail', action="store_true", help="Do everything except sending email")
+ parser.add_argument('-f', '--config', help="Configuration file (default: settings.cfg)")
args = parser.parse_args()
config = configparser.ConfigParser()
- configfile = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'settings.cfg')
- config.read(configfile)
+ if args.config:
+ config.read(args.config)
+ else:
+ config.read(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'settings.cfg'))
if args.nomail:
config.set('email', 'nomail', "True")