headroom-0.1.3.0: src/Headroom/Command/Gen/Env.hs
{-|
Module : Headroom.Command.Gen.Env
Description : Environment for the Generate command
Copyright : (c) 2019-2020 Vaclav Svejcar
License : BSD-3
Maintainer : vaclav.svejcar@gmail.com
Stability : experimental
Portability : POSIX
Data types and instances for the /Generator/ command environment.
-}
{-# LANGUAGE NoImplicitPrelude #-}
module Headroom.Command.Gen.Env
( Env(..)
, GenMode(..)
, GenOptions(..)
)
where
import RIO
-- | /RIO/ Environment for the /Generator/ command.
data Env = Env
{ envLogFunc :: !LogFunc -- ^ logging function
, envGenOptions :: !GenOptions -- ^ options
}
-- | Represents what action should the /Generator/ perform.
data GenMode
= GenConfigFile -- ^ generate /YAML/ config file stub
| GenLicense Text -- ^ generate license header template
deriving (Eq, Show)
-- | Options for the /Generator/ command.
newtype GenOptions = GenOptions
{ goGenMode :: GenMode -- ^ used /Generator/ command mode
}
deriving Show
instance HasLogFunc Env where
logFuncL = lens envLogFunc (\x y -> x { envLogFunc = y })