-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f0fe38
commit 38d5b15
Showing
121 changed files
with
9,126 additions
and
9,054 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,54 @@ | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
{-# LANGUAGE LambdaCase #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
|
||
{-| | ||
Module : Main | ||
Description : Main application launcher | ||
Copyright : (c) 2019-2022 Vaclav Svejcar | ||
License : BSD-3-Clause | ||
Maintainer : [email protected] | ||
Stability : experimental | ||
Portability : POSIX | ||
Code responsible for booting up the application and parsing command line | ||
arguments. | ||
-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
{-# LANGUAGE NoImplicitPrelude #-} | ||
|
||
-- | | ||
-- Module : Main | ||
-- Description : Main application launcher | ||
-- Copyright : (c) 2019-2022 Vaclav Svejcar | ||
-- License : BSD-3-Clause | ||
-- Maintainer : [email protected] | ||
-- Stability : experimental | ||
-- Portability : POSIX | ||
-- | ||
-- Code responsible for booting up the application and parsing command line | ||
-- arguments. | ||
module Main where | ||
|
||
import Headroom.Command ( commandParser ) | ||
import Headroom.Command.Gen ( commandGen | ||
, parseGenMode | ||
) | ||
import Headroom.Command.Init ( commandInit ) | ||
import Headroom.Command.Run ( commandRun ) | ||
import Headroom.Command.Types ( Command(..) | ||
, CommandGenOptions(..) | ||
, CommandInitOptions(..) | ||
, CommandRunOptions(..) | ||
) | ||
import Headroom.Types ( HeadroomError(..) ) | ||
import Options.Applicative ( execParser ) | ||
import RIO | ||
import System.IO ( hPutStrLn ) | ||
|
||
import Headroom.Command (commandParser) | ||
import Headroom.Command.Gen ( | ||
commandGen | ||
, parseGenMode | ||
) | ||
import Headroom.Command.Init (commandInit) | ||
import Headroom.Command.Run (commandRun) | ||
import Headroom.Command.Types ( | ||
Command (..) | ||
, CommandGenOptions (..) | ||
, CommandInitOptions (..) | ||
, CommandRunOptions (..) | ||
) | ||
import Headroom.Types (HeadroomError (..)) | ||
import Options.Applicative (execParser) | ||
import RIO | ||
import System.IO (hPutStrLn) | ||
|
||
main :: IO () | ||
main = do | ||
command' <- execParser commandParser | ||
catch | ||
(bootstrap command') | ||
(\ex -> do | ||
hPutStrLn stderr $ "ERROR: " <> displayException (ex :: HeadroomError) | ||
exitWith $ ExitFailure 1 | ||
) | ||
command' <- execParser commandParser | ||
catch | ||
(bootstrap command') | ||
( \ex -> do | ||
hPutStrLn stderr $ "ERROR: " <> displayException (ex :: HeadroomError) | ||
exitWith $ ExitFailure 1 | ||
) | ||
|
||
bootstrap :: Command -> IO () | ||
bootstrap = \case | ||
c@(Gen _ _) -> do | ||
cgoGenMode <- parseGenMode c | ||
commandGen CommandGenOptions { .. } | ||
Init cioLicenseType cioSourcePaths -> commandInit CommandInitOptions { .. } | ||
Run croSourcePaths croExcludedPaths croExcludeIgnoredPaths croBuiltInTemplates croTemplateRefs croVariables croRunMode croDebug croDryRun | ||
-> commandRun CommandRunOptions { .. } | ||
c@(Gen _ _) -> do | ||
cgoGenMode <- parseGenMode c | ||
commandGen CommandGenOptions{..} | ||
Init cioLicenseType cioSourcePaths -> commandInit CommandInitOptions{..} | ||
Run croSourcePaths croExcludedPaths croExcludeIgnoredPaths croBuiltInTemplates croTemplateRefs croVariables croRunMode croDebug croDryRun -> | ||
commandRun CommandRunOptions{..} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
{-| | ||
Module : {{{ _haskell_module_name }}} | ||
Description : {{{ _haskell_module_shortdesc }}} | ||
Copyright : (c) {{ year }} {{ author }} | ||
License : {{ license }} | ||
Maintainer : {{ email }} | ||
Stability : experimental | ||
Portability : POSIX | ||
|
||
{{{ _haskell_module_longdesc }}} | ||
-} | ||
-- | | ||
-- Module : {{{ _haskell_module_name }}} | ||
-- Description : {{{ _haskell_module_shortdesc }}} | ||
-- Copyright : (c) {{ year }} {{ author }} | ||
-- License : {{ license }} | ||
-- Maintainer : {{ email }} | ||
-- Stability : experimental | ||
-- Portability : POSIX | ||
-- | ||
-- {{{ _haskell_module_longdesc }}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
comma-style: leading | ||
haddock-style: single-line | ||
import-export-comma-style: leading |
Oops, something went wrong.