From 4c0b6cc011c5d87c6b15e88092c249d2d575591d Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 14 May 2020 15:40:18 +0200 Subject: [PATCH] config cleanup --- sync_zotero_rm/config.py | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/sync_zotero_rm/config.py b/sync_zotero_rm/config.py index a6e39e9..87084be 100644 --- a/sync_zotero_rm/config.py +++ b/sync_zotero_rm/config.py @@ -3,6 +3,14 @@ from pathlib import Path from os.path import join CONFIG_FILE = join(str(Path.home()), ".zotero_remarkable.yaml") +CONFIG_OPTIONS = [ + "zot_api_key", + "zot_user_id", + "zot_collection", + "webdav_url", + "webdav_user", + "webdav_password", + "rm_folder"] def _read_config(): try: @@ -19,28 +27,14 @@ def _check_config(cfg): if not isinstance(cfg, dict): return False valid = True - for i in [ - "zot_api_key", - "zot_user_id", - "zot_collection", - "webdav_url", - "webdav_user", - "webdav_password", - "rm_folder"]: + for i in CONFIG_OPTIONS: if i not in cfg: valid = False return valid def _create_config(): cfg = {} - for i in [ - "zot_api_key", - "zot_user_id", - "zot_collection", - "webdav_url", - "webdav_user", - "webdav_password", - "rm_folder"]: + for i in CONFIG_OPTIONS: answer = input(i + ": ") cfg[i] = answer.strip() _write_config(cfg)