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-22 13:43:57 +01:00
|
|
|
import CAStore.Command.Autocomplete (generateAutocompletions)
|
2025-09-12 16:16:51 +01:00
|
|
|
import CAStore.Config (finalConfig)
|
2025-09-22 13:43:57 +01:00
|
|
|
import CAStore.Program (Program, runProgram, getCommand, getAutocomplete)
|
2025-09-18 16:12:46 +01:00
|
|
|
import CAStore.Program.IO.Text (err)
|
2025-09-18 12:11:39 +01:00
|
|
|
import CAStore.Program.Storage (initialise)
|
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
|
2025-09-22 13:43:57 +01:00
|
|
|
getAutocomplete >>= \case
|
|
|
|
|
True -> generateAutocompletions
|
|
|
|
|
False -> getCommand >>= either err runCommand
|