From 34dca56d4e1a8f92e8d2063f8548de05f8fe52ae Mon Sep 17 00:00:00 2001 From: Ivan Perez Date: Wed, 11 Dec 2024 11:47:00 +0000 Subject: [PATCH] ogma-cli: Introduce argument to customize target directory in standalone command. Refs #189. --- ogma-cli/src/CLI/CommandStandalone.hs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ogma-cli/src/CLI/CommandStandalone.hs b/ogma-cli/src/CLI/CommandStandalone.hs index b4cd7377..a47d2b76 100644 --- a/ogma-cli/src/CLI/CommandStandalone.hs +++ b/ogma-cli/src/CLI/CommandStandalone.hs @@ -58,7 +58,8 @@ import qualified Command.Standalone -- | Options to generate Copilot from specification. data CommandOpts = CommandOpts - { standaloneFileName :: FilePath + { standaloneTargetDir :: FilePath + , standaloneFileName :: FilePath , standaloneFormat :: String , standalonePropFormat :: String , standaloneTypes :: [String] @@ -71,7 +72,8 @@ command c = standalone (standaloneFileName c) internalCommandOpts where internalCommandOpts :: Command.Standalone.StandaloneOptions internalCommandOpts = Command.Standalone.StandaloneOptions - { Command.Standalone.standaloneFormat = standaloneFormat c + { Command.Standalone.standaloneTargetDir = standaloneTargetDir c + , Command.Standalone.standaloneFormat = standaloneFormat c , Command.Standalone.standalonePropFormat = standalonePropFormat c , Command.Standalone.standaloneTypeMapping = types , Command.Standalone.standaloneFilename = standaloneTarget c @@ -98,6 +100,13 @@ commandDesc = commandOptsParser :: Parser CommandOpts commandOptsParser = CommandOpts <$> strOption + ( long "target-dir" + <> metavar "DIR" + <> showDefault + <> value "copilot" + <> help strStandaloneTargetDirDesc + ) + <*> strOption ( long "file-name" <> metavar "FILENAME" <> help strStandaloneFilenameDesc @@ -154,6 +163,10 @@ strStandaloneTargetDesc :: String strStandaloneTargetDesc = "Filename prefix for monitoring files in target language" +-- | Target dir flag description. +strStandaloneTargetDirDesc :: String +strStandaloneTargetDirDesc = "Target directory" + -- * Error codes -- | Encoding of reasons why the command can fail.