Skip to content

Commit

Permalink
Modified on Fri Apr 12 13:23:13 WIB 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
goFrendiAsgard committed Apr 12, 2024
1 parent 3bbbec8 commit ea54dd7
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/zrb_noto/log/add.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from zrb import StrInput, Task, python_task, runner
from zrb.helper.accessories.color import colored
from zrb.helper.task import show_lines

from ..sync import create_sync_noto_task
Expand All @@ -19,7 +20,9 @@
retry=0,
)
def add_item(*args, **kwargs):
task: Task = kwargs.get("_task")
text = kwargs.get("text")
task.print_out(colored(f"Adding log: {text}", color="yellow"))
append_log_item(text)


Expand Down
3 changes: 1 addition & 2 deletions src/zrb_noto/todo/_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
task_input = StrInput(
name="task",
shortcut="t",
prompt="Task",
prompt="Task name or id",
prompt_required=True,
default="",
)

description_input = StrInput(
name="description",
shortcut="t",
prompt="Description",
default="",
)
Expand Down
16 changes: 12 additions & 4 deletions src/zrb_noto/todo/add.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from zrb import Task, python_task, runner
from zrb import StrInput, Task, python_task, runner
from zrb.helper.accessories.color import colored
from zrb.helper.task import show_lines

Expand All @@ -15,17 +15,24 @@
from ._input import (
context_input,
date_input,
description_input,
keyval_input,
priority_input,
project_input,
)


new_description_input = StrInput(
name="description",
shortcut="t",
prompt="Description",
default="",
)


@python_task(
name="add-item",
inputs=[
description_input,
new_description_input,
priority_input,
project_input,
context_input,
Expand Down Expand Up @@ -79,14 +86,15 @@ def add_item(*args, **kwargs):
projects=projects,
keyval=keyval,
)
task.print_out(colored(f"Adding task: {item.description}", color="yellow"))
append_todo_item(item=item)


@python_task(
name="add",
group=noto_todo_group,
inputs=[
description_input,
new_description_input,
priority_input,
project_input,
context_input,
Expand Down
1 change: 1 addition & 0 deletions src/zrb_noto/todo/complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def complete_item(*args, **kwargs):
)
return
item = items[0]
task.print_out(colored(f"Completing task: {item.description}", color="yellow"))
complete_todo_item(item)
append_log_item(f"__COMPLETE__ {item.description}")

Expand Down
1 change: 1 addition & 0 deletions src/zrb_noto/todo/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def delete_item(*args, **kwargs):
)
return
item = items[0]
task.print_out(colored(f"Deleting task: {item.description}", color="yellow"))
delete_todo_item(item)


Expand Down
1 change: 1 addition & 0 deletions src/zrb_noto/todo/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def edit_item(*args, **kwargs):
if keyval_input.strip() != "":
item.set_keyval(read_keyval_input(keyval_input))
# save item
task.print_out(colored(f"Editing task: {item.description}", color="yellow"))
replace_todo_item(item)


Expand Down
1 change: 1 addition & 0 deletions src/zrb_noto/todo/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def start_item(*args, **kwargs):
)
return
item = items[0]
task.print_out(colored(f"Starting task: {item.description}", color="yellow"))
start_todo_item(item)
append_log_item(f"__START__ {item.description}")

Expand Down
1 change: 1 addition & 0 deletions src/zrb_noto/todo/stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def stop_item(*args, **kwargs):
)
return
item = items[0]
task.print_out(colored(f"Stopping task: {item.description}", color="yellow"))
stop_todo_item(item)
append_log_item(f"__STOP__ {item.description}")

Expand Down

0 comments on commit ea54dd7

Please sign in to comment.