stack-1.7.1: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Options.Applicative.Complicated

Description

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

Documentation

addCommand Source #

Arguments

:: 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

-> ExceptT b (Writer (Mod CommandFields (b, c))) () 

Add a command to the options dispatcher.

addSubCommands Source #

Arguments

:: 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 addCommand)

-> ExceptT b (Writer (Mod CommandFields (b, c))) () 

Add a command that takes sub-commands to the options dispatcher.

complicatedOptions Source #

Arguments

:: 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; handleParseResult is called by default

-> ExceptT b (Writer (Mod CommandFields (b, a))) ()

commands (use addCommand)

-> IO (a, b) 

Generate and execute a complicated options parser.

complicatedParser Source #

Arguments

:: Monoid a 
=> String

metavar for the sub-command

-> Parser a

common settings

-> ExceptT b (Writer (Mod CommandFields (b, a))) ()

commands (use addCommand)

-> Parser (a, (b, a)) 

Generate a complicated options parser.