diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-28 13:09:21 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-12-28 13:53:44 +0530 |
| commit | d6dbe32df6f1a01c95f9293023e2d73872fa39fe (patch) | |
| tree | d9a9e667eef416c03745a054118f21ed84ad49e9 /src/Chelleport/AppState.hs | |
| parent | 98af698a806e41904368c0114f9d8d9f377d9c09 (diff) | |
| download | chelleport-d6dbe32df6f1a01c95f9293023e2d73872fa39fe.tar.gz chelleport-d6dbe32df6f1a01c95f9293023e2d73872fa39fe.zip | |
Add cli arg parsing for starting in given mode
Diffstat (limited to 'src/Chelleport/AppState.hs')
| -rw-r--r-- | src/Chelleport/AppState.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Chelleport/AppState.hs b/src/Chelleport/AppState.hs index 8c7bac1..168cacf 100644 --- a/src/Chelleport/AppState.hs +++ b/src/Chelleport/AppState.hs @@ -1,6 +1,7 @@ module Chelleport.AppState (initialState, update) where import Chelleport.AppShell (MonadAppShell (hideWindow, showWindow, shutdownApp)) +import Chelleport.Args (Configuration (configMode)) import Chelleport.Control (MonadControl (..), directionalIncrement, hjklDirection) import Chelleport.Draw (MonadDraw (windowPosition, windowSize), pointerPositionIncrement, screenPositionFromCellPosition, wordPosition) import Chelleport.KeySequence (findMatchPosition, generateGrid, nextChars, toKeyChar) @@ -12,10 +13,11 @@ import Data.Char (toLower) import Data.Maybe (isJust) import qualified Text.Fuzzy as Fuzzy -initialState :: (Monad m) => m (State, Maybe AppAction) -initialState = do +initialState :: (Monad m) => Configuration -> m (State, Maybe AppAction) +initialState config = do let cells = either error id $ generateGrid 0 (rows, columns) hintKeys - pure (defaultAppState {stateGrid = cells}, Just $ SetMode defaultHintsMode) + let action = Just $ SetMode $ configMode config + pure (defaultAppState {stateGrid = cells}, action) where rows = 9 columns = 16 |
