Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Simple interface to complicated program arguments.
This is a "fork" of the optparse-simple
package that has some workarounds
for optparse-applicative issues that become problematic with programs that
have many options and subcommands. Because it makes the interface more
complex, these workarounds are not suitable for pushing upstream to
optparse-applicative.
Synopsis
- addCommand :: String -> String -> String -> (opts -> RIO Runner ()) -> (opts -> GlobalOptsMonoid -> GlobalOptsMonoid) -> Parser GlobalOptsMonoid -> Parser opts -> AddCommand
- addSubCommands :: String -> String -> String -> Parser GlobalOptsMonoid -> AddCommand -> AddCommand
- complicatedOptions :: Version -> Maybe String -> String -> String -> String -> String -> Parser GlobalOptsMonoid -> Maybe (ParserFailure ParserHelp -> [String] -> IO (GlobalOptsMonoid, (RIO Runner (), GlobalOptsMonoid))) -> AddCommand -> IO (GlobalOptsMonoid, RIO Runner ())
- complicatedParser :: String -> Parser GlobalOptsMonoid -> AddCommand -> Parser (GlobalOptsMonoid, (RIO Runner (), GlobalOptsMonoid))
Documentation
:: String | command string |
-> String | title of command |
-> String | footer of command help |
-> (opts -> RIO Runner ()) | constructor to wrap up command in common data type |
-> (opts -> GlobalOptsMonoid -> GlobalOptsMonoid) | extend common settings from local settings |
-> Parser GlobalOptsMonoid | common parser |
-> Parser opts | command parser |
-> AddCommand |
Add a command to the options dispatcher.
:: String | command string |
-> String | title of command |
-> String | footer of command help |
-> Parser GlobalOptsMonoid | common parser |
-> AddCommand | sub-commands (use |
-> AddCommand |
Add a command that takes sub-commands to the options dispatcher.
:: Version | numeric version |
-> Maybe String | version string |
-> String | Hpack numeric version, as string |
-> String | header |
-> String | program description (displayed between usage and options listing in the help output) |
-> String | footer |
-> Parser GlobalOptsMonoid | common settings |
-> Maybe (ParserFailure ParserHelp -> [String] -> IO (GlobalOptsMonoid, (RIO Runner (), GlobalOptsMonoid))) | optional handler for parser failure; |
-> AddCommand | commands (use |
-> IO (GlobalOptsMonoid, RIO Runner ()) |
Generate and execute a complicated options parser.
:: String | metavar for the sub-command |
-> Parser GlobalOptsMonoid | common settings |
-> AddCommand | commands (use |
-> Parser (GlobalOptsMonoid, (RIO Runner (), GlobalOptsMonoid)) |
Generate a complicated options parser.