Skip to content

Commit

Permalink
Parameterize pGenesisCmds on ShelleyBasedEra era
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Oct 11, 2024
1 parent a6f523e commit 4a84aa1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
5 changes: 2 additions & 3 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Cardano.CLI.EraBased.Commands
)
where

import Cardano.Api (ShelleyBasedEra (..), toCardanoEra)
import Cardano.Api (ShelleyBasedEra (..))

import Cardano.CLI.Commands.Address
import Cardano.CLI.Commands.Key
Expand Down Expand Up @@ -114,12 +114,11 @@ pAnyEraCommand envCli =

pCmds :: ShelleyBasedEra era -> EnvCli -> Parser (Cmds era)
pCmds sbe' envCli = do
let cEra = toCardanoEra sbe'
asum $
catMaybes
[ Just (AddressCmds <$> pAddressCmds envCli)
, Just (KeyCmds <$> pKeyCmds)
, fmap GenesisCmds <$> pGenesisCmds cEra envCli
, fmap GenesisCmds <$> pGenesisCmds sbe' envCli
, fmap GovernanceCmds <$> pGovernanceCmds sbe'
, Just (NodeCmds <$> pNodeCmds)
, fmap QueryCmds <$> pQueryCmds sbe' envCli
Expand Down
27 changes: 15 additions & 12 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import qualified Options.Applicative as Opt

pGenesisCmds
:: ()
=> CardanoEra era
=> ShelleyBasedEra era
-> EnvCli
-> Maybe (Parser (GenesisCmds era))
pGenesisCmds era envCli =
Expand Down Expand Up @@ -65,31 +65,34 @@ pGenesisCmds era envCli =
subParser "initial-txin" $
Opt.info (pGenesisTxIn envCli) $
Opt.progDesc "Get the TxIn for an initial UTxO based on the verification key"
, forEraInEonMaybe era $ \sbe ->
subParser "create-cardano" $
Opt.info (pGenesisCreateCardano sbe envCli) $
Opt.progDesc $
mconcat
[ "Create a Byron and Shelley genesis file from a genesis "
, "template and genesis/delegation/spending keys."
]
, forEraInEonMaybe era $ \sbe ->
, forShelleyBasedEraInEonMaybe
era
( \sbe ->
subParser "create-cardano" $
Opt.info (pGenesisCreateCardano sbe envCli) $
Opt.progDesc $
mconcat
[ "Create a Byron and Shelley genesis file from a genesis "
, "template and genesis/delegation/spending keys."
]
)
, forShelleyBasedEraInEonMaybe era $ \sbe ->
subParser "create" $
Opt.info (pGenesisCreate sbe envCli) $
Opt.progDesc $
mconcat
[ "Create a Shelley genesis file from a genesis "
, "template and genesis/delegation/spending keys."
]
, forEraInEonMaybe era $ \sbe ->
, forShelleyBasedEraInEonMaybe era $ \sbe ->
subParser "create-staked" $
Opt.info (pGenesisCreateStaked sbe envCli) $
Opt.progDesc $
mconcat
[ "Create a staked Shelley genesis file from a genesis "
, "template and genesis/delegation/spending keys."
]
, forEraInEonMaybe era $ \sbe ->
, forShelleyBasedEraInEonMaybe era $ \sbe ->
subParser "create-testnet-data" $
Opt.info (pGenesisCreateTestNetData sbe envCli) $
Opt.progDesc $
Expand Down

0 comments on commit 4a84aa1

Please sign in to comment.