Give error status code for invalid CLI arguments.

This commit is contained in:
Dillon Kearns 2022-11-23 08:52:24 -08:00
parent 4c93e64cae
commit f368bb358e

View File

@ -137,9 +137,20 @@ app config =
)
]
, config = cliConfig
-- TODO printAndExitFailure needs to trigger error exit code
, printAndExitFailure = \string -> config.toJsPort (Json.Encode.string string) |> Cmd.map never
, printAndExitFailure =
\string ->
ToJsPayload.Errors
[ { title = "Invalid CLI arguments"
, path = ""
, message =
[ Terminal.text string
]
, fatal = True
}
]
|> Codec.encodeToValue (ToJsPayload.successCodecNew2 "" "")
|> config.toJsPort
|> Cmd.map never
, printAndExitSuccess = \string -> config.toJsPort (Json.Encode.string string) |> Cmd.map never
}