| Copyright | (c) 2019-2020 Vaclav Svejcar |
|---|---|
| License | BSD-3-Clause |
| Maintainer | vaclav.svejcar@gmail.com |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Headroom.Types
Contents
Description
Module containing most of the data types used by the application.
Synopsis
- data Configuration = Configuration {
- cRunMode :: !RunMode
- cSourcePaths :: ![FilePath]
- cExcludedPaths :: ![Text]
- cTemplatePaths :: ![FilePath]
- cVariables :: !(HashMap Text Text)
- cLicenseHeaders :: !HeadersConfig
- data HeaderConfig = HeaderConfig {
- hcFileExtensions :: ![Text]
- hcMarginAfter :: !Int
- hcMarginBefore :: !Int
- hcPutAfter :: ![Text]
- hcPutBefore :: ![Text]
- hcHeaderSyntax :: !HeaderSyntax
- data HeadersConfig = HeadersConfig {
- hscC :: !HeaderConfig
- hscCpp :: !HeaderConfig
- hscCss :: !HeaderConfig
- hscHaskell :: !HeaderConfig
- hscHtml :: !HeaderConfig
- hscJava :: !HeaderConfig
- hscJs :: !HeaderConfig
- hscRust :: !HeaderConfig
- hscScala :: !HeaderConfig
- hscShell :: !HeaderConfig
- data PartialConfiguration = PartialConfiguration {
- pcRunMode :: !(Last RunMode)
- pcSourcePaths :: !(Last [FilePath])
- pcExcludedPaths :: !(Last [Text])
- pcTemplatePaths :: !(Last [FilePath])
- pcVariables :: !(Last (HashMap Text Text))
- pcLicenseHeaders :: !PartialHeadersConfig
- data PartialHeaderConfig = PartialHeaderConfig {
- phcFileExtensions :: !(Last [Text])
- phcMarginAfter :: !(Last Int)
- phcMarginBefore :: !(Last Int)
- phcPutAfter :: !(Last [Text])
- phcPutBefore :: !(Last [Text])
- phcHeaderSyntax :: !(Last HeaderSyntax)
- data PartialHeadersConfig = PartialHeadersConfig {
- phscC :: !PartialHeaderConfig
- phscCpp :: !PartialHeaderConfig
- phscCss :: !PartialHeaderConfig
- phscHaskell :: !PartialHeaderConfig
- phscHtml :: !PartialHeaderConfig
- phscJava :: !PartialHeaderConfig
- phscJs :: !PartialHeaderConfig
- phscRust :: !PartialHeaderConfig
- phscScala :: !PartialHeaderConfig
- phscShell :: !PartialHeaderConfig
- data HeaderSyntax
- = BlockComment !Text !Text
- | LineComment !Text
- data Command
- newtype CommandGenOptions = CommandGenOptions {}
- data CommandInitOptions = CommandInitOptions {
- cioSourcePaths :: ![FilePath]
- cioLicenseType :: !LicenseType
- data CommandRunOptions = CommandRunOptions {
- croRunMode :: !(Maybe RunMode)
- croSourcePaths :: ![FilePath]
- croExcludedPaths :: ![Text]
- croTemplatePaths :: ![FilePath]
- croVariables :: ![Text]
- croDebug :: !Bool
- croDryRun :: !Bool
- data ConfigurationError
- data RunAction = RunAction {
- raProcessed :: !Bool
- raFunc :: !(Text -> Text)
- raProcessedMsg :: !Text
- raSkippedMsg :: !Text
- data RunMode
- data GenMode
- data ApplicationError
- data CommandGenError = NoGenModeSelected
- data CommandInitError
- data TemplateError
- = MissingVariables !Text ![Text]
- | ParseError !Text
- data LicenseType
- data FileType
- data FileInfo = FileInfo {
- fiFileType :: !FileType
- fiHeaderConfig :: !HeaderConfig
- fiHeaderPos :: !(Maybe (Int, Int))
- fiVariables :: !(HashMap Text Text)
Configuration Data Types
Total Configuration
data Configuration Source #
Application configuration.
Constructors
| Configuration | |
Fields
| |
Instances
| Eq Configuration Source # | |
Defined in Headroom.Types Methods (==) :: Configuration -> Configuration -> Bool # (/=) :: Configuration -> Configuration -> Bool # | |
| Show Configuration Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> Configuration -> ShowS # show :: Configuration -> String # showList :: [Configuration] -> ShowS # | |
data HeaderConfig Source #
Configuration for specific license header.
Constructors
| HeaderConfig | |
Fields
| |
Instances
| Eq HeaderConfig Source # | |
Defined in Headroom.Types | |
| Show HeaderConfig Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> HeaderConfig -> ShowS # show :: HeaderConfig -> String # showList :: [HeaderConfig] -> ShowS # | |
data HeadersConfig Source #
Group of HeaderConfig configurations for supported file types.
Constructors
| HeadersConfig | |
Fields
| |
Instances
| Eq HeadersConfig Source # | |
Defined in Headroom.Types Methods (==) :: HeadersConfig -> HeadersConfig -> Bool # (/=) :: HeadersConfig -> HeadersConfig -> Bool # | |
| Show HeadersConfig Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> HeadersConfig -> ShowS # show :: HeadersConfig -> String # showList :: [HeadersConfig] -> ShowS # | |
Partial Configuration
data PartialConfiguration Source #
Partial (possibly incomplete) version of Configuration.
Constructors
| PartialConfiguration | |
Fields
| |
Instances
data PartialHeaderConfig Source #
Partial (possibly incomplete) version of HeaderConfig.
Constructors
| PartialHeaderConfig | |
Fields
| |
Instances
data PartialHeadersConfig Source #
Partial (possibly incomplete) version of HeadersConfig.
Constructors
| PartialHeadersConfig | |
Fields
| |
Instances
Other Configuration Data Types
data HeaderSyntax Source #
Syntax of the license header comment.
Constructors
| BlockComment !Text !Text | block (multi-line) comment syntax (e.g. |
| LineComment !Text | single line comment syntax (e.g. |
Instances
| Eq HeaderSyntax Source # | |
Defined in Headroom.Types | |
| Show HeaderSyntax Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> HeaderSyntax -> ShowS # show :: HeaderSyntax -> String # showList :: [HeaderSyntax] -> ShowS # | |
Command Data Types
Application command.
newtype CommandGenOptions Source #
Options for the gen command.
Constructors
| CommandGenOptions | |
Fields
| |
Instances
| Show CommandGenOptions Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> CommandGenOptions -> ShowS # show :: CommandGenOptions -> String # showList :: [CommandGenOptions] -> ShowS # | |
data CommandInitOptions Source #
Options for the init command.
Constructors
| CommandInitOptions | |
Fields
| |
Instances
| Show CommandInitOptions Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> CommandInitOptions -> ShowS # show :: CommandInitOptions -> String # showList :: [CommandInitOptions] -> ShowS # | |
| Has CommandInitOptions Env Source # | |
Defined in Headroom.Command.Init Methods getter :: Env -> CommandInitOptions Source # modifier :: (CommandInitOptions -> CommandInitOptions) -> Env -> Env Source # hasLens :: Lens' Env CommandInitOptions Source # viewL :: MonadReader Env m => m CommandInitOptions Source # | |
data CommandRunOptions Source #
Options for the run command.
Constructors
| CommandRunOptions | |
Fields
| |
Instances
| Eq CommandRunOptions Source # | |
Defined in Headroom.Types Methods (==) :: CommandRunOptions -> CommandRunOptions -> Bool # (/=) :: CommandRunOptions -> CommandRunOptions -> Bool # | |
| Show CommandRunOptions Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> CommandRunOptions -> ShowS # show :: CommandRunOptions -> String # showList :: [CommandRunOptions] -> ShowS # | |
data ConfigurationError Source #
Error during processing configuration.
Constructors
| InvalidVariable !Text | invalid variable input (as |
| MixedHeaderSyntax | illegal configuration for |
| NoFileExtensions !FileType | no configuration for |
| NoHeaderSyntax !FileType | no configuration for header syntax |
| NoMarginAfter !FileType | no configuration for |
| NoMarginBefore !FileType | no configuration for |
| NoPutAfter !FileType | no configuration for |
| NoPutBefore !FileType | no configuration for |
| NoRunMode | no configuration for |
| NoSourcePaths | no configuration for |
| NoExcludedPaths | no configuration for |
| NoTemplatePaths | no configuration for |
| NoVariables | no configuration for |
Instances
| Eq ConfigurationError Source # | |
Defined in Headroom.Types Methods (==) :: ConfigurationError -> ConfigurationError -> Bool # (/=) :: ConfigurationError -> ConfigurationError -> Bool # | |
| Show ConfigurationError Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> ConfigurationError -> ShowS # show :: ConfigurationError -> String # showList :: [ConfigurationError] -> ShowS # | |
Action to be performed based on the selected RunMode.
Constructors
| RunAction | |
Fields
| |
Represents what action should the run command perform.
Constructors
| Add | add mode for |
| Check | check mode for |
| Drop | drop mode for |
| Replace | replace mode for |
Represents what action should the gen command perform.
Constructors
| GenConfigFile | generate YAML config file stub |
| GenLicense !(LicenseType, FileType) | generate license header template |
Error Data Types
data ApplicationError Source #
Represents error that can occur during the application execution.
Constructors
| CommandGenError !CommandGenError | error specific for the |
| CommandInitError !CommandInitError | error specific for the |
| ConfigurationError !ConfigurationError | error processing configuration |
| TemplateError !TemplateError | error processing template |
Instances
| Eq ApplicationError Source # | |
Defined in Headroom.Types Methods (==) :: ApplicationError -> ApplicationError -> Bool # (/=) :: ApplicationError -> ApplicationError -> Bool # | |
| Show ApplicationError Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> ApplicationError -> ShowS # show :: ApplicationError -> String # showList :: [ApplicationError] -> ShowS # | |
| Exception ApplicationError Source # | |
Defined in Headroom.Types Methods toException :: ApplicationError -> SomeException # | |
data CommandGenError Source #
Error specific for the gen command.
Constructors
| NoGenModeSelected | no mode of Gen command selected |
Instances
| Eq CommandGenError Source # | |
Defined in Headroom.Types Methods (==) :: CommandGenError -> CommandGenError -> Bool # (/=) :: CommandGenError -> CommandGenError -> Bool # | |
| Show CommandGenError Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> CommandGenError -> ShowS # show :: CommandGenError -> String # showList :: [CommandGenError] -> ShowS # | |
data CommandInitError Source #
Error specific for the init command.
Constructors
| AppConfigAlreadyExists !FilePath | application configuration file already exists |
| NoProvidedSourcePaths | no paths to source code files provided |
| NoSupportedFileType | no supported file types found on source paths |
Instances
| Eq CommandInitError Source # | |
Defined in Headroom.Types Methods (==) :: CommandInitError -> CommandInitError -> Bool # (/=) :: CommandInitError -> CommandInitError -> Bool # | |
| Show CommandInitError Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> CommandInitError -> ShowS # show :: CommandInitError -> String # showList :: [CommandInitError] -> ShowS # | |
data TemplateError Source #
Error during processing template.
Constructors
| MissingVariables !Text ![Text] | missing variable values |
| ParseError !Text | error parsing raw template text |
Instances
| Eq TemplateError Source # | |
Defined in Headroom.Types Methods (==) :: TemplateError -> TemplateError -> Bool # (/=) :: TemplateError -> TemplateError -> Bool # | |
| Show TemplateError Source # | |
Defined in Headroom.Types Methods showsPrec :: Int -> TemplateError -> ShowS # show :: TemplateError -> String # showList :: [TemplateError] -> ShowS # | |
Other Data Types
data LicenseType Source #
Supported type of open source license.
Constructors
| Apache2 | support for Apache-2.0 license |
| BSD3 | support for BSD-3-Clause license |
| GPL2 | support for GNU GPL2 license |
| GPL3 | support for GNU GPL3 license |
| MIT | support for MIT license |
| MPL2 | support for MPL2 license |
Instances
Supported type of source code file.
Constructors
| C | support for C programming language |
| CPP | support for C++ programming language |
| CSS | support for CSS |
| Haskell | support for Haskell programming language |
| HTML | support for HTML |
| Java | support for Java programming language |
| JS | support for JavaScript programming language |
| Rust | support for Rust programming language |
| Scala | support for Scala programming language |
| Shell | support for Shell |
Instances
| Bounded FileType Source # | |
| Enum FileType Source # | |
| Eq FileType Source # | |
| Ord FileType Source # | |
Defined in Headroom.Types | |
| Show FileType Source # | |
| EnumExtra FileType Source # | |
Defined in Headroom.Types | |
Info extracted about the concrete source code file.
Constructors
| FileInfo | |
Fields
| |