Factor out synchronize command to update local todoist database
This commit is contained in:
parent
6a795da284
commit
453f8d1e28
|
@ -16,14 +16,22 @@ def cli():
|
|||
pass
|
||||
|
||||
|
||||
@cli.command()
|
||||
def synchronize():
|
||||
"""Sync the local task database and then exit. """
|
||||
|
||||
important('Syncing tasks with todoist... ', nl=False)
|
||||
todoist.sync()
|
||||
success('OK')
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('-i', '--interactive', is_flag=True, default=False)
|
||||
@click.option('--no-sync', is_flag=True, default=False)
|
||||
def migrate(interactive, no_sync):
|
||||
if not no_sync:
|
||||
important('Syncing tasks with todoist... ', nl=False)
|
||||
todoist.sync()
|
||||
success('OK')
|
||||
@click.option('--sync/--no-sync', default=True)
|
||||
@click.pass_context
|
||||
def migrate(ctx, interactive, sync):
|
||||
if sync:
|
||||
ctx.invoke(synchronize)
|
||||
|
||||
tasks = todoist.items.all()
|
||||
important(f'Starting migration of {len(tasks)}...\n')
|
||||
|
|
Loading…
Reference in New Issue