SKAT engine
Safe HaskellNone

Template

Description

Templates represent the file to be written while holding information from the source template.

Synopsis

Documentation

data Template #

A Template represents the file that is going to be written. It contains the content from the source template as well as the source path which is the filename of the source template

Constructors

Template 

Fields

  • name :: String

    Name of the Template. The name comes from the Command.

  • suffix :: String

    Suffix for the file name. It comes from the source path and it is identified when the source path is split by rhe filenameSeparator. It is also optional.

  • content :: String

    Actual contents of the template.

  • extension :: String

    Filename extension.

  • sourcePath :: String

    Original filename of the template.

Instances

Instances details
Eq Template # 
Instance details

Defined in Template

Methods

(==) :: Template -> Template -> Bool

(/=) :: Template -> Template -> Bool

Show Template # 
Instance details

Defined in Template

Methods

showsPrec :: Int -> Template -> ShowS

show :: Template -> String

showList :: [Template] -> ShowS

newtype TemplateError #

Encompasses all possible errors in the Template module

Constructors

NoMatchFound String 

Instances

Instances details
Show TemplateError # 
Instance details

Defined in Template

Methods

showsPrec :: Int -> TemplateError -> ShowS

show :: TemplateError -> String

showList :: [TemplateError] -> ShowS

toTemplate :: Maybe Char -> String -> (String, String) -> Template #

mkSuffix :: Char -> String -> String #

Use the filename separator to find and return the suffix for the template. If there is no suffix the function returns an empty string.

ext :: Char -> String -> String #

mkTemplate :: String -> String -> String -> String -> String -> Template #

Template factory

getTemplateFiles :: AbsDir -> GenConfig -> GenCommand -> IO (Either TemplateError [Template]) #

Iterates through all files in SKAT template's source directory. For each file in the directory it will match all files that start with the what passed in the command.