2025-09-12 16:16:51 +01:00
|
|
|
module Main(main) where
|
|
|
|
|
|
2025-09-18 12:11:39 +01:00
|
|
|
import CAStore.Command (runCommand)
|
2025-09-12 16:16:51 +01:00
|
|
|
import CAStore.Config (finalConfig)
|
2025-09-18 12:11:39 +01:00
|
|
|
import CAStore.Program (Program, runProgram, getCommand)
|
|
|
|
|
import CAStore.Program.Storage (initialise)
|
|
|
|
|
import Control.Monad.IO.Class (liftIO)
|
2025-09-12 16:16:51 +01:00
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
|
main = finalConfig >>= flip runProgram defaultProgram
|
2025-09-18 12:11:39 +01:00
|
|
|
|
|
|
|
|
defaultProgram :: Program ()
|
|
|
|
|
defaultProgram = do
|
|
|
|
|
initialise
|
|
|
|
|
getCommand >>= \case
|
|
|
|
|
Nothing -> liftIO $ putStrLn "ERROR: Invalid command"
|
|
|
|
|
Just cmd -> runCommand cmd
|