diff options
author | mathieui <mathieui@mathieui.net> | 2012-08-06 15:01:39 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-08-06 15:01:39 +0200 |
commit | 100994df284e1ce004e8babaeece128b1bd92479 (patch) | |
tree | b2b58fe37424908053d8d7faac80b2b3115d7e34 /src/config.py | |
parent | 5692a0278be231070a44d53aabb5daccad2a1ad6 (diff) | |
download | poezio-100994df284e1ce004e8babaeece128b1bd92479.tar.gz poezio-100994df284e1ce004e8babaeece128b1bd92479.tar.bz2 poezio-100994df284e1ce004e8babaeece128b1bd92479.tar.xz poezio-100994df284e1ce004e8babaeece128b1bd92479.zip |
Add a fallback to optparse if argparse is not found
Diffstat (limited to 'src/config.py')
-rw-r--r-- | src/config.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/config.py b/src/config.py index 99a05118..8a0c322c 100644 --- a/src/config.py +++ b/src/config.py @@ -15,7 +15,7 @@ DEFSECTION = "Poezio" from configparser import RawConfigParser, NoOptionError, NoSectionError from os import environ, makedirs, path from shutil import copy2 -from argparse import ArgumentParser, SUPPRESS +from args import parse_args class Config(RawConfigParser): """ @@ -192,14 +192,7 @@ if not path.isfile(path.join(CONFIG_PATH, 'poezio.cfg')): copy2(path.join(path.dirname(__file__), '../data/default_config.cfg'), path.join(CONFIG_PATH, 'poezio.cfg')) firstrun = True -parser = ArgumentParser() -parser.add_argument("-f", "--file", dest="filename", default=path.join(CONFIG_PATH, 'poezio.cfg'), - help="The config file you want to use", metavar="CONFIG_FILE") -parser.add_argument("-d", "--debug", dest="debug", - help="The file where debug will be written", metavar="DEBUG_FILE") -parser.add_argument("-v", "--version", dest="version", - help=SUPPRESS, metavar="VERSION", default="0.8-dev") -options = parser.parse_args() +options = parse_args(CONFIG_PATH) config = Config(options.filename) if firstrun: config.set('firstrun', True) |