diff --git a/ogma-cli/src/CLI/CommandStandalone.hs b/ogma-cli/src/CLI/CommandStandalone.hs index 7cafc443..108e4a61 100644 --- a/ogma-cli/src/CLI/CommandStandalone.hs +++ b/ogma-cli/src/CLI/CommandStandalone.hs @@ -43,7 +43,7 @@ module CLI.CommandStandalone where -- External imports -import Options.Applicative (Parser, help, long, metavar, many, short, +import Options.Applicative (Parser, help, long, many, metavar, optional, short, showDefault, strOption, switch, value) -- External imports: command results @@ -58,12 +58,13 @@ import qualified Command.Standalone -- | Options to generate Copilot from specification. data CommandOpts = CommandOpts - { standaloneTargetDir :: FilePath - , standaloneFileName :: FilePath - , standaloneFormat :: String - , standalonePropFormat :: String - , standaloneTypes :: [String] - , standaloneTarget :: String + { standaloneTargetDir :: FilePath + , standaloneTemplateDir :: Maybe FilePath + , standaloneFileName :: FilePath + , standaloneFormat :: String + , standalonePropFormat :: String + , standaloneTypes :: [String] + , standaloneTarget :: String } -- | Transform an input specification into a Copilot specification. @@ -73,6 +74,7 @@ command c = standalone (standaloneFileName c) internalCommandOpts internalCommandOpts :: Command.Standalone.StandaloneOptions internalCommandOpts = Command.Standalone.StandaloneOptions { Command.Standalone.standaloneTargetDir = standaloneTargetDir c + , Command.Standalone.standaloneTemplateDir = standaloneTemplateDir c , Command.Standalone.standaloneFormat = standaloneFormat c , Command.Standalone.standalonePropFormat = standalonePropFormat c , Command.Standalone.standaloneTypeMapping = types @@ -106,6 +108,13 @@ commandOptsParser = CommandOpts <> value "copilot" <> help strStandaloneTargetDirDesc ) + <*> optional + ( strOption + ( long "template-dir" + <> metavar "DIR" + <> help strStandaloneTemplateDirArgDesc + ) + ) <*> strOption ( long "file-name" <> metavar "FILENAME" @@ -146,6 +155,10 @@ commandOptsParser = CommandOpts strStandaloneTargetDirDesc :: String strStandaloneTargetDirDesc = "Target directory" +-- | Template dir flag description. +strStandaloneTemplateDirArgDesc :: String +strStandaloneTemplateDirArgDesc = "Directory holding standalone source template" + -- | Filename flag description. strStandaloneFilenameDesc :: String strStandaloneFilenameDesc = "File with properties or requirements"