mirror of
https://git.webmeisterei.com/webmeisterei/todoist-taskwarrior.git
synced 2023-12-21 10:23:00 +01:00
Bugfixes
This commit is contained in:
parent
590ba91362
commit
11d5af59df
@ -30,23 +30,25 @@ def cli():
|
|||||||
|
|
||||||
is_help_cmd = '-h' in sys.argv or '--help' in sys.argv
|
is_help_cmd = '-h' in sys.argv or '--help' in sys.argv
|
||||||
rcfile = os.path.expanduser(TITWSYNCRC)
|
rcfile = os.path.expanduser(TITWSYNCRC)
|
||||||
with open(rcfile, 'r') as stream:
|
|
||||||
config = yaml.safe_load(stream)
|
|
||||||
|
|
||||||
if 'todoist' not in config or 'api_key' not in config['todoist'] \
|
if os.path.exists(rcfile):
|
||||||
and not is_help_cmd:
|
with open(rcfile, 'r') as stream:
|
||||||
log.error('Run configure first. Exiting.')
|
config = yaml.safe_load(stream)
|
||||||
exit(1)
|
|
||||||
|
|
||||||
todoist = TodoistAPI(config['todoist']['api_key'], cache=TODOIST_CACHE)
|
if 'todoist' not in config or 'api_key' not in config['todoist'] \
|
||||||
|
and not is_help_cmd:
|
||||||
|
log.error('Run configure first. Exiting.')
|
||||||
|
exit(1)
|
||||||
|
|
||||||
# Create the TaskWarrior client, overriding config to
|
todoist = TodoistAPI(config['todoist']['api_key'], cache=TODOIST_CACHE)
|
||||||
# create a `todoist_id` field which we'll use to
|
|
||||||
# prevent duplicates
|
# Create the TaskWarrior client, overriding config to
|
||||||
taskwarrior = TaskWarrior(config_overrides={
|
# create a `todoist_id` field which we'll use to
|
||||||
'uda.todoist_id.type': 'string',
|
# prevent duplicates
|
||||||
'uda.todoist_sync.type': 'date',
|
taskwarrior = TaskWarrior(config_overrides={
|
||||||
})
|
'uda.todoist_id.type': 'string',
|
||||||
|
'uda.todoist_sync.type': 'date',
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
|
@ -44,6 +44,9 @@ def tw_priority_to_ti(priority):
|
|||||||
|
|
||||||
def maybe_quote_ws(value):
|
def maybe_quote_ws(value):
|
||||||
"""Surrounds a value with single quotes if it contains whitespace. """
|
"""Surrounds a value with single quotes if it contains whitespace. """
|
||||||
|
if value is None:
|
||||||
|
return value
|
||||||
|
|
||||||
if any(x == ' ' or x == '\t' for x in value):
|
if any(x == ' ' or x == '\t' for x in value):
|
||||||
return "'" + value + "'"
|
return "'" + value + "'"
|
||||||
return value
|
return value
|
||||||
|
Loading…
Reference in New Issue
Block a user