Skip to content

Commit 0640a19

Browse files
iohk-bors[bot]rvl
andauthored
Merge #2241
2241: Revise help text for pool metadata source CLI option r=KtorZ a=rvl ### Issue Number ADP-482 ### Overview Noticed while reviewing IntersectMBO/cardano-launcher#90. - Fix variable names to reflect the new option - Add more detail to CLI help text Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
2 parents 6c38409 + ab496a5 commit 0640a19

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

lib/cli/src/Cardano/CLI.hs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module Cardano.CLI
5353
, stateDirOption
5454
, syncToleranceOption
5555
, tlsOption
56-
, smashURLOption
56+
, poolMetadataSourceOption
5757
, metadataOption
5858

5959
-- * Option parsers for configuring tracing
@@ -1318,15 +1318,17 @@ tlsOption = TlsConfiguration
13181318
<> metavar "FILE"
13191319
<> help "The RSA Server key which signed the x.509 server certificate."
13201320

1321-
smashURLOption
1321+
poolMetadataSourceOption
13221322
:: Parser PoolMetadataSource
1323-
smashURLOption = option (eitherReader reader) $ mempty
1323+
poolMetadataSourceOption = option (eitherReader reader) $ mempty
13241324
<> long "pool-metadata-fetching"
1325-
<> metavar "STRATEGY"
1326-
<> help "Pool Metadata fetching strategy. This setting will persist across restarts. Possible values: \
1327-
\ none, \
1328-
\ direct, \
1329-
\ <SMASH-URL>."
1325+
<> metavar "( none | direct | SMASH-URL )"
1326+
<> help ("Sets the stake pool metadata fetching strategy. "
1327+
<> "Provide a URL to specify a SMASH metadata proxy server, "
1328+
<> "use \"direct\" to fetch directly from the registered pool URLs,"
1329+
<> " or \"none\" to completely disable stake pool"
1330+
<> " metadata. The initial setting is \"none\" and changes by"
1331+
<> " either this option or the API will persist across restarts.")
13301332
where
13311333
reader :: String -> Either String PoolMetadataSource
13321334
reader = left (const err) . fromTextS @PoolMetadataSource

lib/cli/test/unit/Cardano/CLISpec.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import Cardano.CLI
2929
, hGetLine
3030
, hGetSensitiveLine
3131
, metadataOption
32-
, smashURLOption
32+
, poolMetadataSourceOption
3333
)
3434
import Cardano.Wallet.Api.Client
3535
( addressClient
@@ -648,9 +648,10 @@ spec = do
648648
, expectedResult = "pata14" :: Text
649649
}
650650

651-
describe "SMASH URL option" $ do
651+
describe "Pool metadata fetching option" $ do
652652
let parse arg = execParserPure defaultPrefs
653-
(info smashURLOption mempty) ["--pool-metadata-fetching", arg]
653+
(info poolMetadataSourceOption mempty)
654+
["--pool-metadata-fetching", arg]
654655
let ok arg (Success url) = Right url == fromText @PoolMetadataSource
655656
(T.pack arg)
656657
ok _ _ = False

lib/shelley/exe/cardano-wallet.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ import Cardano.CLI
5151
, loggingOptions
5252
, loggingSeverityOrOffReader
5353
, loggingTracers
54+
, poolMetadataSourceOption
5455
, runCli
5556
, setupDirectory
5657
, shutdownHandlerFlag
57-
, smashURLOption
5858
, syncToleranceOption
5959
, tlsOption
6060
, withLogging
@@ -175,7 +175,7 @@ data ServeArgs = ServeArgs
175175
, _database :: Maybe FilePath
176176
, _syncTolerance :: SyncTolerance
177177
, _enableShutdownHandler :: Bool
178-
, _smashOpt :: Maybe PoolMetadataSource
178+
, _poolMetadataSourceOpt :: Maybe PoolMetadataSource
179179
, _logging :: LoggingOptions TracerSeverities
180180
} deriving (Show)
181181

@@ -195,7 +195,7 @@ cmdServe = command "serve" $ info (helper <*> helper' <*> cmd) $ mempty
195195
<*> optional databaseOption
196196
<*> syncToleranceOption
197197
<*> shutdownHandlerFlag
198-
<*> optional smashURLOption
198+
<*> optional poolMetadataSourceOption
199199
<*> loggingOptions tracerSeveritiesOption
200200
exec
201201
:: ServeArgs -> IO ()
@@ -208,7 +208,7 @@ cmdServe = command "serve" $ info (helper <*> helper' <*> cmd) $ mempty
208208
databaseDir
209209
sTolerance
210210
enableShutdownHandler
211-
smashURL
211+
poolMetadataFetching
212212
logOpt) = do
213213
withTracers logOpt $ \tr tracers -> do
214214
installSignalHandlers (logNotice tr MsgSigTerm)
@@ -232,7 +232,7 @@ cmdServe = command "serve" $ info (helper <*> helper' <*> cmd) $ mempty
232232
host
233233
listen
234234
tlsConfig
235-
(fmap Settings smashURL)
235+
(fmap Settings poolMetadataFetching)
236236
nodeSocket
237237
block0
238238
(gp, vData)

0 commit comments

Comments
 (0)