From 1d055c59ccbfa6a46f881b3d6d81d2a89cbed189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Mon, 24 Jun 2024 16:59:08 +0200 Subject: [PATCH] Detail: introduce pTxBuildOutputOptions to avoid <|> in an unexpected position --- .../Cardano/CLI/EraBased/Options/Common.hs | 20 +++++++++++-------- .../CLI/EraBased/Options/Transaction.hs | 2 +- cardano-cli/src/Cardano/CLI/Legacy/Options.hs | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs index ca56daf830..308f274f73 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Common.hs @@ -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 diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs index c0ec0ca563..eff6d214cb 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs @@ -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)) diff --git a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs index 5e08cb0c1e..81a4622f04 100644 --- a/cardano-cli/src/Cardano/CLI/Legacy/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Legacy/Options.hs @@ -340,7 +340,7 @@ pTransaction envCli = <*> pVoteFiles ShelleyBasedEraConway AutoBalance <*> pProposalFiles ShelleyBasedEraConway AutoBalance <*> pTreasuryDonation ShelleyBasedEraConway - <*> (OutputTxBodyOnly <$> pTxBodyFileOut <|> pCalculatePlutusScriptCost) + <*> pTxBuildOutputOptions pChangeAddress :: Parser TxOutChangeAddress pChangeAddress =