mirror of
				https://git.webmeisterei.com/webmeisterei/todoist-taskwarrior.git
				synced 2025-10-31 02:02:41 +01:00 
			
		
		
		
	Implement a very basic, description-only import
This commit is contained in:
		
							
								
								
									
										40
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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/ | ||||
|  | ||||
							
								
								
									
										48
									
								
								migrate.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								migrate.py
									
									
									
									
									
										Normal file
									
								
							| @@ -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() | ||||
|  | ||||
							
								
								
									
										4
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								requirements.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| Click==7.0 | ||||
| taskw==1.2.0 | ||||
| todoist-python==7.0.18 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Matt Snider
					Matt Snider