diff options
| author | Ben Sima <ben@bensima.com> | 2025-11-24 15:48:17 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-11-24 15:48:17 -0500 |
| commit | 0c6ff2172f3c48f4a6a41d95fd2da5ced183599a (patch) | |
| tree | 11d40086a34b98d046caacf3bfb66c9e1d3db772 /Omni/Agent.hs | |
| parent | 1c77c6aa19cf73d89490ee37546e217169bb6b22 (diff) | |
Allow worker to take a specific task to work on
Diffstat (limited to 'Omni/Agent.hs')
| -rw-r--r-- | Omni/Agent.hs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Omni/Agent.hs b/Omni/Agent.hs index 070e3fb..b7381b8 100644 --- a/Omni/Agent.hs +++ b/Omni/Agent.hs @@ -43,7 +43,7 @@ help = agent Usage: - agent start + agent start [<task-id>] agent harvest [--path=<path>] agent merge-driver <ours> <theirs> agent test @@ -72,7 +72,9 @@ move args Core.workerPath = path } - Worker.start worker + let taskId = fmap Text.pack (Cli.getArg args (Cli.argument "task-id")) + + Worker.start worker taskId | args `Cli.has` Cli.command "harvest" = harvest args | args `Cli.has` Cli.command "merge-driver" = mergeDriver args | otherwise = putStrLn (Cli.usage help) @@ -156,6 +158,13 @@ unitTests = case result of Left err -> Test.assertFailure <| "Failed to parse 'start': " <> show err Right args -> args `Cli.has` Cli.command "start" Test.@?= True, + Test.unit "can parse start command with task id" <| do + let result = Docopt.parseArgs help ["start", "t-123"] + case result of + Left err -> Test.assertFailure <| "Failed to parse 'start t-123': " <> show err + Right args -> do + args `Cli.has` Cli.command "start" Test.@?= True + Cli.getArg args (Cli.argument "task-id") Test.@?= Just "t-123", Test.unit "can parse harvest command" <| do let result = Docopt.parseArgs help ["harvest"] case result of |
