Safe Haskell | None |
---|
Writer
Description
Persist template.
Note: If there are many templates the operation is not atomic.
Synopsis
- newtype WriterError = FailedToWrite String
- mkOutputDir :: AbsDir -> Map String RelDir -> String -> AbsDir
- getNameWithExt :: Bool -> Maybe Char -> Template -> RelFile
- getFileHandler :: AbsDir -> RelFile -> IO Handle
- persistWithContent :: String -> Handle -> IO ()
- combineWhenModule :: Bool -> Template -> AbsDir -> AbsDir
- write :: AbsDir -> Bool -> GenConfig -> Template -> IO (Either WriterError String)
- writeDotfile :: AbsDir -> ByteString -> IO (Either WriterError String)
Documentation
newtype WriterError #
WriterError represents all the possible error states in the Write module
Constructors
FailedToWrite String | The process failed to write for some reason. More information should be found in the string. |
Instances
Show WriterError # | |
Defined in Writer Methods showsPrec :: Int -> WriterError -> ShowS show :: WriterError -> String showList :: [WriterError] -> ShowS |
mkOutputDir :: AbsDir -> Map String RelDir -> String -> AbsDir #
getNameWithExt :: Bool -> Maybe Char -> Template -> RelFile #
getFileHandler :: AbsDir -> RelFile -> IO Handle #
persistWithContent :: String -> Handle -> IO () #
combineWhenModule :: Bool -> Template -> AbsDir -> AbsDir #
Arguments
:: AbsDir | Current working directory |
-> Bool | Whether to write the file as a module. If true, it will create a directory and save the templates in it. |
-> GenConfig | Config |
-> Template | Template to write to the output directory |
-> IO (Either WriterError String) |
Write template file to output directory.
Arguments
:: AbsDir | Current working directory |
-> ByteString | Dotfile contents as JSON string |
-> IO (Either WriterError String) |
Write dotfile in current directory