diff options
| -rw-r--r-- | Omni/Task.hs | 8 | ||||
| -rw-r--r-- | Omni/Task/Core.hs | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/Omni/Task.hs b/Omni/Task.hs index da3b23a..9cb061c 100644 --- a/Omni/Task.hs +++ b/Omni/Task.hs @@ -45,6 +45,7 @@ Usage: task init [--quiet] task create <title> [options] task edit <id> [options] + task delete <id> [--json] task list [options] task ready [--json] task show <id> [--json] @@ -62,6 +63,7 @@ Commands: init Initialize task database create Create a new task or epic edit Edit an existing task + delete Delete a task list List all tasks ready Show ready tasks (not blocked) show Show detailed task information @@ -250,6 +252,12 @@ move' args if isJsonMode args then outputJson updatedTask else putStrLn <| "Updated task: " <> T.unpack (taskId updatedTask) + | args `Cli.has` Cli.command "delete" = do + tid <- getArgText args "id" + deleteTask tid + if isJsonMode args + then outputSuccess ("Deleted task " <> tid) + else putStrLn <| "Deleted task: " <> T.unpack tid | args `Cli.has` Cli.command "list" = do maybeType <- case Cli.getArg args (Cli.longOption "type") of Nothing -> pure Nothing diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index 2110170..3b4eaa0 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -442,6 +442,12 @@ editTask tid modifyFn = saveTask finalTask pure finalTask +-- Delete a task +deleteTask :: Text -> IO () +deleteTask tid = + withDb <| \conn -> + SQL.execute conn "DELETE FROM tasks WHERE id = ?" (SQL.Only tid) + -- List tasks listTasks :: Maybe TaskType -> Maybe Text -> Maybe Status -> Maybe Text -> IO [Task] listTasks maybeType maybeParent maybeStatus maybeNamespace = do |
