There is example: https://github.com/pcapriotti/optparse-applicative/blob/master/tests/Examples/Cabal.hs#L46-L62
parser :: Parser Args
parser = runA $ proc () -> do
opts <- asA commonOpts -< ()
cmds <- (asA . hsubparser)
( command "install"
(info installParser
(progDesc "Installs a list of packages"))
<> command "update"
(info updateParser
(progDesc "Updates list of known packages"))
<> command "configure"
(info configureParser
(progDesc "Prepare to build the package"))
<> command "build"
(info buildParser
(progDesc "Make this package ready for installation")) ) -< ()
A version >>> A helper -< Args opts cmds
...
pinfo :: ParserInfo Args
pinfo = info parser
( progDesc "An example modelled on cabal" )
main :: IO ()
main = do
r <- execParser pinfo
print r
So and by default when I don't use arguments it shows Usage info. I want to use case with no arguments, and also with one [Custom argument] (with custom one I'm getting error: Invalid argument 'regreg'
)
How can I handle empty and custom arguments here?