mirror of
https://git.webmeisterei.com/webmeisterei/todoist-taskwarrior.git
synced 2023-12-21 10:23:00 +01:00
When a parse error occurs for recur, allow user to manually input
This commit is contained in:
parent
a9ff4b4ff8
commit
e22c8650ae
1
TODO.md
1
TODO.md
@ -2,6 +2,5 @@
|
||||
|
||||
* `revert` command that deletes all tasks with `todoist_id`
|
||||
* Save skipped list so we don't prompt user on next run
|
||||
* On exception, give user opportunity to manually enter value
|
||||
* Allow input of scheduled, wait
|
||||
|
||||
|
@ -141,7 +141,7 @@ def migrate(ctx, interactive, sync, map_project, map_tag):
|
||||
# Dates
|
||||
data['entry'] = utils.parse_date(task['date_added'])
|
||||
data['due'] = utils.parse_date(task['due_date_utc'])
|
||||
data['recur'] = utils.parse_recur(task['date_string'])
|
||||
data['recur'] = parse_recur_or_prompt(task['date_string'])
|
||||
|
||||
io.important(f'Task {idx + 1} of {len(tasks)}: {name}')
|
||||
|
||||
@ -230,7 +230,7 @@ def add_task_interactive(**task_data):
|
||||
**task_data,
|
||||
'recur': io.prompt(
|
||||
'Set recurrence (todoist style)',
|
||||
default=task_data['recur'],
|
||||
default='',
|
||||
value_proc=validation.validate_recur,
|
||||
),
|
||||
},
|
||||
@ -267,6 +267,18 @@ def add_task_interactive(**task_data):
|
||||
return add_task(**task_data)
|
||||
|
||||
|
||||
def parse_recur_or_prompt(value):
|
||||
try:
|
||||
return utils.parse_recur(value)
|
||||
except errors.UnsupportedRecurrence:
|
||||
io.error('Unsupported recurrence: %s. Please enter a valid value' % value)
|
||||
return io.prompt(
|
||||
'Set recurrence (todoist style)',
|
||||
default='',
|
||||
value_proc=validation.validate_recur,
|
||||
)
|
||||
|
||||
|
||||
""" Entrypoint """
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user