Skip to content

Commit

Permalink
Fix click commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Scarvy committed Feb 10, 2024
1 parent 6e62bc9 commit b4ef878
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions ticktick_to_sqlite/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,20 @@ def tasks(db_path, auth):
uncompleted_tasks_table.upsert_all(uncompleted_tasks, alter=True)


@cli.command(name="completed tasks")
@cli.command(name="completed-tasks")
@click.argument(
"db_path",
type=click.Path(file_okay=True, dir_okay=False, allow_dash=False),
required=True,
)
@click.argument(
"-s" "start_date",
"start_date",
type=click.DateTime(),
required=True,
)
@click.argument(
"-e" "end_date",
@click.option(
"-e",
"end_date",
type=click.DateTime(),
)
@click.option(
Expand All @@ -131,7 +132,7 @@ def completed_tasks(db_path, start_date, end_date, auth):
"Fetch completed tasks."
db = sqlite_utils.Database(db_path)
token = load_token(auth)
username, password = load_login_creds()
username, password = load_login_creds(auth)
completed_tasks = utils.completed_tasks(
username, password, token, start_date, end_date
)
Expand All @@ -158,7 +159,7 @@ def tags(db_path, auth):
db = sqlite_utils.Database(db_path)

token = load_token(auth)
username, password = load_login_creds()
username, password = load_login_creds(auth)

tags = utils.get_tags(username, password, token)

Expand All @@ -183,14 +184,15 @@ def projects(db_path, auth):
"Fetch projects."
db = sqlite_utils.Database(db_path)
token = load_token(auth)
username, password = load_login_creds()
username, password = load_login_creds(auth)

projects = utils.get_projects(username, password, token)

projects_table = db.table("projects", pk="id")
projects_table.upsert_all(projects, alter=True)


@cli.command(name="project-folders")
@click.argument(
"db_path",
type=click.Path(file_okay=True, dir_okay=False, allow_dash=False),
Expand All @@ -207,7 +209,7 @@ def project_folders(db_path, auth):
"""Fetch project folders"""
db = sqlite_utils.Database(db_path)
token = load_token(auth)
username, password = load_login_creds()
username, password = load_login_creds(auth)

project_folders = utils.get_project_folders(username, password, token)

Expand Down

0 comments on commit b4ef878

Please sign in to comment.