From 990b0190bc75d35fc130e39bf35769369ca3138c Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sat, 29 Aug 2015 18:24:19 +0100 Subject: [PATCH] Add support for the parallel/serial suffixes to be configurable. --- app.json | 10 ++++++++++ nextaction.py | 8 +++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app.json b/app.json index ce77fcc..b96f697 100644 --- a/app.json +++ b/app.json @@ -22,6 +22,16 @@ "description": "What method to use for the Inbox, sequence or parallel", "value": "parallel", "required": false + }, + "TODODIST_PARALLEL_SUFFIX": { + "description": "What sequence of characters to use to identify parallel processed projects", + "value": "=", + "required": false + }, + "TODODIST_SERIAL_SUFFIX": { + "description": "What sequence of characters to use to identify serial processed projects", + "value": "-", + "required": false } } } \ No newline at end of file diff --git a/nextaction.py b/nextaction.py index e407382..69831d9 100755 --- a/nextaction.py +++ b/nextaction.py @@ -12,15 +12,17 @@ API_TOKEN = os.environ.get('TODOIST_API_KEY', None) NEXT_ACTION_LABEL = os.environ.get('TODOIST_NEXT_ACTION_LABEL', 'next_action') SYNC_DELAY = int(os.environ.get('TODOIST_SYNC_DELAY', '5')) INBOX_HANDLING = os.environ.get('TODOIST_INBOX_HANDLING', 'parallel') - +PARALLEL_SUFFIX = os.environ.get('TODOIST_PARALLEL_SUFFIX', '=') +SERIAL_SUFFIX = os.environ.get('TODOIST_SERIAL_SUFFIX', '-') def get_project_type(project): + """Identifies how a project should be handled""" name = project['name'].strip() if project['name'] == 'Inbox': return INBOX_HANDLING - elif name[-1] == '=': + elif name[-1] == PARALLEL_SUFFIX: return 'parallel' - elif name[-1] == '-': + elif name[-1] == SERIAL_SUFFIX: return 'serial'