23 lines
779 B
Python
23 lines
779 B
Python
import subprocess
|
|
from maildir_gtd.screens.CreateTask import CreateTaskScreen
|
|
|
|
|
|
def action_create_task(app) -> None:
|
|
"""Show the input modal for creating a task."""
|
|
def check_task(task_args: str) -> bool:
|
|
try:
|
|
result = subprocess.run(
|
|
["task", "add"] + task_args.split(" "),
|
|
capture_output=True,
|
|
text=True
|
|
)
|
|
if result.returncode == 0:
|
|
app.show_status("Task created successfully.")
|
|
else:
|
|
app.show_status(f"Failed to create task: {result.stderr}")
|
|
except Exception as e:
|
|
app.show_status(f"Error: {e}", severity="error")
|
|
return True
|
|
return False
|
|
app.push_screen(CreateTaskScreen(), check_task)
|