diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-07-08 01:30:51 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-07-08 01:30:51 +0000 |
commit | 0b5c55be1b0082e8f532b4435addcd925f9ad324 (patch) | |
tree | df6f599b1ade4f1231229811ce0e7507d2c89bac /src/config.py | |
parent | 93df86c1c777bd2c133e8230d5fb96094076af1f (diff) | |
download | poezio-0b5c55be1b0082e8f532b4435addcd925f9ad324.tar.gz poezio-0b5c55be1b0082e8f532b4435addcd925f9ad324.tar.bz2 poezio-0b5c55be1b0082e8f532b4435addcd925f9ad324.tar.xz poezio-0b5c55be1b0082e8f532b4435addcd925f9ad324.zip |
add a -f option, we can specify a file to open instead of the default one. We then can have various different configuration and choose between them
Diffstat (limited to 'src/config.py')
-rw-r--r-- | src/config.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/config.py b/src/config.py index 1b9ba287..9e067418 100644 --- a/src/config.py +++ b/src/config.py @@ -26,6 +26,7 @@ from/to the config file from ConfigParser import RawConfigParser, NoOptionError from os import environ, makedirs from shutil import copy2 +import argparse class Config(RawConfigParser): """ @@ -106,6 +107,8 @@ class Config(RawConfigParser): RawConfigParser.set(self, self.defsection, option, value) self.save() + import argparse + # creates the configuration directory if it doesn't exist # and copy the default config in it CONFIG_HOME = environ.get("XDG_CONFIG_HOME") @@ -118,4 +121,8 @@ try: except OSError: pass -config = Config(CONFIG_PATH+'poezio.cfg') +parser = argparse.ArgumentParser(prog="poezio", description='An XMPP ncurses client.') +parser.add_argument('-f', '--file', default=CONFIG_PATH+'poezio.cfg', help='the config file you want to use', metavar="FILE") +args = parser.parse_args() + +config = Config(args.file) |