From a068bbdb8ce1b4cc70e7eb2c6607d784a2a97236 Mon Sep 17 00:00:00 2001 From: James Burton Date: Wed, 10 Feb 2021 13:54:22 +0000 Subject: [PATCH] Simplified implementation of cert/key parser option --- yesod-bin/main.hs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/yesod-bin/main.hs b/yesod-bin/main.hs index 38ccf51b..9e5d7d66 100755 --- a/yesod-bin/main.hs +++ b/yesod-bin/main.hs @@ -169,15 +169,11 @@ develOptions = Devel <$> optStr ( long "success-hook" <> short 's' <> metavar "C <> help "Disable reverse proxy" ) <*> optStr (long "host" <> metavar "HOST" <> help "Host interface to bind to; IP address, '*' for all interfaces, '*4' for IP4, '*6' for IP6") - <*> optionPair - (strOption (long "cert" <> metavar "CERT" - <> help "Path to TLS certificate file, requires that --key is also defined")) - (strOption (long "key" <> metavar "KEY" - <> help "Path to TLS key file, requires that --cert is also defined")) - -optionPair :: Parser a -> Parser b -> Parser (Maybe (a,b)) -optionPair pa pb = Just <$> liftA2 (,) pa pb - <|> pure Nothing + <*> optional ( (,) + <$> strOption (long "cert" <> metavar "CERT" + <> help "Path to TLS certificate file, requires that --key is also defined") + <*> strOption (long "key" <> metavar "KEY" + <> help "Path to TLS key file, requires that --cert is also defined") ) extraStackArgs :: Parser [String] extraStackArgs = many (strOption ( long "extra-stack-arg" <> short 'e' <> metavar "ARG"