Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit 2855d44

Browse files
committed
[GH-233] Add NTP, Update, SSC, TXP, DLG specific configuration options using CLI.
1 parent e1bc424 commit 2855d44

File tree

6 files changed

+641
-280
lines changed

6 files changed

+641
-280
lines changed

app/Main.hs

Lines changed: 67 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ import Cardano.Shell.Features.Logging (LoggingCLIArguments,
1111
import Cardano.Shell.Features.Networking (createNetworkingFeature)
1212

1313
import Cardano.Shell.Configuration.Lib (finaliseCardanoConfiguration)
14-
import Cardano.Shell.Constants.CLI (configBlockCLIParser,
15-
configCoreCLIParser,
16-
configWalletCLIParser)
17-
import Cardano.Shell.Constants.PartialTypes (PartialBlock (..), PartialCardanoConfiguration (..),
18-
PartialCore (..),
19-
PartialWallet (..))
14+
import Cardano.Shell.Constants.CLI (configCardanoConfigurationCLIParser)
15+
import Cardano.Shell.Constants.PartialTypes (PartialCardanoConfiguration (..))
2016
import Cardano.Shell.Lib
2117
import Cardano.Shell.Presets (mainnetConfiguration)
2218
import Cardano.Shell.Types
@@ -26,11 +22,11 @@ import Options.Applicative
2622

2723
-- | The product type of all command line arguments.
2824
-- All here being - from all the features.
29-
data CLIArguments = CLIArguments
30-
!LoggingCLIArguments
31-
!PartialWallet
32-
!PartialBlock
33-
!PartialCore
25+
data CLIArguments = CLIArguments !LoggingCLIArguments !PartialCardanoConfiguration
26+
-- !PartialDLG
27+
-- !PartialWallet
28+
-- !PartialBlock
29+
-- !PartialCore
3430

3531
main :: IO ()
3632
main = do
@@ -94,49 +90,62 @@ initializeAllFeatures :: PartialCardanoConfiguration -> CardanoEnvironment -> IO
9490
initializeAllFeatures partialConfig cardanoEnvironment = do
9591

9692
-- Here we parse the __CLI__ arguments for the actual application.
97-
CLIArguments loggingCLIArguments walletCLI blockCLI coreCLI <- execParser parserWithInfo
98-
99-
let configCore = pccCore partialConfig
100-
let configBlock = pccBlock partialConfig
101-
let configWallet = pccWallet partialConfig
102-
103-
let pccCore' = configCore <> coreCLI
104-
let pccBlock' = configBlock <> blockCLI
105-
let pccWallet' = configWallet <> walletCLI
106-
107-
putTextLn "************************************************"
108-
putTextLn "CORE"
109-
putTextLn "************************************************"
110-
putTextLn $ show configCore
111-
putTextLn "------------------------------------------------"
112-
putTextLn $ show coreCLI
113-
putTextLn "------------------------------------------------"
114-
putTextLn $ show pccCore'
115-
116-
putTextLn "************************************************"
117-
putTextLn "BLOCK"
118-
putTextLn "************************************************"
119-
putTextLn $ show configBlock
120-
putTextLn "------------------------------------------------"
121-
putTextLn $ show blockCLI
122-
putTextLn "------------------------------------------------"
123-
putTextLn $ show pccBlock'
124-
125-
putTextLn "************************************************"
126-
putTextLn "WALLET"
127-
putTextLn "************************************************"
128-
putTextLn $ show configWallet
129-
putTextLn "------------------------------------------------"
130-
putTextLn $ show walletCLI
131-
putTextLn "------------------------------------------------"
132-
putTextLn $ show pccWallet'
93+
--CLIArguments loggingCLIArguments dlgCLI walletCLI blockCLI coreCLI <- execParser parserWithInfo
94+
CLIArguments loggingCLIArguments cardanoConfigurationCLI <- execParser parserWithInfo
95+
96+
-- let configDLG = pccDLG partialConfig
97+
-- let configCore = pccCore partialConfig
98+
-- let configBlock = pccBlock partialConfig
99+
-- let configWallet = pccWallet partialConfig
100+
--
101+
-- let pccDLG' = configDLG <> dlgCLI
102+
-- let pccCore' = configCore <> coreCLI
103+
-- let pccBlock' = configBlock <> blockCLI
104+
-- let pccWallet' = configWallet <> walletCLI
105+
--
106+
-- putTextLn "************************************************"
107+
-- putTextLn "CORE"
108+
-- putTextLn "************************************************"
109+
-- putTextLn $ show configCore
110+
-- putTextLn "------------------------------------------------"
111+
-- putTextLn $ show coreCLI
112+
-- putTextLn "------------------------------------------------"
113+
-- putTextLn $ show pccCore'
114+
--
115+
-- putTextLn "************************************************"
116+
-- putTextLn "DLG"
117+
-- putTextLn "************************************************"
118+
-- putTextLn $ show configDLG
119+
-- putTextLn "------------------------------------------------"
120+
-- putTextLn $ show dlgCLI
121+
-- putTextLn "------------------------------------------------"
122+
-- putTextLn $ show pccDLG'
123+
--
124+
-- putTextLn "************************************************"
125+
-- putTextLn "BLOCK"
126+
-- putTextLn "************************************************"
127+
-- putTextLn $ show configBlock
128+
-- putTextLn "------------------------------------------------"
129+
-- putTextLn $ show blockCLI
130+
-- putTextLn "------------------------------------------------"
131+
-- putTextLn $ show pccBlock'
132+
--
133+
-- putTextLn "************************************************"
134+
-- putTextLn "WALLET"
135+
-- putTextLn "************************************************"
136+
-- putTextLn $ show configWallet
137+
-- putTextLn "------------------------------------------------"
138+
-- putTextLn $ show walletCLI
139+
-- putTextLn "------------------------------------------------"
140+
-- putTextLn $ show pccWallet'
133141

134142
finalConfig <- either (throwIO . ConfigurationError) pure $
135-
finaliseCardanoConfiguration $ partialConfig
136-
{ pccCore = pccCore'
137-
, pccBlock = pccBlock'
138-
, pccWallet = pccWallet'
139-
}
143+
finaliseCardanoConfiguration (partialConfig <> cardanoConfigurationCLI)
144+
-- { pccCore = pccCore'
145+
-- , pccDLG = pccDLG'
146+
--, pccBlock = pccBlock'
147+
--, pccWallet = pccWallet'
148+
--}
140149

141150
-- Here we initialize all the features
142151
(loggingLayer, loggingFeature) <- createLoggingFeature cardanoEnvironment finalConfig loggingCLIArguments
@@ -164,7 +173,10 @@ initializeAllFeatures partialConfig cardanoEnvironment = do
164173
commandLineParser :: Parser CLIArguments
165174
commandLineParser = CLIArguments
166175
<$> loggingParser
167-
<*> configWalletCLIParser
168-
<*> configBlockCLIParser
169-
<*> configCoreCLIParser
176+
<*> configCardanoConfigurationCLIParser
177+
178+
-- <*> configDLGCLIParser
179+
-- <*> configWalletCLIParser
180+
-- <*> configBlockCLIParser
181+
-- <*> configCoreCLIParser
170182

0 commit comments

Comments
 (0)