-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Command-line parser.
--
-- This package implements parsing of Plan 9-style command line flags.
@package getflag
@version 1.0
-- | This adaptation of System.Console.GetOpt provides easy handling
-- of classic Unix/Plan 9-style command line options. This means that
-- single dashes are used to prefix option names, which may be of any
-- length (not just single characters, although such is generally
-- recommended). It is not possible to collapse multiple options in a
-- single parameter, so you will have to write -a -b instead of
-- -ab. A single GNU extension is included: the parameter
-- -- will cause anything past it to be returned as arguments,
-- not options, even if the parameters have leading dashes.
--
-- The API is almost compatible with System.Console.GetOpt, the
-- only difference being in OptDescr, which no longer permits
-- multiple names per option.
module System.Console.GetFlag
-- | Process the command-line, and return the list of values that matched
-- (and those that didn't). The arguments are:
--
--
-- - The order requirements (see ArgOrder)
-- - The option descriptions (see OptDescr)
-- - The actual command line arguments (presumably got from
-- System.Environment.getArgs).
--
--
-- getOpt returns a triple consisting of the option arguments, a
-- list of non-options, and a list of error messages.
getOpt :: ArgOrder a -> [OptDescr a] -> [String] -> ([a], [String], [String])
-- | This is almost the same as getOpt, but returns a quadruple
-- consisting of the option arguments, a list of non-options, a list of
-- unrecognized options, and a list of error messages.
getOpt' :: ArgOrder a -> [OptDescr a] -> [String] -> ([a], [String], [String], [String])
-- | Return a string describing the usage of a command, derived from the
-- header (first argument) and the options described by the second
-- argument.
usageInfo :: String -> [OptDescr a] -> String
-- | What to do with options following non-options
data ArgOrder a
-- | no option processing after first non-option
RequireOrder :: ArgOrder a
-- | freely intersperse options and non-options
Permute :: ArgOrder a
-- | wrap non-options into options
ReturnInOrder :: (String -> a) -> ArgOrder a
-- | Each OptDescr describes a single option.
--
-- The arguments to Option are:
--
--
-- - the name of the option
-- - argument descriptor
-- - explanation of option for user
--
data OptDescr a
Option :: String -> (ArgDescr a) -> String -> OptDescr a
-- | Describes whether an option takes an argument or not, and if so how
-- the argument is injected into a value of type a.
data ArgDescr a
-- | no argument expected
NoArg :: a -> ArgDescr a
-- | option requires argument
ReqArg :: (String -> a) -> String -> ArgDescr a
-- | optional argument
OptArg :: (Maybe String -> a) -> String -> ArgDescr a