{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Headroom.Types
(
Configuration(..)
, HeaderConfig(..)
, HeadersConfig(..)
, PartialConfiguration(..)
, PartialHeaderConfig(..)
, PartialHeadersConfig(..)
, HeaderSyntax(..)
, Command(..)
, CommandGenOptions(..)
, CommandInitOptions(..)
, CommandRunOptions(..)
, ConfigurationError(..)
, RunMode(..)
, GenMode(..)
, ApplicationError(..)
, CommandGenError(..)
, CommandInitError(..)
, TemplateError(..)
, LicenseType(..)
, FileType(..)
, FileInfo(..)
)
where
import Control.Exception ( throw )
import Data.Aeson ( FromJSON(..)
, Value(String)
, genericParseJSON
, withObject
, (.!=)
, (.:?)
)
import Data.Monoid ( Last(..) )
import Headroom.Serialization ( aesonOptions )
import Headroom.Types.EnumExtra ( EnumExtra(..) )
import RIO
import qualified RIO.Text as T
data RunMode
= Add
| Drop
| Replace
deriving (RunMode -> RunMode -> Bool
(RunMode -> RunMode -> Bool)
-> (RunMode -> RunMode -> Bool) -> Eq RunMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RunMode -> RunMode -> Bool
$c/= :: RunMode -> RunMode -> Bool
== :: RunMode -> RunMode -> Bool
$c== :: RunMode -> RunMode -> Bool
Eq, Int -> RunMode -> ShowS
[RunMode] -> ShowS
RunMode -> String
(Int -> RunMode -> ShowS)
-> (RunMode -> String) -> ([RunMode] -> ShowS) -> Show RunMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RunMode] -> ShowS
$cshowList :: [RunMode] -> ShowS
show :: RunMode -> String
$cshow :: RunMode -> String
showsPrec :: Int -> RunMode -> ShowS
$cshowsPrec :: Int -> RunMode -> ShowS
Show)
instance FromJSON RunMode where
parseJSON :: Value -> Parser RunMode
parseJSON = \case
String s :: Text
s -> case Text -> Text
T.toLower Text
s of
"add" -> RunMode -> Parser RunMode
forall (f :: * -> *) a. Applicative f => a -> f a
pure RunMode
Add
"drop" -> RunMode -> Parser RunMode
forall (f :: * -> *) a. Applicative f => a -> f a
pure RunMode
Drop
"replace" -> RunMode -> Parser RunMode
forall (f :: * -> *) a. Applicative f => a -> f a
pure RunMode
Replace
_ -> String -> Parser RunMode
forall a. HasCallStack => String -> a
error (String -> Parser RunMode) -> String -> Parser RunMode
forall a b. (a -> b) -> a -> b
$ "Unknown run mode: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Text -> String
T.unpack Text
s
other :: Value
other -> String -> Parser RunMode
forall a. HasCallStack => String -> a
error (String -> Parser RunMode) -> String -> Parser RunMode
forall a b. (a -> b) -> a -> b
$ "Invalid value for run mode: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> Value -> String
forall a. Show a => a -> String
show Value
other
data GenMode
= GenConfigFile
| GenLicense !(LicenseType, FileType)
deriving (GenMode -> GenMode -> Bool
(GenMode -> GenMode -> Bool)
-> (GenMode -> GenMode -> Bool) -> Eq GenMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GenMode -> GenMode -> Bool
$c/= :: GenMode -> GenMode -> Bool
== :: GenMode -> GenMode -> Bool
$c== :: GenMode -> GenMode -> Bool
Eq, Int -> GenMode -> ShowS
[GenMode] -> ShowS
GenMode -> String
(Int -> GenMode -> ShowS)
-> (GenMode -> String) -> ([GenMode] -> ShowS) -> Show GenMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GenMode] -> ShowS
$cshowList :: [GenMode] -> ShowS
show :: GenMode -> String
$cshow :: GenMode -> String
showsPrec :: Int -> GenMode -> ShowS
$cshowsPrec :: Int -> GenMode -> ShowS
Show)
data ApplicationError
= CommandGenError !CommandGenError
| CommandInitError !CommandInitError
| ConfigurationError !ConfigurationError
| TemplateError !TemplateError
deriving (ApplicationError -> ApplicationError -> Bool
(ApplicationError -> ApplicationError -> Bool)
-> (ApplicationError -> ApplicationError -> Bool)
-> Eq ApplicationError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationError -> ApplicationError -> Bool
$c/= :: ApplicationError -> ApplicationError -> Bool
== :: ApplicationError -> ApplicationError -> Bool
$c== :: ApplicationError -> ApplicationError -> Bool
Eq, Int -> ApplicationError -> ShowS
[ApplicationError] -> ShowS
ApplicationError -> String
(Int -> ApplicationError -> ShowS)
-> (ApplicationError -> String)
-> ([ApplicationError] -> ShowS)
-> Show ApplicationError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationError] -> ShowS
$cshowList :: [ApplicationError] -> ShowS
show :: ApplicationError -> String
$cshow :: ApplicationError -> String
showsPrec :: Int -> ApplicationError -> ShowS
$cshowsPrec :: Int -> ApplicationError -> ShowS
Show)
instance Exception ApplicationError where
displayException :: ApplicationError -> String
displayException = Text -> String
T.unpack (Text -> String)
-> (ApplicationError -> Text) -> ApplicationError -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. \case
CommandGenError error' :: CommandGenError
error' -> CommandGenError -> Text
commandGenError CommandGenError
error'
CommandInitError error' :: CommandInitError
error' -> CommandInitError -> Text
commandInitError CommandInitError
error'
ConfigurationError error' :: ConfigurationError
error' -> ConfigurationError -> Text
configurationError ConfigurationError
error'
TemplateError error' :: TemplateError
error' -> TemplateError -> Text
templateError TemplateError
error'
data CommandGenError = NoGenModeSelected
deriving (CommandGenError -> CommandGenError -> Bool
(CommandGenError -> CommandGenError -> Bool)
-> (CommandGenError -> CommandGenError -> Bool)
-> Eq CommandGenError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommandGenError -> CommandGenError -> Bool
$c/= :: CommandGenError -> CommandGenError -> Bool
== :: CommandGenError -> CommandGenError -> Bool
$c== :: CommandGenError -> CommandGenError -> Bool
Eq, Int -> CommandGenError -> ShowS
[CommandGenError] -> ShowS
CommandGenError -> String
(Int -> CommandGenError -> ShowS)
-> (CommandGenError -> String)
-> ([CommandGenError] -> ShowS)
-> Show CommandGenError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandGenError] -> ShowS
$cshowList :: [CommandGenError] -> ShowS
show :: CommandGenError -> String
$cshow :: CommandGenError -> String
showsPrec :: Int -> CommandGenError -> ShowS
$cshowsPrec :: Int -> CommandGenError -> ShowS
Show)
data CommandInitError
= AppConfigAlreadyExists !FilePath
| NoProvidedSourcePaths
| NoSupportedFileType
deriving (CommandInitError -> CommandInitError -> Bool
(CommandInitError -> CommandInitError -> Bool)
-> (CommandInitError -> CommandInitError -> Bool)
-> Eq CommandInitError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommandInitError -> CommandInitError -> Bool
$c/= :: CommandInitError -> CommandInitError -> Bool
== :: CommandInitError -> CommandInitError -> Bool
$c== :: CommandInitError -> CommandInitError -> Bool
Eq, Int -> CommandInitError -> ShowS
[CommandInitError] -> ShowS
CommandInitError -> String
(Int -> CommandInitError -> ShowS)
-> (CommandInitError -> String)
-> ([CommandInitError] -> ShowS)
-> Show CommandInitError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandInitError] -> ShowS
$cshowList :: [CommandInitError] -> ShowS
show :: CommandInitError -> String
$cshow :: CommandInitError -> String
showsPrec :: Int -> CommandInitError -> ShowS
$cshowsPrec :: Int -> CommandInitError -> ShowS
Show)
data ConfigurationError
= InvalidVariable !Text
|
| NoFileExtensions !FileType
| !FileType
| NoMarginAfter !FileType
| NoMarginBefore !FileType
| NoPutAfter !FileType
| NoPutBefore !FileType
| NoRunMode
| NoSourcePaths
| NoExcludedPaths
| NoTemplatePaths
| NoVariables
deriving (ConfigurationError -> ConfigurationError -> Bool
(ConfigurationError -> ConfigurationError -> Bool)
-> (ConfigurationError -> ConfigurationError -> Bool)
-> Eq ConfigurationError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigurationError -> ConfigurationError -> Bool
$c/= :: ConfigurationError -> ConfigurationError -> Bool
== :: ConfigurationError -> ConfigurationError -> Bool
$c== :: ConfigurationError -> ConfigurationError -> Bool
Eq, Int -> ConfigurationError -> ShowS
[ConfigurationError] -> ShowS
ConfigurationError -> String
(Int -> ConfigurationError -> ShowS)
-> (ConfigurationError -> String)
-> ([ConfigurationError] -> ShowS)
-> Show ConfigurationError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigurationError] -> ShowS
$cshowList :: [ConfigurationError] -> ShowS
show :: ConfigurationError -> String
$cshow :: ConfigurationError -> String
showsPrec :: Int -> ConfigurationError -> ShowS
$cshowsPrec :: Int -> ConfigurationError -> ShowS
Show)
data TemplateError
= MissingVariables !Text ![Text]
| ParseError !Text
deriving (TemplateError -> TemplateError -> Bool
(TemplateError -> TemplateError -> Bool)
-> (TemplateError -> TemplateError -> Bool) -> Eq TemplateError
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateError -> TemplateError -> Bool
$c/= :: TemplateError -> TemplateError -> Bool
== :: TemplateError -> TemplateError -> Bool
$c== :: TemplateError -> TemplateError -> Bool
Eq, Int -> TemplateError -> ShowS
[TemplateError] -> ShowS
TemplateError -> String
(Int -> TemplateError -> ShowS)
-> (TemplateError -> String)
-> ([TemplateError] -> ShowS)
-> Show TemplateError
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateError] -> ShowS
$cshowList :: [TemplateError] -> ShowS
show :: TemplateError -> String
$cshow :: TemplateError -> String
showsPrec :: Int -> TemplateError -> ShowS
$cshowsPrec :: Int -> TemplateError -> ShowS
Show)
data Command
= Run [FilePath] [Text] [FilePath] [Text] (Maybe RunMode) Bool Bool
| Gen Bool (Maybe (LicenseType, FileType))
| Init LicenseType [FilePath]
deriving (Int -> Command -> ShowS
[Command] -> ShowS
Command -> String
(Int -> Command -> ShowS)
-> (Command -> String) -> ([Command] -> ShowS) -> Show Command
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Command] -> ShowS
$cshowList :: [Command] -> ShowS
show :: Command -> String
$cshow :: Command -> String
showsPrec :: Int -> Command -> ShowS
$cshowsPrec :: Int -> Command -> ShowS
Show)
newtype CommandGenOptions = CommandGenOptions
{ CommandGenOptions -> GenMode
cgoGenMode :: GenMode
}
deriving (Int -> CommandGenOptions -> ShowS
[CommandGenOptions] -> ShowS
CommandGenOptions -> String
(Int -> CommandGenOptions -> ShowS)
-> (CommandGenOptions -> String)
-> ([CommandGenOptions] -> ShowS)
-> Show CommandGenOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandGenOptions] -> ShowS
$cshowList :: [CommandGenOptions] -> ShowS
show :: CommandGenOptions -> String
$cshow :: CommandGenOptions -> String
showsPrec :: Int -> CommandGenOptions -> ShowS
$cshowsPrec :: Int -> CommandGenOptions -> ShowS
Show)
data CommandInitOptions = CommandInitOptions
{ CommandInitOptions -> [String]
cioSourcePaths :: ![FilePath]
, CommandInitOptions -> LicenseType
cioLicenseType :: !LicenseType
}
deriving Int -> CommandInitOptions -> ShowS
[CommandInitOptions] -> ShowS
CommandInitOptions -> String
(Int -> CommandInitOptions -> ShowS)
-> (CommandInitOptions -> String)
-> ([CommandInitOptions] -> ShowS)
-> Show CommandInitOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandInitOptions] -> ShowS
$cshowList :: [CommandInitOptions] -> ShowS
show :: CommandInitOptions -> String
$cshow :: CommandInitOptions -> String
showsPrec :: Int -> CommandInitOptions -> ShowS
$cshowsPrec :: Int -> CommandInitOptions -> ShowS
Show
data CommandRunOptions = CommandRunOptions
{ CommandRunOptions -> Maybe RunMode
croRunMode :: !(Maybe RunMode)
, CommandRunOptions -> [String]
croSourcePaths :: ![FilePath]
, CommandRunOptions -> [Text]
croExcludedPaths :: ![Text]
, CommandRunOptions -> [String]
croTemplatePaths :: ![FilePath]
, CommandRunOptions -> [Text]
croVariables :: ![Text]
, CommandRunOptions -> Bool
croDebug :: !Bool
, CommandRunOptions -> Bool
croDryRun :: !Bool
}
deriving (CommandRunOptions -> CommandRunOptions -> Bool
(CommandRunOptions -> CommandRunOptions -> Bool)
-> (CommandRunOptions -> CommandRunOptions -> Bool)
-> Eq CommandRunOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CommandRunOptions -> CommandRunOptions -> Bool
$c/= :: CommandRunOptions -> CommandRunOptions -> Bool
== :: CommandRunOptions -> CommandRunOptions -> Bool
$c== :: CommandRunOptions -> CommandRunOptions -> Bool
Eq, Int -> CommandRunOptions -> ShowS
[CommandRunOptions] -> ShowS
CommandRunOptions -> String
(Int -> CommandRunOptions -> ShowS)
-> (CommandRunOptions -> String)
-> ([CommandRunOptions] -> ShowS)
-> Show CommandRunOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CommandRunOptions] -> ShowS
$cshowList :: [CommandRunOptions] -> ShowS
show :: CommandRunOptions -> String
$cshow :: CommandRunOptions -> String
showsPrec :: Int -> CommandRunOptions -> ShowS
$cshowsPrec :: Int -> CommandRunOptions -> ShowS
Show)
data FileType
= C
| CPP
| CSS
| Haskell
| HTML
| Java
| JS
| Rust
| Scala
| Shell
deriving (FileType
FileType -> FileType -> Bounded FileType
forall a. a -> a -> Bounded a
maxBound :: FileType
$cmaxBound :: FileType
minBound :: FileType
$cminBound :: FileType
Bounded, Int -> FileType
FileType -> Int
FileType -> [FileType]
FileType -> FileType
FileType -> FileType -> [FileType]
FileType -> FileType -> FileType -> [FileType]
(FileType -> FileType)
-> (FileType -> FileType)
-> (Int -> FileType)
-> (FileType -> Int)
-> (FileType -> [FileType])
-> (FileType -> FileType -> [FileType])
-> (FileType -> FileType -> [FileType])
-> (FileType -> FileType -> FileType -> [FileType])
-> Enum FileType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: FileType -> FileType -> FileType -> [FileType]
$cenumFromThenTo :: FileType -> FileType -> FileType -> [FileType]
enumFromTo :: FileType -> FileType -> [FileType]
$cenumFromTo :: FileType -> FileType -> [FileType]
enumFromThen :: FileType -> FileType -> [FileType]
$cenumFromThen :: FileType -> FileType -> [FileType]
enumFrom :: FileType -> [FileType]
$cenumFrom :: FileType -> [FileType]
fromEnum :: FileType -> Int
$cfromEnum :: FileType -> Int
toEnum :: Int -> FileType
$ctoEnum :: Int -> FileType
pred :: FileType -> FileType
$cpred :: FileType -> FileType
succ :: FileType -> FileType
$csucc :: FileType -> FileType
Enum, Bounded FileType
Enum FileType
Eq FileType
Ord FileType
Show FileType
[FileType]
Text
(Bounded FileType, Enum FileType, Eq FileType, Ord FileType,
Show FileType) =>
[FileType]
-> Text
-> (FileType -> Text)
-> (Text -> Maybe FileType)
-> EnumExtra FileType
Text -> Maybe FileType
FileType -> Text
forall a.
(Bounded a, Enum a, Eq a, Ord a, Show a) =>
[a] -> Text -> (a -> Text) -> (Text -> Maybe a) -> EnumExtra a
textToEnum :: Text -> Maybe FileType
$ctextToEnum :: Text -> Maybe FileType
enumToText :: FileType -> Text
$cenumToText :: FileType -> Text
allValuesToText :: Text
$callValuesToText :: Text
allValues :: [FileType]
$callValues :: [FileType]
$cp5EnumExtra :: Show FileType
$cp4EnumExtra :: Ord FileType
$cp3EnumExtra :: Eq FileType
$cp2EnumExtra :: Enum FileType
$cp1EnumExtra :: Bounded FileType
EnumExtra, FileType -> FileType -> Bool
(FileType -> FileType -> Bool)
-> (FileType -> FileType -> Bool) -> Eq FileType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileType -> FileType -> Bool
$c/= :: FileType -> FileType -> Bool
== :: FileType -> FileType -> Bool
$c== :: FileType -> FileType -> Bool
Eq, Eq FileType
Eq FileType =>
(FileType -> FileType -> Ordering)
-> (FileType -> FileType -> Bool)
-> (FileType -> FileType -> Bool)
-> (FileType -> FileType -> Bool)
-> (FileType -> FileType -> Bool)
-> (FileType -> FileType -> FileType)
-> (FileType -> FileType -> FileType)
-> Ord FileType
FileType -> FileType -> Bool
FileType -> FileType -> Ordering
FileType -> FileType -> FileType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: FileType -> FileType -> FileType
$cmin :: FileType -> FileType -> FileType
max :: FileType -> FileType -> FileType
$cmax :: FileType -> FileType -> FileType
>= :: FileType -> FileType -> Bool
$c>= :: FileType -> FileType -> Bool
> :: FileType -> FileType -> Bool
$c> :: FileType -> FileType -> Bool
<= :: FileType -> FileType -> Bool
$c<= :: FileType -> FileType -> Bool
< :: FileType -> FileType -> Bool
$c< :: FileType -> FileType -> Bool
compare :: FileType -> FileType -> Ordering
$ccompare :: FileType -> FileType -> Ordering
$cp1Ord :: Eq FileType
Ord, Int -> FileType -> ShowS
[FileType] -> ShowS
FileType -> String
(Int -> FileType -> ShowS)
-> (FileType -> String) -> ([FileType] -> ShowS) -> Show FileType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileType] -> ShowS
$cshowList :: [FileType] -> ShowS
show :: FileType -> String
$cshow :: FileType -> String
showsPrec :: Int -> FileType -> ShowS
$cshowsPrec :: Int -> FileType -> ShowS
Show)
data LicenseType
= Apache2
| BSD3
| GPL2
| GPL3
| MIT
| MPL2
deriving (LicenseType
LicenseType -> LicenseType -> Bounded LicenseType
forall a. a -> a -> Bounded a
maxBound :: LicenseType
$cmaxBound :: LicenseType
minBound :: LicenseType
$cminBound :: LicenseType
Bounded, Int -> LicenseType
LicenseType -> Int
LicenseType -> [LicenseType]
LicenseType -> LicenseType
LicenseType -> LicenseType -> [LicenseType]
LicenseType -> LicenseType -> LicenseType -> [LicenseType]
(LicenseType -> LicenseType)
-> (LicenseType -> LicenseType)
-> (Int -> LicenseType)
-> (LicenseType -> Int)
-> (LicenseType -> [LicenseType])
-> (LicenseType -> LicenseType -> [LicenseType])
-> (LicenseType -> LicenseType -> [LicenseType])
-> (LicenseType -> LicenseType -> LicenseType -> [LicenseType])
-> Enum LicenseType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: LicenseType -> LicenseType -> LicenseType -> [LicenseType]
$cenumFromThenTo :: LicenseType -> LicenseType -> LicenseType -> [LicenseType]
enumFromTo :: LicenseType -> LicenseType -> [LicenseType]
$cenumFromTo :: LicenseType -> LicenseType -> [LicenseType]
enumFromThen :: LicenseType -> LicenseType -> [LicenseType]
$cenumFromThen :: LicenseType -> LicenseType -> [LicenseType]
enumFrom :: LicenseType -> [LicenseType]
$cenumFrom :: LicenseType -> [LicenseType]
fromEnum :: LicenseType -> Int
$cfromEnum :: LicenseType -> Int
toEnum :: Int -> LicenseType
$ctoEnum :: Int -> LicenseType
pred :: LicenseType -> LicenseType
$cpred :: LicenseType -> LicenseType
succ :: LicenseType -> LicenseType
$csucc :: LicenseType -> LicenseType
Enum, Bounded LicenseType
Enum LicenseType
Eq LicenseType
Ord LicenseType
Show LicenseType
[LicenseType]
Text
(Bounded LicenseType, Enum LicenseType, Eq LicenseType,
Ord LicenseType, Show LicenseType) =>
[LicenseType]
-> Text
-> (LicenseType -> Text)
-> (Text -> Maybe LicenseType)
-> EnumExtra LicenseType
Text -> Maybe LicenseType
LicenseType -> Text
forall a.
(Bounded a, Enum a, Eq a, Ord a, Show a) =>
[a] -> Text -> (a -> Text) -> (Text -> Maybe a) -> EnumExtra a
textToEnum :: Text -> Maybe LicenseType
$ctextToEnum :: Text -> Maybe LicenseType
enumToText :: LicenseType -> Text
$cenumToText :: LicenseType -> Text
allValuesToText :: Text
$callValuesToText :: Text
allValues :: [LicenseType]
$callValues :: [LicenseType]
$cp5EnumExtra :: Show LicenseType
$cp4EnumExtra :: Ord LicenseType
$cp3EnumExtra :: Eq LicenseType
$cp2EnumExtra :: Enum LicenseType
$cp1EnumExtra :: Bounded LicenseType
EnumExtra, LicenseType -> LicenseType -> Bool
(LicenseType -> LicenseType -> Bool)
-> (LicenseType -> LicenseType -> Bool) -> Eq LicenseType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LicenseType -> LicenseType -> Bool
$c/= :: LicenseType -> LicenseType -> Bool
== :: LicenseType -> LicenseType -> Bool
$c== :: LicenseType -> LicenseType -> Bool
Eq, Eq LicenseType
Eq LicenseType =>
(LicenseType -> LicenseType -> Ordering)
-> (LicenseType -> LicenseType -> Bool)
-> (LicenseType -> LicenseType -> Bool)
-> (LicenseType -> LicenseType -> Bool)
-> (LicenseType -> LicenseType -> Bool)
-> (LicenseType -> LicenseType -> LicenseType)
-> (LicenseType -> LicenseType -> LicenseType)
-> Ord LicenseType
LicenseType -> LicenseType -> Bool
LicenseType -> LicenseType -> Ordering
LicenseType -> LicenseType -> LicenseType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: LicenseType -> LicenseType -> LicenseType
$cmin :: LicenseType -> LicenseType -> LicenseType
max :: LicenseType -> LicenseType -> LicenseType
$cmax :: LicenseType -> LicenseType -> LicenseType
>= :: LicenseType -> LicenseType -> Bool
$c>= :: LicenseType -> LicenseType -> Bool
> :: LicenseType -> LicenseType -> Bool
$c> :: LicenseType -> LicenseType -> Bool
<= :: LicenseType -> LicenseType -> Bool
$c<= :: LicenseType -> LicenseType -> Bool
< :: LicenseType -> LicenseType -> Bool
$c< :: LicenseType -> LicenseType -> Bool
compare :: LicenseType -> LicenseType -> Ordering
$ccompare :: LicenseType -> LicenseType -> Ordering
$cp1Ord :: Eq LicenseType
Ord, Int -> LicenseType -> ShowS
[LicenseType] -> ShowS
LicenseType -> String
(Int -> LicenseType -> ShowS)
-> (LicenseType -> String)
-> ([LicenseType] -> ShowS)
-> Show LicenseType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LicenseType] -> ShowS
$cshowList :: [LicenseType] -> ShowS
show :: LicenseType -> String
$cshow :: LicenseType -> String
showsPrec :: Int -> LicenseType -> ShowS
$cshowsPrec :: Int -> LicenseType -> ShowS
Show)
data FileInfo = FileInfo
{ FileInfo -> FileType
fiFileType :: !FileType
, :: !HeaderConfig
, :: !(Maybe (Int, Int))
, FileInfo -> HashMap Text Text
fiVariables :: !(HashMap Text Text)
}
deriving (FileInfo -> FileInfo -> Bool
(FileInfo -> FileInfo -> Bool)
-> (FileInfo -> FileInfo -> Bool) -> Eq FileInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileInfo -> FileInfo -> Bool
$c/= :: FileInfo -> FileInfo -> Bool
== :: FileInfo -> FileInfo -> Bool
$c== :: FileInfo -> FileInfo -> Bool
Eq, Int -> FileInfo -> ShowS
[FileInfo] -> ShowS
FileInfo -> String
(Int -> FileInfo -> ShowS)
-> (FileInfo -> String) -> ([FileInfo] -> ShowS) -> Show FileInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileInfo] -> ShowS
$cshowList :: [FileInfo] -> ShowS
show :: FileInfo -> String
$cshow :: FileInfo -> String
showsPrec :: Int -> FileInfo -> ShowS
$cshowsPrec :: Int -> FileInfo -> ShowS
Show)
data
= !Text !Text
| !Text
deriving (HeaderSyntax -> HeaderSyntax -> Bool
(HeaderSyntax -> HeaderSyntax -> Bool)
-> (HeaderSyntax -> HeaderSyntax -> Bool) -> Eq HeaderSyntax
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeaderSyntax -> HeaderSyntax -> Bool
$c/= :: HeaderSyntax -> HeaderSyntax -> Bool
== :: HeaderSyntax -> HeaderSyntax -> Bool
$c== :: HeaderSyntax -> HeaderSyntax -> Bool
Eq, Int -> HeaderSyntax -> ShowS
[HeaderSyntax] -> ShowS
HeaderSyntax -> String
(Int -> HeaderSyntax -> ShowS)
-> (HeaderSyntax -> String)
-> ([HeaderSyntax] -> ShowS)
-> Show HeaderSyntax
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeaderSyntax] -> ShowS
$cshowList :: [HeaderSyntax] -> ShowS
show :: HeaderSyntax -> String
$cshow :: HeaderSyntax -> String
showsPrec :: Int -> HeaderSyntax -> ShowS
$cshowsPrec :: Int -> HeaderSyntax -> ShowS
Show)
data Configuration = Configuration
{ Configuration -> RunMode
cRunMode :: !RunMode
, Configuration -> [String]
cSourcePaths :: ![FilePath]
, Configuration -> [Text]
cExcludedPaths :: ![Text]
, Configuration -> [String]
cTemplatePaths :: ![FilePath]
, Configuration -> HashMap Text Text
cVariables :: !(HashMap Text Text)
, :: !HeadersConfig
}
deriving (Configuration -> Configuration -> Bool
(Configuration -> Configuration -> Bool)
-> (Configuration -> Configuration -> Bool) -> Eq Configuration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Configuration -> Configuration -> Bool
$c/= :: Configuration -> Configuration -> Bool
== :: Configuration -> Configuration -> Bool
$c== :: Configuration -> Configuration -> Bool
Eq, Int -> Configuration -> ShowS
[Configuration] -> ShowS
Configuration -> String
(Int -> Configuration -> ShowS)
-> (Configuration -> String)
-> ([Configuration] -> ShowS)
-> Show Configuration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Configuration] -> ShowS
$cshowList :: [Configuration] -> ShowS
show :: Configuration -> String
$cshow :: Configuration -> String
showsPrec :: Int -> Configuration -> ShowS
$cshowsPrec :: Int -> Configuration -> ShowS
Show)
data =
{ HeaderConfig -> [Text]
hcFileExtensions :: ![Text]
, HeaderConfig -> Int
hcMarginAfter :: !Int
, HeaderConfig -> Int
hcMarginBefore :: !Int
, HeaderConfig -> [Text]
hcPutAfter :: ![Text]
, HeaderConfig -> [Text]
hcPutBefore :: ![Text]
, :: !HeaderSyntax
}
deriving (HeaderConfig -> HeaderConfig -> Bool
(HeaderConfig -> HeaderConfig -> Bool)
-> (HeaderConfig -> HeaderConfig -> Bool) -> Eq HeaderConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeaderConfig -> HeaderConfig -> Bool
$c/= :: HeaderConfig -> HeaderConfig -> Bool
== :: HeaderConfig -> HeaderConfig -> Bool
$c== :: HeaderConfig -> HeaderConfig -> Bool
Eq, Int -> HeaderConfig -> ShowS
[HeaderConfig] -> ShowS
HeaderConfig -> String
(Int -> HeaderConfig -> ShowS)
-> (HeaderConfig -> String)
-> ([HeaderConfig] -> ShowS)
-> Show HeaderConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeaderConfig] -> ShowS
$cshowList :: [HeaderConfig] -> ShowS
show :: HeaderConfig -> String
$cshow :: HeaderConfig -> String
showsPrec :: Int -> HeaderConfig -> ShowS
$cshowsPrec :: Int -> HeaderConfig -> ShowS
Show)
data =
{ HeadersConfig -> HeaderConfig
hscC :: !HeaderConfig
, HeadersConfig -> HeaderConfig
hscCpp :: !HeaderConfig
, HeadersConfig -> HeaderConfig
hscCss :: !HeaderConfig
, HeadersConfig -> HeaderConfig
hscHaskell :: !HeaderConfig
, HeadersConfig -> HeaderConfig
hscHtml :: !HeaderConfig
, HeadersConfig -> HeaderConfig
hscJava :: !HeaderConfig
, HeadersConfig -> HeaderConfig
hscJs :: !HeaderConfig
, HeadersConfig -> HeaderConfig
hscRust :: !HeaderConfig
, HeadersConfig -> HeaderConfig
hscScala :: !HeaderConfig
, HeadersConfig -> HeaderConfig
hscShell :: !HeaderConfig
}
deriving (HeadersConfig -> HeadersConfig -> Bool
(HeadersConfig -> HeadersConfig -> Bool)
-> (HeadersConfig -> HeadersConfig -> Bool) -> Eq HeadersConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeadersConfig -> HeadersConfig -> Bool
$c/= :: HeadersConfig -> HeadersConfig -> Bool
== :: HeadersConfig -> HeadersConfig -> Bool
$c== :: HeadersConfig -> HeadersConfig -> Bool
Eq, Int -> HeadersConfig -> ShowS
[HeadersConfig] -> ShowS
HeadersConfig -> String
(Int -> HeadersConfig -> ShowS)
-> (HeadersConfig -> String)
-> ([HeadersConfig] -> ShowS)
-> Show HeadersConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeadersConfig] -> ShowS
$cshowList :: [HeadersConfig] -> ShowS
show :: HeadersConfig -> String
$cshow :: HeadersConfig -> String
showsPrec :: Int -> HeadersConfig -> ShowS
$cshowsPrec :: Int -> HeadersConfig -> ShowS
Show)
data =
{ BlockComment' -> Text
bcStartsWith :: !Text
, BlockComment' -> Text
bcEndsWith :: !Text
}
deriving (BlockComment' -> BlockComment' -> Bool
(BlockComment' -> BlockComment' -> Bool)
-> (BlockComment' -> BlockComment' -> Bool) -> Eq BlockComment'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BlockComment' -> BlockComment' -> Bool
$c/= :: BlockComment' -> BlockComment' -> Bool
== :: BlockComment' -> BlockComment' -> Bool
$c== :: BlockComment' -> BlockComment' -> Bool
Eq, (forall x. BlockComment' -> Rep BlockComment' x)
-> (forall x. Rep BlockComment' x -> BlockComment')
-> Generic BlockComment'
forall x. Rep BlockComment' x -> BlockComment'
forall x. BlockComment' -> Rep BlockComment' x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BlockComment' x -> BlockComment'
$cfrom :: forall x. BlockComment' -> Rep BlockComment' x
Generic, Int -> BlockComment' -> ShowS
[BlockComment'] -> ShowS
BlockComment' -> String
(Int -> BlockComment' -> ShowS)
-> (BlockComment' -> String)
-> ([BlockComment'] -> ShowS)
-> Show BlockComment'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BlockComment'] -> ShowS
$cshowList :: [BlockComment'] -> ShowS
show :: BlockComment' -> String
$cshow :: BlockComment' -> String
showsPrec :: Int -> BlockComment' -> ShowS
$cshowsPrec :: Int -> BlockComment' -> ShowS
Show)
newtype =
{ LineComment' -> Text
lcPrefixedBy :: Text
}
deriving (LineComment' -> LineComment' -> Bool
(LineComment' -> LineComment' -> Bool)
-> (LineComment' -> LineComment' -> Bool) -> Eq LineComment'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LineComment' -> LineComment' -> Bool
$c/= :: LineComment' -> LineComment' -> Bool
== :: LineComment' -> LineComment' -> Bool
$c== :: LineComment' -> LineComment' -> Bool
Eq, (forall x. LineComment' -> Rep LineComment' x)
-> (forall x. Rep LineComment' x -> LineComment')
-> Generic LineComment'
forall x. Rep LineComment' x -> LineComment'
forall x. LineComment' -> Rep LineComment' x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LineComment' x -> LineComment'
$cfrom :: forall x. LineComment' -> Rep LineComment' x
Generic, Int -> LineComment' -> ShowS
[LineComment'] -> ShowS
LineComment' -> String
(Int -> LineComment' -> ShowS)
-> (LineComment' -> String)
-> ([LineComment'] -> ShowS)
-> Show LineComment'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LineComment'] -> ShowS
$cshowList :: [LineComment'] -> ShowS
show :: LineComment' -> String
$cshow :: LineComment' -> String
showsPrec :: Int -> LineComment' -> ShowS
$cshowsPrec :: Int -> LineComment' -> ShowS
Show)
data PartialConfiguration = PartialConfiguration
{ PartialConfiguration -> Last RunMode
pcRunMode :: !(Last RunMode)
, PartialConfiguration -> Last [String]
pcSourcePaths :: !(Last [FilePath])
, PartialConfiguration -> Last [Text]
pcExcludedPaths :: !(Last [Text])
, PartialConfiguration -> Last [String]
pcTemplatePaths :: !(Last [FilePath])
, PartialConfiguration -> Last (HashMap Text Text)
pcVariables :: !(Last (HashMap Text Text))
, :: !PartialHeadersConfig
}
deriving (PartialConfiguration -> PartialConfiguration -> Bool
(PartialConfiguration -> PartialConfiguration -> Bool)
-> (PartialConfiguration -> PartialConfiguration -> Bool)
-> Eq PartialConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PartialConfiguration -> PartialConfiguration -> Bool
$c/= :: PartialConfiguration -> PartialConfiguration -> Bool
== :: PartialConfiguration -> PartialConfiguration -> Bool
$c== :: PartialConfiguration -> PartialConfiguration -> Bool
Eq, (forall x. PartialConfiguration -> Rep PartialConfiguration x)
-> (forall x. Rep PartialConfiguration x -> PartialConfiguration)
-> Generic PartialConfiguration
forall x. Rep PartialConfiguration x -> PartialConfiguration
forall x. PartialConfiguration -> Rep PartialConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PartialConfiguration x -> PartialConfiguration
$cfrom :: forall x. PartialConfiguration -> Rep PartialConfiguration x
Generic, Int -> PartialConfiguration -> ShowS
[PartialConfiguration] -> ShowS
PartialConfiguration -> String
(Int -> PartialConfiguration -> ShowS)
-> (PartialConfiguration -> String)
-> ([PartialConfiguration] -> ShowS)
-> Show PartialConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PartialConfiguration] -> ShowS
$cshowList :: [PartialConfiguration] -> ShowS
show :: PartialConfiguration -> String
$cshow :: PartialConfiguration -> String
showsPrec :: Int -> PartialConfiguration -> ShowS
$cshowsPrec :: Int -> PartialConfiguration -> ShowS
Show)
data =
{ PartialHeaderConfig -> Last [Text]
phcFileExtensions :: !(Last [Text])
, PartialHeaderConfig -> Last Int
phcMarginAfter :: !(Last Int)
, PartialHeaderConfig -> Last Int
phcMarginBefore :: !(Last Int)
, PartialHeaderConfig -> Last [Text]
phcPutAfter :: !(Last [Text])
, PartialHeaderConfig -> Last [Text]
phcPutBefore :: !(Last [Text])
, :: !(Last HeaderSyntax)
}
deriving (PartialHeaderConfig -> PartialHeaderConfig -> Bool
(PartialHeaderConfig -> PartialHeaderConfig -> Bool)
-> (PartialHeaderConfig -> PartialHeaderConfig -> Bool)
-> Eq PartialHeaderConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PartialHeaderConfig -> PartialHeaderConfig -> Bool
$c/= :: PartialHeaderConfig -> PartialHeaderConfig -> Bool
== :: PartialHeaderConfig -> PartialHeaderConfig -> Bool
$c== :: PartialHeaderConfig -> PartialHeaderConfig -> Bool
Eq, (forall x. PartialHeaderConfig -> Rep PartialHeaderConfig x)
-> (forall x. Rep PartialHeaderConfig x -> PartialHeaderConfig)
-> Generic PartialHeaderConfig
forall x. Rep PartialHeaderConfig x -> PartialHeaderConfig
forall x. PartialHeaderConfig -> Rep PartialHeaderConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PartialHeaderConfig x -> PartialHeaderConfig
$cfrom :: forall x. PartialHeaderConfig -> Rep PartialHeaderConfig x
Generic, Int -> PartialHeaderConfig -> ShowS
[PartialHeaderConfig] -> ShowS
PartialHeaderConfig -> String
(Int -> PartialHeaderConfig -> ShowS)
-> (PartialHeaderConfig -> String)
-> ([PartialHeaderConfig] -> ShowS)
-> Show PartialHeaderConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PartialHeaderConfig] -> ShowS
$cshowList :: [PartialHeaderConfig] -> ShowS
show :: PartialHeaderConfig -> String
$cshow :: PartialHeaderConfig -> String
showsPrec :: Int -> PartialHeaderConfig -> ShowS
$cshowsPrec :: Int -> PartialHeaderConfig -> ShowS
Show)
data =
{ PartialHeadersConfig -> PartialHeaderConfig
phscC :: !PartialHeaderConfig
, PartialHeadersConfig -> PartialHeaderConfig
phscCpp :: !PartialHeaderConfig
, PartialHeadersConfig -> PartialHeaderConfig
phscCss :: !PartialHeaderConfig
, PartialHeadersConfig -> PartialHeaderConfig
phscHaskell :: !PartialHeaderConfig
, PartialHeadersConfig -> PartialHeaderConfig
phscHtml :: !PartialHeaderConfig
, PartialHeadersConfig -> PartialHeaderConfig
phscJava :: !PartialHeaderConfig
, PartialHeadersConfig -> PartialHeaderConfig
phscJs :: !PartialHeaderConfig
, PartialHeadersConfig -> PartialHeaderConfig
phscRust :: !PartialHeaderConfig
, PartialHeadersConfig -> PartialHeaderConfig
phscScala :: !PartialHeaderConfig
, PartialHeadersConfig -> PartialHeaderConfig
phscShell :: !PartialHeaderConfig
}
deriving (PartialHeadersConfig -> PartialHeadersConfig -> Bool
(PartialHeadersConfig -> PartialHeadersConfig -> Bool)
-> (PartialHeadersConfig -> PartialHeadersConfig -> Bool)
-> Eq PartialHeadersConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PartialHeadersConfig -> PartialHeadersConfig -> Bool
$c/= :: PartialHeadersConfig -> PartialHeadersConfig -> Bool
== :: PartialHeadersConfig -> PartialHeadersConfig -> Bool
$c== :: PartialHeadersConfig -> PartialHeadersConfig -> Bool
Eq, (forall x. PartialHeadersConfig -> Rep PartialHeadersConfig x)
-> (forall x. Rep PartialHeadersConfig x -> PartialHeadersConfig)
-> Generic PartialHeadersConfig
forall x. Rep PartialHeadersConfig x -> PartialHeadersConfig
forall x. PartialHeadersConfig -> Rep PartialHeadersConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PartialHeadersConfig x -> PartialHeadersConfig
$cfrom :: forall x. PartialHeadersConfig -> Rep PartialHeadersConfig x
Generic, Int -> PartialHeadersConfig -> ShowS
[PartialHeadersConfig] -> ShowS
PartialHeadersConfig -> String
(Int -> PartialHeadersConfig -> ShowS)
-> (PartialHeadersConfig -> String)
-> ([PartialHeadersConfig] -> ShowS)
-> Show PartialHeadersConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PartialHeadersConfig] -> ShowS
$cshowList :: [PartialHeadersConfig] -> ShowS
show :: PartialHeadersConfig -> String
$cshow :: PartialHeadersConfig -> String
showsPrec :: Int -> PartialHeadersConfig -> ShowS
$cshowsPrec :: Int -> PartialHeadersConfig -> ShowS
Show)
instance FromJSON BlockComment' where
parseJSON :: Value -> Parser BlockComment'
parseJSON = Options -> Value -> Parser BlockComment'
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance FromJSON LineComment' where
parseJSON :: Value -> Parser LineComment'
parseJSON = Options -> Value -> Parser LineComment'
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
aesonOptions
instance FromJSON PartialConfiguration where
parseJSON :: Value -> Parser PartialConfiguration
parseJSON = String
-> (Object -> Parser PartialConfiguration)
-> Value
-> Parser PartialConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject "PartialConfiguration" ((Object -> Parser PartialConfiguration)
-> Value -> Parser PartialConfiguration)
-> (Object -> Parser PartialConfiguration)
-> Value
-> Parser PartialConfiguration
forall a b. (a -> b) -> a -> b
$ \obj :: Object
obj -> do
Last RunMode
pcRunMode <- Maybe RunMode -> Last RunMode
forall a. Maybe a -> Last a
Last (Maybe RunMode -> Last RunMode)
-> Parser (Maybe RunMode) -> Parser (Last RunMode)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe RunMode)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "run-mode"
Last [String]
pcSourcePaths <- Maybe [String] -> Last [String]
forall a. Maybe a -> Last a
Last (Maybe [String] -> Last [String])
-> Parser (Maybe [String]) -> Parser (Last [String])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe [String])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "source-paths"
Last [Text]
pcExcludedPaths <- Maybe [Text] -> Last [Text]
forall a. Maybe a -> Last a
Last (Maybe [Text] -> Last [Text])
-> Parser (Maybe [Text]) -> Parser (Last [Text])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "excluded-paths"
Last [String]
pcTemplatePaths <- Maybe [String] -> Last [String]
forall a. Maybe a -> Last a
Last (Maybe [String] -> Last [String])
-> Parser (Maybe [String]) -> Parser (Last [String])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe [String])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "template-paths"
Last (HashMap Text Text)
pcVariables <- Maybe (HashMap Text Text) -> Last (HashMap Text Text)
forall a. Maybe a -> Last a
Last (Maybe (HashMap Text Text) -> Last (HashMap Text Text))
-> Parser (Maybe (HashMap Text Text))
-> Parser (Last (HashMap Text Text))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe (HashMap Text Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "variables"
PartialHeadersConfig
pcLicenseHeaders <- Object
obj Object -> Text -> Parser (Maybe PartialHeadersConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "license-headers" Parser (Maybe PartialHeadersConfig)
-> PartialHeadersConfig -> Parser PartialHeadersConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeadersConfig
forall a. Monoid a => a
mempty
PartialConfiguration -> Parser PartialConfiguration
forall (f :: * -> *) a. Applicative f => a -> f a
pure $WPartialConfiguration :: Last RunMode
-> Last [String]
-> Last [Text]
-> Last [String]
-> Last (HashMap Text Text)
-> PartialHeadersConfig
-> PartialConfiguration
PartialConfiguration { .. }
instance FromJSON PartialHeaderConfig where
parseJSON :: Value -> Parser PartialHeaderConfig
parseJSON = String
-> (Object -> Parser PartialHeaderConfig)
-> Value
-> Parser PartialHeaderConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject "PartialHeaderConfig" ((Object -> Parser PartialHeaderConfig)
-> Value -> Parser PartialHeaderConfig)
-> (Object -> Parser PartialHeaderConfig)
-> Value
-> Parser PartialHeaderConfig
forall a b. (a -> b) -> a -> b
$ \obj :: Object
obj -> do
Last [Text]
phcFileExtensions <- Maybe [Text] -> Last [Text]
forall a. Maybe a -> Last a
Last (Maybe [Text] -> Last [Text])
-> Parser (Maybe [Text]) -> Parser (Last [Text])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "file-extensions"
Last Int
phcMarginAfter <- Maybe Int -> Last Int
forall a. Maybe a -> Last a
Last (Maybe Int -> Last Int) -> Parser (Maybe Int) -> Parser (Last Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "margin-after"
Last Int
phcMarginBefore <- Maybe Int -> Last Int
forall a. Maybe a -> Last a
Last (Maybe Int -> Last Int) -> Parser (Maybe Int) -> Parser (Last Int)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "margin-before"
Last [Text]
phcPutAfter <- Maybe [Text] -> Last [Text]
forall a. Maybe a -> Last a
Last (Maybe [Text] -> Last [Text])
-> Parser (Maybe [Text]) -> Parser (Last [Text])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "put-after"
Last [Text]
phcPutBefore <- Maybe [Text] -> Last [Text]
forall a. Maybe a -> Last a
Last (Maybe [Text] -> Last [Text])
-> Parser (Maybe [Text]) -> Parser (Last [Text])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "put-before"
Maybe BlockComment'
blockComment <- Object
obj Object -> Text -> Parser (Maybe BlockComment')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "block-comment"
Maybe LineComment'
lineComment <- Object
obj Object -> Text -> Parser (Maybe LineComment')
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "line-comment"
let phcHeaderSyntax :: Last HeaderSyntax
phcHeaderSyntax = Maybe HeaderSyntax -> Last HeaderSyntax
forall a. Maybe a -> Last a
Last (Maybe HeaderSyntax -> Last HeaderSyntax)
-> Maybe HeaderSyntax -> Last HeaderSyntax
forall a b. (a -> b) -> a -> b
$ Maybe BlockComment' -> Maybe LineComment' -> Maybe HeaderSyntax
headerSyntax Maybe BlockComment'
blockComment Maybe LineComment'
lineComment
PartialHeaderConfig -> Parser PartialHeaderConfig
forall (f :: * -> *) a. Applicative f => a -> f a
pure $WPartialHeaderConfig :: Last [Text]
-> Last Int
-> Last Int
-> Last [Text]
-> Last [Text]
-> Last HeaderSyntax
-> PartialHeaderConfig
PartialHeaderConfig { .. }
where
headerSyntax :: Maybe BlockComment' -> Maybe LineComment' -> Maybe HeaderSyntax
headerSyntax (Just (BlockComment' s :: Text
s e :: Text
e)) Nothing = HeaderSyntax -> Maybe HeaderSyntax
forall a. a -> Maybe a
Just (HeaderSyntax -> Maybe HeaderSyntax)
-> HeaderSyntax -> Maybe HeaderSyntax
forall a b. (a -> b) -> a -> b
$ Text -> Text -> HeaderSyntax
BlockComment Text
s Text
e
headerSyntax Nothing (Just (LineComment' p :: Text
p)) = HeaderSyntax -> Maybe HeaderSyntax
forall a. a -> Maybe a
Just (HeaderSyntax -> Maybe HeaderSyntax)
-> HeaderSyntax -> Maybe HeaderSyntax
forall a b. (a -> b) -> a -> b
$ Text -> HeaderSyntax
LineComment Text
p
headerSyntax Nothing Nothing = Maybe HeaderSyntax
forall a. Maybe a
Nothing
headerSyntax _ _ = ApplicationError -> Maybe HeaderSyntax
forall a e. Exception e => e -> a
throw ApplicationError
error'
error' :: ApplicationError
error' = ConfigurationError -> ApplicationError
ConfigurationError ConfigurationError
MixedHeaderSyntax
instance FromJSON PartialHeadersConfig where
parseJSON :: Value -> Parser PartialHeadersConfig
parseJSON = String
-> (Object -> Parser PartialHeadersConfig)
-> Value
-> Parser PartialHeadersConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
withObject "PartialHeadersConfig" ((Object -> Parser PartialHeadersConfig)
-> Value -> Parser PartialHeadersConfig)
-> (Object -> Parser PartialHeadersConfig)
-> Value
-> Parser PartialHeadersConfig
forall a b. (a -> b) -> a -> b
$ \obj :: Object
obj -> do
PartialHeaderConfig
phscC <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "c" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
phscCpp <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "cpp" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
phscCss <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "css" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
phscHaskell <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "haskell" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
phscHtml <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "html" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
phscJava <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "java" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
phscJs <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "js" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
phscRust <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "rust" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
phscScala <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "scala" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
phscShell <- Object
obj Object -> Text -> Parser (Maybe PartialHeaderConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
.:? "shell" Parser (Maybe PartialHeaderConfig)
-> PartialHeaderConfig -> Parser PartialHeaderConfig
forall a. Parser (Maybe a) -> a -> Parser a
.!= PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeadersConfig -> Parser PartialHeadersConfig
forall (f :: * -> *) a. Applicative f => a -> f a
pure $WPartialHeadersConfig :: PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeadersConfig
PartialHeadersConfig { .. }
instance Semigroup PartialConfiguration where
x :: PartialConfiguration
x <> :: PartialConfiguration
-> PartialConfiguration -> PartialConfiguration
<> y :: PartialConfiguration
y = $WPartialConfiguration :: Last RunMode
-> Last [String]
-> Last [Text]
-> Last [String]
-> Last (HashMap Text Text)
-> PartialHeadersConfig
-> PartialConfiguration
PartialConfiguration
{ pcRunMode :: Last RunMode
pcRunMode = PartialConfiguration -> Last RunMode
pcRunMode PartialConfiguration
x Last RunMode -> Last RunMode -> Last RunMode
forall a. Semigroup a => a -> a -> a
<> PartialConfiguration -> Last RunMode
pcRunMode PartialConfiguration
y
, pcSourcePaths :: Last [String]
pcSourcePaths = PartialConfiguration -> Last [String]
pcSourcePaths PartialConfiguration
x Last [String] -> Last [String] -> Last [String]
forall a. Semigroup a => a -> a -> a
<> PartialConfiguration -> Last [String]
pcSourcePaths PartialConfiguration
y
, pcExcludedPaths :: Last [Text]
pcExcludedPaths = PartialConfiguration -> Last [Text]
pcExcludedPaths PartialConfiguration
x Last [Text] -> Last [Text] -> Last [Text]
forall a. Semigroup a => a -> a -> a
<> PartialConfiguration -> Last [Text]
pcExcludedPaths PartialConfiguration
y
, pcTemplatePaths :: Last [String]
pcTemplatePaths = PartialConfiguration -> Last [String]
pcTemplatePaths PartialConfiguration
x Last [String] -> Last [String] -> Last [String]
forall a. Semigroup a => a -> a -> a
<> PartialConfiguration -> Last [String]
pcTemplatePaths PartialConfiguration
y
, pcVariables :: Last (HashMap Text Text)
pcVariables = PartialConfiguration -> Last (HashMap Text Text)
pcVariables PartialConfiguration
x Last (HashMap Text Text)
-> Last (HashMap Text Text) -> Last (HashMap Text Text)
forall a. Semigroup a => a -> a -> a
<> PartialConfiguration -> Last (HashMap Text Text)
pcVariables PartialConfiguration
y
, pcLicenseHeaders :: PartialHeadersConfig
pcLicenseHeaders = PartialConfiguration -> PartialHeadersConfig
pcLicenseHeaders PartialConfiguration
x PartialHeadersConfig
-> PartialHeadersConfig -> PartialHeadersConfig
forall a. Semigroup a => a -> a -> a
<> PartialConfiguration -> PartialHeadersConfig
pcLicenseHeaders PartialConfiguration
y
}
instance Semigroup PartialHeaderConfig where
x :: PartialHeaderConfig
x <> :: PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
<> y :: PartialHeaderConfig
y = $WPartialHeaderConfig :: Last [Text]
-> Last Int
-> Last Int
-> Last [Text]
-> Last [Text]
-> Last HeaderSyntax
-> PartialHeaderConfig
PartialHeaderConfig
{ phcFileExtensions :: Last [Text]
phcFileExtensions = PartialHeaderConfig -> Last [Text]
phcFileExtensions PartialHeaderConfig
x Last [Text] -> Last [Text] -> Last [Text]
forall a. Semigroup a => a -> a -> a
<> PartialHeaderConfig -> Last [Text]
phcFileExtensions PartialHeaderConfig
y
, phcMarginAfter :: Last Int
phcMarginAfter = PartialHeaderConfig -> Last Int
phcMarginAfter PartialHeaderConfig
x Last Int -> Last Int -> Last Int
forall a. Semigroup a => a -> a -> a
<> PartialHeaderConfig -> Last Int
phcMarginAfter PartialHeaderConfig
y
, phcMarginBefore :: Last Int
phcMarginBefore = PartialHeaderConfig -> Last Int
phcMarginBefore PartialHeaderConfig
x Last Int -> Last Int -> Last Int
forall a. Semigroup a => a -> a -> a
<> PartialHeaderConfig -> Last Int
phcMarginBefore PartialHeaderConfig
y
, phcPutAfter :: Last [Text]
phcPutAfter = PartialHeaderConfig -> Last [Text]
phcPutAfter PartialHeaderConfig
x Last [Text] -> Last [Text] -> Last [Text]
forall a. Semigroup a => a -> a -> a
<> PartialHeaderConfig -> Last [Text]
phcPutAfter PartialHeaderConfig
y
, phcPutBefore :: Last [Text]
phcPutBefore = PartialHeaderConfig -> Last [Text]
phcPutBefore PartialHeaderConfig
x Last [Text] -> Last [Text] -> Last [Text]
forall a. Semigroup a => a -> a -> a
<> PartialHeaderConfig -> Last [Text]
phcPutBefore PartialHeaderConfig
y
, phcHeaderSyntax :: Last HeaderSyntax
phcHeaderSyntax = PartialHeaderConfig -> Last HeaderSyntax
phcHeaderSyntax PartialHeaderConfig
x Last HeaderSyntax -> Last HeaderSyntax -> Last HeaderSyntax
forall a. Semigroup a => a -> a -> a
<> PartialHeaderConfig -> Last HeaderSyntax
phcHeaderSyntax PartialHeaderConfig
y
}
instance Semigroup PartialHeadersConfig where
x :: PartialHeadersConfig
x <> :: PartialHeadersConfig
-> PartialHeadersConfig -> PartialHeadersConfig
<> y :: PartialHeadersConfig
y = $WPartialHeadersConfig :: PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeadersConfig
PartialHeadersConfig { phscC :: PartialHeaderConfig
phscC = PartialHeadersConfig -> PartialHeaderConfig
phscC PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscC PartialHeadersConfig
y
, phscCpp :: PartialHeaderConfig
phscCpp = PartialHeadersConfig -> PartialHeaderConfig
phscCpp PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscCpp PartialHeadersConfig
y
, phscCss :: PartialHeaderConfig
phscCss = PartialHeadersConfig -> PartialHeaderConfig
phscCss PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscCss PartialHeadersConfig
y
, phscHaskell :: PartialHeaderConfig
phscHaskell = PartialHeadersConfig -> PartialHeaderConfig
phscHaskell PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscHaskell PartialHeadersConfig
y
, phscHtml :: PartialHeaderConfig
phscHtml = PartialHeadersConfig -> PartialHeaderConfig
phscHtml PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscHtml PartialHeadersConfig
y
, phscJava :: PartialHeaderConfig
phscJava = PartialHeadersConfig -> PartialHeaderConfig
phscJava PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscJava PartialHeadersConfig
y
, phscJs :: PartialHeaderConfig
phscJs = PartialHeadersConfig -> PartialHeaderConfig
phscJs PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscJs PartialHeadersConfig
y
, phscRust :: PartialHeaderConfig
phscRust = PartialHeadersConfig -> PartialHeaderConfig
phscRust PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscRust PartialHeadersConfig
y
, phscScala :: PartialHeaderConfig
phscScala = PartialHeadersConfig -> PartialHeaderConfig
phscScala PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscScala PartialHeadersConfig
y
, phscShell :: PartialHeaderConfig
phscShell = PartialHeadersConfig -> PartialHeaderConfig
phscShell PartialHeadersConfig
x PartialHeaderConfig -> PartialHeaderConfig -> PartialHeaderConfig
forall a. Semigroup a => a -> a -> a
<> PartialHeadersConfig -> PartialHeaderConfig
phscShell PartialHeadersConfig
y
}
instance Monoid PartialConfiguration where
mempty :: PartialConfiguration
mempty = Last RunMode
-> Last [String]
-> Last [Text]
-> Last [String]
-> Last (HashMap Text Text)
-> PartialHeadersConfig
-> PartialConfiguration
PartialConfiguration Last RunMode
forall a. Monoid a => a
mempty Last [String]
forall a. Monoid a => a
mempty Last [Text]
forall a. Monoid a => a
mempty Last [String]
forall a. Monoid a => a
mempty Last (HashMap Text Text)
forall a. Monoid a => a
mempty PartialHeadersConfig
forall a. Monoid a => a
mempty
instance Monoid PartialHeaderConfig where
mempty :: PartialHeaderConfig
mempty = Last [Text]
-> Last Int
-> Last Int
-> Last [Text]
-> Last [Text]
-> Last HeaderSyntax
-> PartialHeaderConfig
PartialHeaderConfig Last [Text]
forall a. Monoid a => a
mempty Last Int
forall a. Monoid a => a
mempty Last Int
forall a. Monoid a => a
mempty Last [Text]
forall a. Monoid a => a
mempty Last [Text]
forall a. Monoid a => a
mempty Last HeaderSyntax
forall a. Monoid a => a
mempty
instance Monoid PartialHeadersConfig where
mempty :: PartialHeadersConfig
mempty = PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeaderConfig
-> PartialHeadersConfig
PartialHeadersConfig PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
forall a. Monoid a => a
mempty
PartialHeaderConfig
forall a. Monoid a => a
mempty
commandGenError :: CommandGenError -> Text
commandGenError :: CommandGenError -> Text
commandGenError = \case
NoGenModeSelected -> Text
noGenModeSelected
where
noGenModeSelected :: Text
noGenModeSelected = [Text] -> Text
forall a. Monoid a => [a] -> a
mconcat
[ "Please select at least one option what to generate "
, "(see --help for details)"
]
commandInitError :: CommandInitError -> Text
commandInitError :: CommandInitError -> Text
commandInitError = \case
AppConfigAlreadyExists path :: String
path -> String -> Text
appConfigAlreadyExists String
path
NoProvidedSourcePaths -> Text
noProvidedSourcePaths
NoSupportedFileType -> Text
noSupportedFileType
where
appConfigAlreadyExists :: String -> Text
appConfigAlreadyExists path :: String
path =
[Text] -> Text
forall a. Monoid a => [a] -> a
mconcat ["Configuration file '", String -> Text
T.pack String
path, "' already exists"]
noProvidedSourcePaths :: Text
noProvidedSourcePaths = "No source code paths (files or directories) defined"
noSupportedFileType :: Text
noSupportedFileType = "No supported file type found in scanned source paths"
configurationError :: ConfigurationError -> Text
configurationError :: ConfigurationError -> Text
configurationError = \case
InvalidVariable input :: Text
input -> Text -> Text
invalidVariable Text
input
MixedHeaderSyntax -> Text
mixedHeaderSyntax
NoFileExtensions fileType :: FileType
fileType -> String -> FileType -> Text
forall a. Show a => String -> a -> Text
noProp "file-extensions" FileType
fileType
NoHeaderSyntax fileType :: FileType
fileType -> String -> FileType -> Text
forall a. Show a => String -> a -> Text
noProp "block-comment/line-comment" FileType
fileType
NoMarginAfter fileType :: FileType
fileType -> String -> FileType -> Text
forall a. Show a => String -> a -> Text
noProp "margin-after" FileType
fileType
NoMarginBefore fileType :: FileType
fileType -> String -> FileType -> Text
forall a. Show a => String -> a -> Text
noProp "margin-before" FileType
fileType
NoPutAfter fileType :: FileType
fileType -> String -> FileType -> Text
forall a. Show a => String -> a -> Text
noProp "put-after" FileType
fileType
NoPutBefore fileType :: FileType
fileType -> String -> FileType -> Text
forall a. Show a => String -> a -> Text
noProp "put-before" FileType
fileType
NoRunMode -> Text -> Text
forall a. (Monoid a, IsString a) => a -> a
noFlag "run-mode"
NoSourcePaths -> Text -> Text
forall a. (Monoid a, IsString a) => a -> a
noFlag "source-paths"
NoExcludedPaths -> Text -> Text
forall a. (Monoid a, IsString a) => a -> a
noFlag "excluded-paths"
NoTemplatePaths -> Text -> Text
forall a. (Monoid a, IsString a) => a -> a
noFlag "template-paths"
NoVariables -> Text -> Text
forall a. (Monoid a, IsString a) => a -> a
noFlag "variables"
where
invalidVariable :: Text -> Text
invalidVariable = ("Cannot parse variable key=value from: " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<>)
noProp :: String -> a -> Text
noProp prop :: String
prop fileType :: a
fileType = String -> Text
T.pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ [String] -> String
forall a. Monoid a => [a] -> a
mconcat
["Missing '", String
prop, "' configuration key for file type", a -> String
forall a. Show a => a -> String
show a
fileType]
noFlag :: a -> a
noFlag flag :: a
flag = [a] -> a
forall a. Monoid a => [a] -> a
mconcat ["Missing configuration key: ", a
flag]
mixedHeaderSyntax :: Text
mixedHeaderSyntax = [Text] -> Text
forall a. Monoid a => [a] -> a
mconcat
[ "Invalid configuration, combining 'block-comment' with 'line-comment' "
, "is not allowed. Either use 'block-comment' to define multi-line "
, "comment header, or 'line-comment' to define header composed of "
, "multiple single-line comments."
]
templateError :: TemplateError -> Text
templateError :: TemplateError -> Text
templateError = \case
MissingVariables name :: Text
name variables :: [Text]
variables -> Text -> [Text] -> Text
forall a. Show a => Text -> a -> Text
missingVariables Text
name [Text]
variables
ParseError msg :: Text
msg -> Text -> Text
forall a. (Semigroup a, IsString a) => a -> a
parseError Text
msg
where
missingVariables :: Text -> a -> Text
missingVariables name :: Text
name variables :: a
variables = [Text] -> Text
forall a. Monoid a => [a] -> a
mconcat
["Missing variables for template '", Text
name, "': ", String -> Text
T.pack (String -> Text) -> String -> Text
forall a b. (a -> b) -> a -> b
$ a -> String
forall a. Show a => a -> String
show a
variables]
parseError :: a -> a
parseError msg :: a
msg = "Error parsing template: " a -> a -> a
forall a. Semigroup a => a -> a -> a
<> a
msg