{-# LANGUAGE DataKinds #-}

module Cardano.CLI.Compatible.Governance.Option
  ( pCompatibleGovernanceCmds
  )
where

import Cardano.Api

import Cardano.CLI.Compatible.Governance.Command
import Cardano.CLI.EraBased.Governance.Option

import Data.Foldable
import Data.Maybe
import Options.Applicative

pCompatibleGovernanceCmds :: ShelleyBasedEra era -> Parser (CompatibleGovernanceCmds era)
pCompatibleGovernanceCmds :: forall era.
ShelleyBasedEra era -> Parser (CompatibleGovernanceCmds era)
pCompatibleGovernanceCmds ShelleyBasedEra era
sbe =
  [Parser (CompatibleGovernanceCmds era)]
-> Parser (CompatibleGovernanceCmds era)
forall (t :: * -> *) (f :: * -> *) a.
(Foldable t, Alternative f) =>
t (f a) -> f a
asum ([Parser (CompatibleGovernanceCmds era)]
 -> Parser (CompatibleGovernanceCmds era))
-> [Parser (CompatibleGovernanceCmds era)]
-> Parser (CompatibleGovernanceCmds era)
forall a b. (a -> b) -> a -> b
$ [Maybe (Parser (CompatibleGovernanceCmds era))]
-> [Parser (CompatibleGovernanceCmds era)]
forall a. [Maybe a] -> [a]
catMaybes [(GovernanceCmds era -> CompatibleGovernanceCmds era)
-> Parser (GovernanceCmds era)
-> Parser (CompatibleGovernanceCmds era)
forall a b. (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap GovernanceCmds era -> CompatibleGovernanceCmds era
forall era. GovernanceCmds era -> CompatibleGovernanceCmds era
CreateCompatibleProtocolUpdateCmd (Parser (GovernanceCmds era)
 -> Parser (CompatibleGovernanceCmds era))
-> Maybe (Parser (GovernanceCmds era))
-> Maybe (Parser (CompatibleGovernanceCmds era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ShelleyBasedEra era -> Maybe (Parser (GovernanceCmds era))
forall era.
ShelleyBasedEra era -> Maybe (Parser (GovernanceCmds era))
pGovernanceCmds ShelleyBasedEra era
sbe]