From 800b2bf7526cfc23b8ef913ab9e4efb5ffd4262d Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 24 Nov 2025 15:22:39 -0500 Subject: 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 --- Omni/Jr.hs | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Omni/Jr.hs (limited to 'Omni') 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 [...] + jr work [...] + jr harvest [...] + 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 + ] -- cgit v1.2.3