-- |
--
-- Module : Ronn.Options.ApplicativeSpec
-- Copyright : (c) 2024 Patrick Brisbin
-- License : AGPL-3
-- Maintainer : pbrisbin@gmail.com
-- Stability : experimental
-- Portability : POSIX
module Ronn.Options.ApplicativeSpec
( spec
) where
import Prelude
import Options.Applicative
import Ronn.Options.Applicative ()
import Ronn.Test
import Test.Hspec
spec :: Spec
spec = do
specify "complete example" $
ronnGolden "optparse-applicative" $
(,,,)
<$> optional (switch (long "debug" <> help "Enable debug"))
<*> option
(str @String)
( mconcat
[ short 'o'
, long "output"
, help "Output file"
, metavar "FILE"
, value "-"
, showDefault
]
)
<*> argument (str @String) (help "Input file" <> metavar "INPUT")
<*> subparser
( command
"serve"
( info
(pure ())
(progDesc "Run the server")
)
<> command
"build"
( info
(pure ())
(progDesc "Build the project")
)
<> metavar "COMMAND"
<> help "Command to run"
)