@@ -9,6 +9,7 @@ import Cardano.CLI.EraBased.Options.Common hiding (pNetworkId)
99
1010import Prelude
1111
12+ import Data.Default.Class
1213import Data.Functor
1314import qualified Data.List as L
1415import Data.Word (Word64 )
@@ -20,46 +21,29 @@ import Testnet.Start.Types
2021import Testnet.Types (readNodeLoggingFormat )
2122
2223
23- optsTestnet :: EnvCli -> Parser CardanoTestnetOptions
24- optsTestnet envCli = CardanoTestnetOptions
24+ optsTestnet :: EnvCli -> Parser CardanoTestnetCliOptions
25+ optsTestnet envCli = CardanoTestnetCliOptions
26+ <$> pCardanoTestnetCliOptions envCli
27+ <*> pShelleyTestnetOptions
28+
29+ pCardanoTestnetCliOptions :: EnvCli -> Parser CardanoTestnetOptions
30+ pCardanoTestnetCliOptions envCli = CardanoTestnetOptions
2531 <$> pNumSpoNodes
2632 <*> pAnyShelleyBasedEra'
27- <*> OA. option auto
28- ( OA. long " epoch-length"
29- <> OA. help " Epoch length, in number of slots"
30- <> OA. metavar " SLOTS"
31- <> OA. showDefault
32- <> OA. value (cardanoEpochLength cardanoDefaultTestnetOptions)
33- )
34- <*> OA. option auto
35- ( OA. long " slot-length"
36- <> OA. help " Slot length"
37- <> OA. metavar " SECONDS"
38- <> OA. showDefault
39- <> OA. value (cardanoSlotLength cardanoDefaultTestnetOptions)
40- )
41- <*> pNetworkId
42- <*> OA. option auto
43- ( OA. long " active-slots-coeff"
44- <> OA. help " Active slots co-efficient"
45- <> OA. metavar " DOUBLE"
46- <> OA. showDefault
47- <> OA. value (cardanoActiveSlotsCoeff cardanoDefaultTestnetOptions)
48- )
4933 <*> pMaxLovelaceSupply
5034 <*> OA. option auto
5135 ( OA. long " enable-p2p"
5236 <> OA. help " Enable P2P"
5337 <> OA. metavar " BOOL"
5438 <> OA. showDefault
55- <> OA. value (cardanoEnableP2P cardanoDefaultTestnetOptions )
39+ <> OA. value (cardanoEnableP2P def )
5640 )
5741 <*> OA. option (OA. eitherReader readNodeLoggingFormat)
5842 ( OA. long " nodeLoggingFormat"
5943 <> OA. help " Node logging format (json|text)"
6044 <> OA. metavar " LOGGING_FORMAT"
6145 <> OA. showDefault
62- <> OA. value (cardanoNodeLoggingFormat cardanoDefaultTestnetOptions )
46+ <> OA. value (cardanoNodeLoggingFormat def )
6347 )
6448 <*> OA. option auto
6549 ( OA. long " num-dreps"
@@ -86,10 +70,9 @@ pNumSpoNodes =
8670 <> OA. help " Number of pool nodes. Note this uses a default node configuration for all nodes."
8771 <> OA. metavar " COUNT"
8872 <> OA. showDefault
89- <> OA. value (cardanoNodes cardanoDefaultTestnetOptions )
73+ <> OA. value (cardanoNodes def )
9074 )
9175
92-
9376_pSpo :: Parser TestnetNodeOptions
9477_pSpo =
9578 SpoTestnetNodeOptions . Just
@@ -113,8 +96,40 @@ parseNodeConfigFile = NodeConfigurationYaml <$>
11396 , " Or use num-pool-nodes to use cardano-testnet's default configuration."
11497 ]
11598
116-
117- cmdCardano :: EnvCli -> Mod CommandFields CardanoTestnetOptions
99+ pShelleyTestnetOptions :: Parser ShelleyTestnetOptions
100+ pShelleyTestnetOptions =
101+ ShelleyTestnetOptions
102+ <$> pNetworkId
103+ <*> pEpochLength
104+ <*> pSlotLength
105+ <*> pActiveSlotCoeffs
106+ where
107+ pEpochLength =
108+ OA. option auto
109+ ( OA. long " epoch-length"
110+ <> OA. help " Epoch length, in number of slots"
111+ <> OA. metavar " SLOTS"
112+ <> OA. showDefault
113+ <> OA. value (shelleyEpochLength def)
114+ )
115+ pSlotLength =
116+ OA. option auto
117+ ( OA. long " slot-length"
118+ <> OA. help " Slot length"
119+ <> OA. metavar " SECONDS"
120+ <> OA. showDefault
121+ <> OA. value (shelleySlotLength def)
122+ )
123+ pActiveSlotCoeffs =
124+ OA. option auto
125+ ( OA. long " active-slots-coeff"
126+ <> OA. help " Active slots co-efficient"
127+ <> OA. metavar " DOUBLE"
128+ <> OA. showDefault
129+ <> OA. value (shelleyActiveSlotsCoeff def)
130+ )
131+
132+ cmdCardano :: EnvCli -> Mod CommandFields CardanoTestnetCliOptions
118133cmdCardano envCli = command' " cardano" " Start a testnet in any era" (optsTestnet envCli)
119134
120135pNetworkId :: Parser Int
@@ -132,6 +147,6 @@ pMaxLovelaceSupply =
132147 <> help " Max lovelace supply that your testnet starts with."
133148 <> metavar " WORD64"
134149 <> showDefault
135- <> value (cardanoMaxSupply cardanoDefaultTestnetOptions )
150+ <> value (cardanoMaxSupply def )
136151 )
137152
0 commit comments