Skip to content

Commit

Permalink
ogma-cli: Provide CLI argument to pass an auxiliary template source d…
Browse files Browse the repository at this point in the history
…irectory to cFS app command. Refs nasa#157.

The cFS application generation backend has a fixed template that it uses
to generate the cFS application. That template does not fit all use
cases, so we are finding users heavily modifying the output (which is
hard to keep up with when there are changes), and or not using ogma
altogether for that reason.

A recent commit introduced into ogma-core the ability to use a custom
provided template and expand variables using mustache.

This commit exposes that new parameter to the user in the CLI.
  • Loading branch information
ivanperez-keera committed Nov 12, 2024
1 parent 1a13b5e commit 0e8af54
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions ogma-cli/src/CLI/CommandCFSApp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ import Command.CFSApp ( ErrorCode, cFSApp )

-- | Options needed to generate the cFS application.
data CommandOpts = CommandOpts
{ cFSAppTarget :: String
, cFSAppVarNames :: String
, cFSAppVarDB :: Maybe String
{ cFSAppTarget :: String
, cFSAppTemplateDir :: Maybe String
, cFSAppVarNames :: String
, cFSAppVarDB :: Maybe String
}

-- | Create <https://cfs.gsfc.nasa.gov/ NASA core Flight System> (cFS)
Expand All @@ -68,7 +69,11 @@ data CommandOpts = CommandOpts
-- This is just an uncurried version of "Command.CFSApp".
command :: CommandOpts -> IO (Result ErrorCode)
command c =
cFSApp (cFSAppTarget c) (cFSAppVarNames c) (cFSAppVarDB c)
cFSApp
(cFSAppTarget c)
(cFSAppTemplateDir c)
(cFSAppVarNames c)
(cFSAppVarDB c)

-- * CLI

Expand All @@ -87,6 +92,13 @@ commandOptsParser = CommandOpts
<> value "copilot-cfs-demo"
<> help strCFSAppDirArgDesc
)
<*> optional
( strOption
( long "app-template-dir"
<> metavar "DIR"
<> help strCFSAppTemplateDirArgDesc
)
)
<*> strOption
( long "variable-file"
<> metavar "FILENAME"
Expand All @@ -106,6 +118,11 @@ commandOptsParser = CommandOpts
strCFSAppDirArgDesc :: String
strCFSAppDirArgDesc = "Target directory"

-- | Argument template directory to cFS app generation command
strCFSAppTemplateDirArgDesc :: String
strCFSAppTemplateDirArgDesc =
"Directory holding cFS application source template"

-- | Argument variable list to cFS app generation command
strCFSAppVarListArgDesc :: String
strCFSAppVarListArgDesc =
Expand Down

0 comments on commit 0e8af54

Please sign in to comment.