44{-# LANGUAGE RankNTypes #-}
55{-# LANGUAGE TemplateHaskell #-}
66
7+ import qualified Cardano.Configuration as CC
78import qualified Cardano.Crypto.Init as Crypto
89import Cardano.Git.Rev (gitRev )
9- import Cardano.Node.Configuration.POM (PartialNodeConfiguration (.. ))
1010import Cardano.Node.Handlers.TopLevel
11- import Cardano.Node.Parsers (nodeCLIParser )
1211import Cardano.Node.Run (runNode )
1312import Cardano.Node.Tracing.Documentation (TraceDocumentationCmd (.. ),
1413 parseTraceDocumentationCmd , runTraceDocumentationCmd )
1514
16- import Data.Monoid (Last (getLast ))
1715import qualified Data.Text as Text
1816import qualified Data.Text.IO as Text
1917import Data.Version (showVersion )
2018import Options.Applicative
2119import qualified Options.Applicative as Opt
2220import System.Info (arch , compilerName , compilerVersion , os )
23- import System.IO (hPutStrLn , stderr )
2421
2522import Paths_cardano_node (version )
2623
@@ -32,28 +29,16 @@ main = do
3229 cmd <- Opt. customExecParser p opts
3330
3431 case cmd of
35- RunCmd args -> do
36- warnIfSet args pncMaybeMempoolCapacityOverride " mempool-capacity-override" " MempoolCapacityBytesOverride"
37- runNode args
32+ RunCmd args -> runNode args
3833 TraceDocumentation tdc -> runTraceDocumentationCmd tdc
3934 VersionCmd -> runVersionCommand
4035
4136 where
4237 p = Opt. prefs Opt. showHelpOnEmpty
4338
44- warnIfSet :: PartialNodeConfiguration -> (PartialNodeConfiguration -> Last a ) -> String -> String -> IO ()
45- warnIfSet args f name key =
46- maybe
47- (pure () )
48- (\ _ -> hPutStrLn stderr $ " WARNING: Option --" ++ name ++ " was set via CLI flags.\
49- \ This CLI flag will be removed in upcoming node releases.\
50- \ Please, set this configuration option in the configuration file instead with key " ++ key ++ " ." )
51- $ getLast
52- $ f args
53-
5439 opts :: Opt. ParserInfo Command
5540 opts =
56- Opt. info (fmap RunCmd nodeCLIParser
41+ Opt. info (fmap RunCmd nodeRunParser
5742 <|> fmap TraceDocumentation parseTraceDocumentationCmd
5843 <|> parseVersionCmd
5944 <**> helper)
@@ -62,8 +47,11 @@ main = do
6247 Opt. progDesc " Start node of the Cardano blockchain."
6348 )
6449
50+ -- | The node's CLI, parsed by @cardano-config@, under the @run@ subcommand.
51+ nodeRunParser :: Parser CC. CliArgs
52+ nodeRunParser = Opt. subparser $ command' " run" " Run the node." CC. parseCliArgs
6553
66- data Command = RunCmd PartialNodeConfiguration
54+ data Command = RunCmd CC. CliArgs
6755 | TraceDocumentation TraceDocumentationCmd
6856 | VersionCmd
6957
0 commit comments