I am trying to use optparse-applicative.
How can I access arguments that are not options?
(From prog --foo --bar=42 baz
, I want to get ["baz"]
)
All the the "high level" functions https://hackage.haskell.org/package/optparse-applicative-0.11.0.2/docs/Options-Applicative-Extra.html
return a
where I want (a,[String])
.
There is some low-level function https://hackage.haskell.org/package/optparse-applicative-0.11.0.2/docs/Options-Applicative-Common.html#v:runParser but I cannot call it directly because of its type. And indeed I do want to re-use all the plumbing that is in https://hackage.haskell.org/package/optparse-applicative-0.11.0.2/docs/src/Options-Applicative-Extra.html#execParser .
Positional arguments are part of the parser specification. They are not returned separately by the function that runs the parser. The functions argument
and strArgument
can be used to add a parser for a positional argument to the specification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With