Skip to content

Commit

Permalink
Detail: introduce pTxBuildOutputOptions to avoid <|> in an unexpected…
Browse files Browse the repository at this point in the history
… position
  • Loading branch information
smelc committed Jun 27, 2024
1 parent 6f2ee57 commit 24a53e7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
20 changes: 12 additions & 8 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1344,14 +1344,18 @@ pProtocolParamsFile =
, Opt.completer (Opt.bashCompleter "file")
]

pCalculatePlutusScriptCost :: Parser TxBuildOutputOptions
pCalculatePlutusScriptCost =
OutputScriptCostOnly <$> Opt.strOption
( Opt.long "calculate-plutus-script-cost" <>
Opt.metavar "FILE" <>
Opt.help "(File () Out) filepath of the script cost information." <>
Opt.completer (Opt.bashCompleter "file")
)
pTxBuildOutputOptions :: Parser TxBuildOutputOptions
pTxBuildOutputOptions =
(OutputTxBodyOnly <$> pTxBodyFileOut) <|> pCalculatePlutusScriptCost
where
pCalculatePlutusScriptCost :: Parser TxBuildOutputOptions
pCalculatePlutusScriptCost =
OutputScriptCostOnly <$> Opt.strOption
( Opt.long "calculate-plutus-script-cost" <>
Opt.metavar "FILE" <>
Opt.help "(File () Out) filepath of the script cost information." <>
Opt.completer (Opt.bashCompleter "file")
)

pCertificateFile
:: BalanceTxExecUnits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pTransactionBuildCmd era envCli = do
<*> pVoteFiles sbe AutoBalance
<*> pProposalFiles sbe AutoBalance
<*> pTreasuryDonation sbe
<*> (OutputTxBodyOnly <$> pTxBodyFileOut <|> pCalculatePlutusScriptCost)
<*> pTxBuildOutputOptions

-- | Estimate the transaction fees without access to a live node.
pTransactionBuildEstimateCmd :: MaryEraOnwards era -> EnvCli -> Maybe (Parser (TransactionCmds era))
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Legacy/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ pTransaction envCli =
<*> pVoteFiles ShelleyBasedEraConway AutoBalance
<*> pProposalFiles ShelleyBasedEraConway AutoBalance
<*> pTreasuryDonation ShelleyBasedEraConway
<*> (OutputTxBodyOnly <$> pTxBodyFileOut <|> pCalculatePlutusScriptCost)
<*> pTxBuildOutputOptions

pChangeAddress :: Parser TxOutChangeAddress
pChangeAddress =
Expand Down

0 comments on commit 24a53e7

Please sign in to comment.