summaryrefslogtreecommitdiff
path: root/Omni/Jr.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-11-24 15:22:39 -0500
committerBen Sima <ben@bensima.com>2025-11-24 15:22:39 -0500
commit800b2bf7526cfc23b8ef913ab9e4efb5ffd4262d (patch)
tree44ff82f6e4008ce78e98624fad6ef0cd8420bae6 /Omni/Jr.hs
parentc221dc9d37f3b5a2b74969d6d59bf33fbc86f355 (diff)
feat(jr): Create Omni/Jr.hs main entry point
Amp-Thread-ID: https://ampcode.com/threads/T-663b6704-a8b0-4983-a62f-0ef00c61410c Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Omni/Jr.hs')
-rw-r--r--Omni/Jr.hs64
1 files changed, 64 insertions, 0 deletions
diff --git a/Omni/Jr.hs b/Omni/Jr.hs
new file mode 100644
index 0000000..1d15fb7
--- /dev/null
+++ b/Omni/Jr.hs
@@ -0,0 +1,64 @@
+{-# LANGUAGE OverloadedStrings #-}
+{-# LANGUAGE QuasiQuotes #-}
+{-# LANGUAGE NoImplicitPrelude #-}
+
+-- : out jr
+module Omni.Jr where
+
+import Alpha
+import qualified Omni.Cli as Cli
+import qualified Omni.Task as Task
+import System.Environment (withArgs)
+import qualified Omni.Test as Test
+import qualified System.Console.Docopt as Docopt
+
+main :: IO ()
+main = Cli.main plan
+
+plan :: Cli.Plan ()
+plan =
+ Cli.Plan
+ { Cli.help = help,
+ Cli.move = move,
+ Cli.test = test,
+ Cli.tidy = \_ -> pure ()
+ }
+
+help :: Cli.Docopt
+help =
+ [Cli.docopt|
+jr
+
+Usage:
+ jr task [<args>...]
+ jr work [<args>...]
+ jr harvest [<args>...]
+ jr test
+ jr (-h | --help)
+
+Commands:
+ task Manage tasks
+ work Track work
+ harvest Harvest wealth
+
+Options:
+ -h --help Show this help
+|]
+
+move :: Cli.Arguments -> IO ()
+move args
+ | args `Cli.has` Cli.command "task" = do
+ let extraArgs = Cli.getAllArgs args (Cli.argument "args")
+ withArgs extraArgs Task.main
+ | args `Cli.has` Cli.command "work" = do
+ putText "Work command not implemented yet"
+ | args `Cli.has` Cli.command "harvest" = do
+ putText "Harvest command not implemented yet"
+ | otherwise = putText (str <| Docopt.usage help)
+
+test :: Test.Tree
+test =
+ Test.group
+ "Omni.Jr"
+ [ Test.unit "can run tests" <| True Test.@?= True
+ ]