Add CLI command to list todoist project ids

This commit is contained in:
Jake Howard 2019-09-19 09:10:52 +01:00
parent 612cf66c09
commit b71692a41e
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 19 additions and 0 deletions

14
actioner/cli/__init__.py Normal file
View file

@ -0,0 +1,14 @@
import click
from actioner.clients import get_todoist_client
def list_todoist_projects():
todoist = get_todoist_client()
todoist.projects.sync()
for project in todoist.state["projects"]:
click.echo("'{}' has id {}".format(project["name"], project["id"]))
CLI_ENTRYPOINTS = [list_todoist_projects]

View file

@ -5,6 +5,7 @@ import click
import sentry_sdk import sentry_sdk
from apscheduler.util import get_callable_name from apscheduler.util import get_callable_name
from actioner.cli import CLI_ENTRYPOINTS
from actioner.scheduler import create_scheduler from actioner.scheduler import create_scheduler
from actioner.settings import LOGGING_LEVEL, SENTRY_DSN from actioner.settings import LOGGING_LEVEL, SENTRY_DSN
from actioner.web import get_server, run_server from actioner.web import get_server, run_server
@ -33,5 +34,9 @@ def once():
job() job()
for entry_point in CLI_ENTRYPOINTS:
cli.command()(entry_point)
if __name__ == "__main__": if __name__ == "__main__":
cli() cli()