-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement a very basic, description-only import
- Loading branch information
1 parent
ba13b4e
commit 82cc4bc
Showing
3 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Environments | ||
venv/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import click | ||
from taskw import TaskWarrior | ||
from todoist.api import TodoistAPI | ||
|
||
todoist = None | ||
taskwarrior = None | ||
|
||
""" CLI Commands """ | ||
|
||
@click.group() | ||
@click.option('--todoist-api-key', envvar='TODOIST_API_KEY', required=True) | ||
def cli(todoist_api_key): | ||
# Just do some initialization | ||
global todoist | ||
global taskwarrior | ||
todoist = TodoistAPI(todoist_api_key) | ||
taskwarrior = TaskWarrior() | ||
|
||
|
||
@cli.command() | ||
@click.option('-i', '--interactive', default=False) | ||
def migrate(interactive): | ||
important('Starting migration...') | ||
# todoist.sync() | ||
tasks = todoist.items.all() | ||
|
||
info(f'Todoist tasks: {len(todoist.items.all())}') | ||
for task in todoist.items.all(): | ||
tid = task['id'] | ||
name = task['content'] | ||
info(f'Importing task #{tid}: {name}') | ||
taskwarrior.task_add(name) | ||
|
||
""" Utils """ | ||
|
||
def important(msg): | ||
click.echo(click.style(msg, fg='blue', bold=True)) | ||
|
||
|
||
def info(msg): | ||
click.echo(msg) | ||
|
||
|
||
""" Entrypoint """ | ||
|
||
if __name__ == '__main__': | ||
cli() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Click==7.0 | ||
taskw==1.2.0 | ||
todoist-python==7.0.18 | ||
|