-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.py
47 lines (36 loc) · 999 Bytes
/
cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import typer
from models.journal import Journal
from rich import print
from models.task_list import TaskList
app = typer.Typer()
@app.command()
def add(emmet_abbr: str):
"""Add a new task"""
task_list = TaskList.load()
added_task_list = task_list.add_task_as_emmet(emmet_abbr)
print("Added tasks:")
print(added_task_list.tree_str())
@app.command(name="ls")
def list():
"""List all the task in task list"""
task_list = TaskList.load()
print(task_list.tree_str())
@app.command(name="rm")
def remove(emmet_abbr: str):
"""Remove a task"""
task_list = TaskList.load()
removed_task_list = task_list.remove_task_as_emmet(emmet_abbr)
print("Removed tasks:")
print(removed_task_list.tree_str())
@app.command()
def do(task_path: str):
"""Start a task"""
# TODO
journal = Journal.load()
journal.start_task(task_path)
@app.command()
def stop():
"""Start a task"""
# TODO
journal = Journal.load()
journal.stop_task()