Skip to content

Commit

Permalink
unixsoc depend on handshake-only
Browse files Browse the repository at this point in the history
  • Loading branch information
felix-lipski committed Dec 15, 2023
1 parent 8a0c9f7 commit 603309a
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cardano-cli/src/Cardano/CLI/Run/Ping.hs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ pingClient stdout stderr cmd = CNP.pingClient stdout stderr opts
where opts = CNP.PingOpts
{ CNP.pingOptsQuiet = pingCmdQuiet cmd
, CNP.pingOptsJson = pingCmdJson cmd
-- TODO: set to 0 when --handshake-only
, CNP.pingOptsCount = pingCmdCount cmd
, CNP.pingOptsHost = maybeHostEndPoint (pingCmdEndPoint cmd)
, CNP.pingOptsUnixSock = maybeUnixSockEndPoint (pingCmdEndPoint cmd)
Expand Down Expand Up @@ -145,14 +146,22 @@ pHost =
, Opt.help "Hostname/IP, e.g. relay.iohk.example."
]

pHanshakeOnly :: Opt.Parser ()
pHanshakeOnly =
( Opt.flag' () $ mconcat
[ Opt.long "handshake-only"
, Opt.help "Perform only the handshake process without sending a ping."
])

Check notice

Code scanning / HLint

Redundant bracket Note

cardano-cli/src/Cardano/CLI/Run/Ping.hs:(151,3)-(154,6): Suggestion: Redundant bracket
  
Found:
  (Opt.flag' ()
     $ mconcat
         [Opt.long "handshake-only",
          Opt.help
            "Perform only the handshake process without sending a ping."])
  
Perhaps:
  Opt.flag' ()
    $ mconcat
        [Opt.long "handshake-only",
         Opt.help
           "Perform only the handshake process without sending a ping."]

pUnixSocket :: Opt.Parser String
pUnixSocket =
Opt.strOption $ mconcat
pHanshakeOnly *>
( Opt.strOption $ mconcat
[ Opt.long "unixsock"
, Opt.short 'u'
, Opt.metavar "SOCKET"
, Opt.help "Unix socket, e.g. file.socket."
]
])

pEndPoint :: Opt.Parser EndPoint
pEndPoint = fmap HostEndPoint pHost <|> fmap UnixSockEndPoint pUnixSocket
Expand Down Expand Up @@ -202,6 +211,9 @@ pPing = PingCmd
<*> ( Opt.switch $ mconcat
[ Opt.long "query-versions"
, Opt.short 'Q'
, Opt.help "Query the supported protocol versions using the handshake protocol and terminate the connection."
, Opt.help $ mconcat
[ "Query the supported protocol versions using the handshake protocol and terminate the connection. "
, "(deprecated; use under --handshake-only instead)."
]
]
)

0 comments on commit 603309a

Please sign in to comment.