Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 -> (a -> b) -> (a -> c -> c) -> Parser c -> Parser a -> ExceptT b (Writer (Mod CommandFields (b, c))) ()
- addSubCommands :: Monoid c => String -> String -> String -> Parser c -> ExceptT b (Writer (Mod CommandFields (b, c))) () -> ExceptT b (Writer (Mod CommandFields (b, c))) ()
- complicatedOptions :: Monoid a => Version -> Maybe String -> String -> String -> String -> String -> Parser a -> Maybe (ParserFailure ParserHelp -> [String] -> IO (a, (b, a))) -> ExceptT b (Writer (Mod CommandFields (b, a))) () -> IO (a, b)
- complicatedParser :: Monoid a => String -> Parser a -> ExceptT b (Writer (Mod CommandFields (b, a))) () -> Parser (a, (b, a))
Documentation
:: String | command string |
-> String | title of command |
-> String | footer of command help |
-> (a -> b) | constructor to wrap up command in common data type |
-> (a -> c -> c) | extend common settings from local settings |
-> Parser c | common parser |
-> Parser a | command parser |
-> ExceptT b (Writer (Mod CommandFields (b, c))) () |
Add a command to the options dispatcher.
:: Monoid c | |
=> String | command string |
-> String | title of command |
-> String | footer of command help |
-> Parser c | common parser |
-> ExceptT b (Writer (Mod CommandFields (b, c))) () | sub-commands (use |
-> ExceptT b (Writer (Mod CommandFields (b, c))) () |
Add a command that takes sub-commands to the options dispatcher.
:: Monoid a | |
=> 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 a | common settings |
-> Maybe (ParserFailure ParserHelp -> [String] -> IO (a, (b, a))) | optional handler for parser failure; |
-> ExceptT b (Writer (Mod CommandFields (b, a))) () | commands (use |
-> IO (a, b) |
Generate and execute a complicated options parser.
:: Monoid a | |
=> String | metavar for the sub-command |
-> Parser a | common settings |
-> ExceptT b (Writer (Mod CommandFields (b, a))) () | commands (use |
-> Parser (a, (b, a)) |
Generate a complicated options parser.