Skip to content

Commit

Permalink
New pLegacyShelleyBasedEra function
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Oct 22, 2023
1 parent e80ce88 commit 296aae8
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion cardano-cli/src/Cardano/CLI/Legacy/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Cardano.CLI.Legacy.Options
, parseTxIn

, pLegacyCardanoEra
, pLegacyShelleyBasedEra
, pKeyRegistDeposit
, pStakePoolRegistrationParserRequirements
, pStakePoolVerificationKeyOrHashOrFile
Expand All @@ -24,7 +25,7 @@ import Cardano.Api hiding (QueryInShelleyBasedEra (..))
import Cardano.Api.Shelley hiding (QueryInShelleyBasedEra (..))

import Cardano.Chain.Common (BlockCount (BlockCount))
import Cardano.CLI.Environment (EnvCli (..))
import Cardano.CLI.Environment
import Cardano.CLI.EraBased.Options.Common
import Cardano.CLI.Legacy.Commands
import Cardano.CLI.Legacy.Commands.Address
Expand Down Expand Up @@ -1240,3 +1241,32 @@ pLegacyCardanoEra envCli =
defaultCardanoEra = defaultShelleyBasedEra & \(EraInEon era) ->
let cera = toCardanoEra era
in cardanoEraConstraints cera (AnyCardanoEra cera)

pLegacyShelleyBasedEra :: EnvCli -> Parser (EraInEon ShelleyBasedEra)
pLegacyShelleyBasedEra envCli =
asum $ mconcat
[ [ Opt.flag' (EraInEon ShelleyBasedEraShelley) $ mconcat
[ Opt.long "shelley-era"
, Opt.help "Specify the Shelley era"
]
, Opt.flag' (EraInEon ShelleyBasedEraAllegra) $ mconcat
[ Opt.long "allegra-era"
, Opt.help "Specify the Allegra era"
]
, Opt.flag' (EraInEon ShelleyBasedEraMary) $ mconcat
[ Opt.long "mary-era"
, Opt.help "Specify the Mary era"
]
, Opt.flag' (EraInEon ShelleyBasedEraAlonzo) $ mconcat
[ Opt.long "alonzo-era"
, Opt.help "Specify the Alonzo era"
]
, Opt.flag' (EraInEon ShelleyBasedEraBabbage) $ mconcat
[ Opt.long "babbage-era"
, Opt.help "Specify the Babbage era (default)"
]
]
, maybeToList $ pure <$> envCliAnyShelleyBasedEra envCli
-- TODO is this default needed anymore?
, pure $ pure defaultShelleyBasedEra
]

0 comments on commit 296aae8

Please sign in to comment.