{-# LANGUAGE UnicodeSyntax, MultiParamTypeClasses #-}moduleTodos.ConfigwhereimportPrelude.UnicodeimportControl.Monad.ReaderimportTodos.TypesimportTodos.DotimportqualifiedSystem.Console.ANSIasANSI-- | Any user-specified runtime config type should belong to this classclassRuntimeConfigcwhere-- | Does given TODO item match query?getPredicate∷DateTime→c→(TodoItem→𝔹)-- | Get basic configurationtoBaseConfig∷c→BaseConfig-- | Any user-specified runtime config type should include at least this propertiesdataBaseConfig=BConfig{outOnlyFirst∷𝔹,-- ^ Output only first matching entryoutColors∷𝔹,-- ^ Show colored outputoutIds::𝔹,-- ^ Show IDsoutHighlight∷𝔹,-- ^ Highlight matching itemssorting∷SortingType,-- ^ How to sort itemspruneL∷Limit,minL∷Limit,commandToRun∷TodoCommand,prefix∷MaybeString,-- ^ Nothing — use default parser, Just p — use alternate parser with prefix «p»outputFormat∷String,indentString∷String,-- ^ String to use for output tree indenting (two spaces by default)skipStatus∷𝔹,-- ^ Skip status field in inputgroupByFile∷𝔹,groupByTag∷𝔹,groupByStatus∷𝔹,forcedStatus∷MaybeString,topStatus∷MaybeString}deriving(Eq,Show)-- | Configuration for console output. Is generated in runtime from TodosConfig and Config.dataPrintConfigc=PConfig{printConfig∷c,printStatusColor∷String→(ANSI.ColorIntensity,ANSI.Color),-- ^ Color of status field from statusprintItemColor∷TodoItem→Maybe(ANSI.ColorIntensity,ANSI.Color),-- ^ Color of item nameprintHighlightColor∷(ANSI.ColorIntensity,ANSI.Color),-- ^ Color to use for highlightingdoHighlight∷TodoItem→𝔹-- ^ Whether to highlight given item}-- | User Todos config. User can specify it in @~/.config/todos/todos.hs@.dataTodosConfigc=Todos{parseCommandLine∷DateTime→c→[String]→CmdLineParseResultc,-- ^ Function to parse command linefilterTodos∷DateTime→c→[Todo]→[Todo],-- ^ Any function to be run to transform read TODOs treestatusConsoleColor∷String→(ANSI.ColorIntensity,ANSI.Color),-- ^ Function to select a color of item's status field in console outputitemConsoleColor∷TodoItem→Maybe(ANSI.ColorIntensity,ANSI.Color),-- ^ Function to select a color of item's name in console outputhighlightColor∷(ANSI.ColorIntensity,ANSI.Color),-- ^ Color to use for highlightingitemColor∷TodoItem→HSV,-- ^ Function to select color for item's node in DOT outputitemShape∷TodoItem→Shape,-- ^ Function to select shape for item's node in DOT outputprintTodos∷PrintConfigc→[Todo]→IO(),-- ^ Any function to output TODOs listnullConfig∷c-- ^ Default Config (to be used without any options in command line and configs)}-- | Result of parsing command linedataCmdLineParseResultc=Parsedc[FilePath]-- ^ Parsed successfully, got Config and list of source files|ParseErrorString-- ^ Some error occured|CmdLineHelp-- ^ User asked for helpderiving(Eq,Show)-- | ask field from BaseConfigaskBase∷(RuntimeConfigc)⇒(BaseConfig→a)→ReadercaaskBasefield=asks(field∘toBaseConfig)