diff --git a/app/Server.hs b/app/Server.hs index f531c89..78b6b9f 100644 --- a/app/Server.hs +++ b/app/Server.hs @@ -3,6 +3,7 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} + {-# LANGUAGE TypeOperators #-} module Server where @@ -16,6 +17,7 @@ import qualified Control.Exception as E import Control.Monad import Control.Monad.IO.Class import Data.Aeson (FromJSON) +import Data.Aeson.Types import Data.Either import Data.IORef import Data.List (find, nub) @@ -24,7 +26,6 @@ import Data.String.Utils import Data.Text (Text) import qualified Data.Text as T import qualified Data.Yaml as Y -import GHC.Generics (Generic) import Servant import System.Directory import System.IO.HVFS @@ -39,7 +40,14 @@ import Text.Regex.Posix data ToodlesConfig = ToodlesConfig { ignore :: [FilePath] , flags :: [UserFlag] - } deriving (Show, Generic, FromJSON) + } deriving (Show) + +instance FromJSON ToodlesConfig where + parseJSON (Object o) = do + parsedIgnore <- o .:? "ignore" .!= [] + parsedFlags <- o .:? "flags" .!= [] + return $ ToodlesConfig parsedIgnore parsedFlags + parseJSON invalid = typeMismatch "Invalid config" invalid app :: ToodlesState -> Application app s = serve toodlesAPI server @@ -143,10 +151,10 @@ renderTodo t = listIfNotNull s = [s] renderFlag :: Flag -> Text - renderFlag TODO = "TODO" - renderFlag FIXME = "FIXME" - renderFlag XXX = "XXX" - renderFlag (UF (UserFlag x)) = x + renderFlag TODO = "TODO" + renderFlag FIXME = "FIXME" + renderFlag XXX = "XXX" + renderFlag (UF (UserFlag x)) = x -- | Given a function to emit new lines for a given todo, write that update in -- place of the current todo lines diff --git a/package.yaml b/package.yaml index ad9e3b3..6360396 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: toodles -version: 0.1.1 +version: 0.1.2 github: "aviaviavi/toodles" license: MIT author: "Avi Press" diff --git a/toodles.cabal b/toodles.cabal index 323d30a..20dc8b0 100644 --- a/toodles.cabal +++ b/toodles.cabal @@ -4,10 +4,10 @@ cabal-version: 1.12 -- -- see: https://github.com/sol/hpack -- --- hash: a9f9d2e470b32f019c6ac8a8a55e03313189492b36a710ce6a3fb4da7bb7178a +-- hash: c40e42a465ceb481a6828c3d022823ac5a955e9a52865832af413fd0c97ccb52 name: toodles -version: 0.1.1 +version: 0.1.2 synopsis: Manage the TODO entries in your code description: Toodles scrapes your entire repository for TODO entries and organizes them so you can manage your project directly from the code. View, filter, sort, and edit your TODO\'s with an easy to use web application. When you make changes via toodles, the edits will be applied directly the TODO entries in your code. When you\'re done, commit and push your changes to share them with your team! category: Project Management