diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-01-23 09:41:47 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-01-23 09:41:47 +0200 |
commit | 95491de0c6c5377107a8a7eb6ce4b665e7e0f1d2 (patch) | |
tree | dbf8dcff7c9d60655243a5ccfe64d8b36377d4fe /effitool | |
parent | 64fa50994b1e74e3ce72fe4702a6f6dcda7c8560 (diff) | |
download | effitool-95491de0c6c5377107a8a7eb6ce4b665e7e0f1d2.tar.gz |
Add: read config file
Diffstat (limited to 'effitool')
-rwxr-xr-x | effitool | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -16,8 +16,31 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. +import configparser +import os +import sys + + +CONFIG_FILENAME = os.path.expanduser('~/.config/effitool/credentials.conf') + + +class Config: + + def __init__(self): + self._cp = configparser.ConfigParser() + + def read(self, filename): + with open(filename) as f: + self._cp.read_file(f) + + def dump(self, f): + self._cp.write(f) + + def main(): - print('hello from effitool') + config = Config() + config.read(CONFIG_FILENAME) + config.dump(sys.stdout) if __name__ == '__main__': |