Safe Haskell | Safe |
---|---|
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.
- addCommand :: String -> String -> String -> (a -> b) -> Parser c -> Parser a -> EitherT b (Writer (Mod CommandFields (b, c))) ()
- addSubCommands :: Monoid c => String -> String -> String -> Parser c -> EitherT b (Writer (Mod CommandFields (b, c))) () -> EitherT 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))) -> EitherT b (Writer (Mod CommandFields (b, a))) () -> IO (a, b)
- complicatedParser :: Monoid a => Parser a -> EitherT 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 |
-> Parser c | common parser |
-> Parser a | command parser |
-> EitherT 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 |
-> EitherT b (Writer (Mod CommandFields (b, c))) () | sub-commands (use |
-> EitherT 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; |
-> EitherT b (Writer (Mod CommandFields (b, a))) () | commands (use |
-> IO (a, b) |
Generate and execute a complicated options parser.
:: Monoid a | |
=> Parser a | common settings |
-> EitherT b (Writer (Mod CommandFields (b, a))) () | commands (use |
-> Parser (a, (b, a)) |
Generate a complicated options parser.