From b8ea33fe7a35671ba634868d94339ccd4b04301c Mon Sep 17 00:00:00 2001 From: Jordan Millar Date: Wed, 15 Nov 2023 12:38:44 -0400 Subject: [PATCH] Update pCmds to take `ShelleyBasedEra era` instead of `Cardano era` --- .../src/Cardano/CLI/EraBased/Commands.hs | 30 +++++++++---------- cardano-cli/src/Cardano/CLI/Options.hs | 4 +-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs b/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs index 0407ac9f12..f872edb2e3 100644 --- a/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs +++ b/cardano-cli/src/Cardano/CLI/EraBased/Commands.hs @@ -10,7 +10,7 @@ module Cardano.CLI.EraBased.Commands , pCmds ) where -import Cardano.Api (CardanoEra (..), ShelleyBasedEra (..)) +import Cardano.Api (ShelleyBasedEra (..), toCardanoEra) import Cardano.CLI.Environment import Cardano.CLI.EraBased.Commands.Address @@ -88,40 +88,40 @@ pAnyEraCommand envCli = [ -- Note, byron is ommitted because there is already a legacy command group for it. subParser "shelley" - $ Opt.info (AnyEraCommandOf ShelleyBasedEraShelley <$> pCmds ShelleyEra envCli) + $ Opt.info (AnyEraCommandOf ShelleyBasedEraShelley <$> pCmds ShelleyBasedEraShelley envCli) $ Opt.progDesc "Shelley era commands" , subParser "allegra" - $ Opt.info (AnyEraCommandOf ShelleyBasedEraAllegra <$> pCmds AllegraEra envCli) + $ Opt.info (AnyEraCommandOf ShelleyBasedEraAllegra <$> pCmds ShelleyBasedEraAllegra envCli) $ Opt.progDesc "Allegra era commands" , subParser "mary" - $ Opt.info (AnyEraCommandOf ShelleyBasedEraMary <$> pCmds MaryEra envCli) + $ Opt.info (AnyEraCommandOf ShelleyBasedEraMary <$> pCmds ShelleyBasedEraMary envCli) $ Opt.progDesc "Mary era commands" , subParser "alonzo" - $ Opt.info (AnyEraCommandOf ShelleyBasedEraAlonzo <$> pCmds AlonzoEra envCli) + $ Opt.info (AnyEraCommandOf ShelleyBasedEraAlonzo <$> pCmds ShelleyBasedEraAlonzo envCli) $ Opt.progDesc "Alonzo era commands" , subParser "babbage" - $ Opt.info (AnyEraCommandOf ShelleyBasedEraBabbage <$> pCmds BabbageEra envCli) + $ Opt.info (AnyEraCommandOf ShelleyBasedEraBabbage <$> pCmds ShelleyBasedEraBabbage envCli) $ Opt.progDesc "Babbage era commands" , subParser "conway" - $ Opt.info (AnyEraCommandOf ShelleyBasedEraConway <$> pCmds ConwayEra envCli) + $ Opt.info (AnyEraCommandOf ShelleyBasedEraConway <$> pCmds ShelleyBasedEraConway envCli) $ Opt.progDesc "Conway era commands" , subParser "latest" - $ Opt.info (AnyEraCommandOf ShelleyBasedEraBabbage <$> pCmds BabbageEra envCli) + $ Opt.info (AnyEraCommandOf ShelleyBasedEraBabbage <$> pCmds ShelleyBasedEraBabbage envCli) $ Opt.progDesc "Latest era commands (Babbage)" ] -pCmds :: CardanoEra era -> EnvCli -> Parser (Cmds era) +pCmds :: ShelleyBasedEra era -> EnvCli -> Parser (Cmds era) pCmds era envCli = asum $ catMaybes - [ fmap AddressCmds <$> pAddressCmds era envCli + [ fmap AddressCmds <$> pAddressCmds (toCardanoEra era) envCli , fmap KeyCmds <$> pKeyCmds , fmap GenesisCmds <$> pGenesisCmds envCli - , fmap GovernanceCmds <$> pGovernanceCmds era + , fmap GovernanceCmds <$> pGovernanceCmds (toCardanoEra era) , fmap NodeCmds <$> pNodeCmds - , fmap QueryCmds <$> pQueryCmds era envCli - , fmap StakeAddressCmds <$> pStakeAddressCmds era envCli - , fmap StakePoolCmds <$> pStakePoolCmds era envCli + , fmap QueryCmds <$> pQueryCmds (toCardanoEra era) envCli + , fmap StakeAddressCmds <$> pStakeAddressCmds (toCardanoEra era) envCli + , fmap StakePoolCmds <$> pStakePoolCmds (toCardanoEra era) envCli , fmap TextViewCmds <$> pTextViewCmds - , fmap TransactionCmds <$> pTransactionCmds era envCli + , fmap TransactionCmds <$> pTransactionCmds (toCardanoEra era) envCli ] diff --git a/cardano-cli/src/Cardano/CLI/Options.hs b/cardano-cli/src/Cardano/CLI/Options.hs index 48b901ceac..81f70f412e 100644 --- a/cardano-cli/src/Cardano/CLI/Options.hs +++ b/cardano-cli/src/Cardano/CLI/Options.hs @@ -8,7 +8,7 @@ module Cardano.CLI.Options , pref ) where -import Cardano.Api (CardanoEra (..), ShelleyBasedEra (..)) +import Cardano.Api (ShelleyBasedEra (..)) import Cardano.CLI.Byron.Parsers (backwardsCompatibilityCommands, parseByronCommands) import Cardano.CLI.Environment (EnvCli) @@ -82,7 +82,7 @@ parseLegacy envCli = _parseTopLevelLatest :: EnvCli -> Parser ClientCommand _parseTopLevelLatest envCli = - AnyEraCommand . AnyEraCommandOf ShelleyBasedEraBabbage <$> pCmds BabbageEra envCli + AnyEraCommand . AnyEraCommandOf ShelleyBasedEraBabbage <$> pCmds ShelleyBasedEraBabbage envCli -- | Parse Legacy commands at the top level of the CLI. parseTopLevelLegacy :: EnvCli -> Parser ClientCommand