From d6dbe32df6f1a01c95f9293023e2d73872fa39fe Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 28 Dec 2024 13:09:21 +0530 Subject: Add cli arg parsing for starting in given mode --- src/Chelleport.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/Chelleport.hs') diff --git a/src/Chelleport.hs b/src/Chelleport.hs index 0f5569e..02977c9 100644 --- a/src/Chelleport.hs +++ b/src/Chelleport.hs @@ -2,6 +2,7 @@ module Chelleport where import Chelleport.AppShell (setupAppShell) import qualified Chelleport.AppState as AppState +import Chelleport.Args (Configuration) import Chelleport.Context (initializeContext) import Chelleport.Control (anyAlphabetic, anyDigit, checkKey, ctrl, eventToKeycode, hjkl, hjklDirection, key, pressed, released, shift) import Chelleport.KeySequence (keycodeToInt, toKeyChar) @@ -13,12 +14,12 @@ import Control.Monad.Reader (ReaderT (runReaderT)) import Data.Maybe (fromMaybe) import qualified SDL -run :: IO () -run = do +run :: Configuration -> IO () +run config = do ctx <- initializeContext -- Cosplaying as elm runAppWithCtx ctx $ - setupAppShell ctx AppState.initialState AppState.update eventHandler View.render + setupAppShell ctx (AppState.initialState config) AppState.update eventHandler View.render where runAppWithCtx :: (MonadIO m) => DrawContext -> AppM m x -> m x runAppWithCtx ctx = (`runReaderT` ctx) . runAppM -- cgit v1.3.1