module Todos.Config where
import Control.Monad.Reader
import Todos.Unicode
import Todos.Types
import Todos.Dot
import qualified System.Console.ANSI as ANSI
class RuntimeConfig c where
getPredicate ā· DateTime ā c ā (TodoItem ā š¹)
toBaseConfig ā· c ā BaseConfig
data BaseConfig = BConfig {
outOnlyFirst ā· š¹,
outColors ā· š¹,
outIds :: š¹,
outHighlight ā· š¹,
sorting ā· SortingType,
pruneL ā· Limit,
minL ā· Limit,
commandToRun ā· TodoCommand,
prefix ā· Maybe String,
outputFormat ā· String,
indentString ā· String,
skipStatus ā· š¹,
groupByFile ā· š¹,
groupByTag ā· š¹,
groupByStatus ā· š¹,
forcedStatus ā· Maybe String,
topStatus ā· Maybe String
}
deriving (Eq, Show)
data PrintConfig c = PConfig {
printConfig ā· c,
printStatusColor ā· String ā (ANSI.ColorIntensity, ANSI.Color),
printItemColor ā· TodoItem ā Maybe (ANSI.ColorIntensity, ANSI.Color),
printHighlightColor ā· (ANSI.ColorIntensity, ANSI.Color),
doHighlight ā· TodoItem ā š¹
}
data TodosConfig c = Todos {
parseCommandLine ā· DateTime ā c ā [String] ā CmdLineParseResult c,
filterTodos ā· DateTime ā c ā [Todo] ā [Todo],
statusConsoleColor ā· String ā (ANSI.ColorIntensity, ANSI.Color),
itemConsoleColor ā· TodoItem ā Maybe (ANSI.ColorIntensity, ANSI.Color),
highlightColor ā· (ANSI.ColorIntensity, ANSI.Color),
itemColor ā· TodoItem ā HSV,
itemShape ā· TodoItem ā Shape,
printTodos ā· PrintConfig c ā [Todo] ā IO (),
nullConfig ā· c
}
data CmdLineParseResult c =
Parsed c [FilePath]
| ParseError String
| CmdLineHelp
deriving (Eq,Show)
askBase ā· (RuntimeConfig c) ā (BaseConfig ā a) ā Reader c a
askBase field = asks (field ā toBaseConfig)