kJ~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}EThe general type of annotations that can be associated with a value. ~~~~ $Collapse multiple values in to one. BAdd an annotation to a value. Note that if the value is evaluated H more than once the annotation will only be available the first time.     Flag: "8I want users to be able to omit the value for this flag." &Make the value of a flag optional. If --flag is given, it will  be treated as --flag= this_argument.  {hello = def &= opt "foo"} ' -h --hello[=VALUE] (default=foo) Flag: "7For this flag, users need to give something of type ..." The the type of a flag''s value, usually upper case. Only used 3 for the help message. Commonly the type will be FILE ()  or DIR ().  {hello = def &= typ "MESSAGE"}  -h --hello=MESSAGE Flag: "$Users must give a file for this flag's value."  Alias for  FILE. Flag: ")Users must give a directory for this flag's value."  Alias for  DIR. Flag/Mode: "The help message is ..." *Descriptive text used in the help output. & {hello = def &= help "Help message"} & -h --hello=VALUE Help message Flag: ""Use this flag name for this field." %Add flags which trigger this option.  {hello = def &= name "foo"}  -h --hello --foo=VALUE Flag: "Put non-flag arguments here."  {hello = def &= args} Flag: "#Put the nth non-flag argument here." BThis field should be used to store a particular argument position  (0-based).  {hello = def &= argPos 0} Flag/Mode: "Give these flags/&modes a group name in the help output." .This mode will be used for all following modes/flags, until the  next  groupname. ' {hello = def &= groupname "Welcomes"}  Welcomes  -h --hello=VALUE Mode: "(A longer description of this mode is ..." (Suffix to be added to the help message. G Sample{..} &= details ["More details on the website www.example.org"] Modes: "My program name/version/copyright is ..." :One line summary of the entire program, the first line of  --help and the only line of  --version. > Sample{..} &= summary "CmdArgs v0.0, (C) Neil Mitchell 1981" Mode: "If the user doesn't give a mode, use this one." FThis mode is the default. If no mode is specified and a mode has this G attribute then that mode is selected, otherwise an error is raised. 1 modes [Mode1{..}, Mode2{..} &= auto, Mode3{..}] Modes: ""My program executable is named ..." KThis is the name of the program executable. Only used in the help message. % Defaults to the type of the mode.  Sample{..} &= program "sample" Flag: "Don'!t guess any names for this field." 7A field should not have any flag names guessed for it. ' All flag names must be specified by flag. ) {hello = def &= explicit &= flag "foo"}  --foo=VALUE Modes: "!My program needs verbosity flags." Add  --verbose and --quiet flags.    The verbosity data type HOutput lots of messages (typically errors, warnings and status updates) 7Output normal messages (typically errors and warnings) 2Only output essential messages (typically errors) Set the global verbosity. $Get the global verbosity. Initially Normal before any calls to . 7Used to test if warnings should be output to the user.  True if the verbosity is set to  or  (when --quiet is not specified). =Used to test if status updates should be output to the user.  True if the verbosity is set to  (when  --verbose is specified). DAn action to perform if the verbosity is normal or higher, based on . 8An action to perform if the verbosity is loud, based on .    2An unnamed argument. "A way of processing the argument. ,The type of data for the argument, i.e. FILE/DIR/EXT !BA flag, consisting of a list of flag names and other information. "#The names for the flag. $Information about a flag' s arguments. %The way of processing a flag. &1The type of data for the flag argument, i.e. FILE/DIR/EXT ',The help message associated with this flag. (NA function to take a string, and a value, and either produce an error message  (Left), or a modified value (Right). )The )! type has the following meaning: < FlagReq FlagOpt FlagOptRare/FlagNone 0 -xfoo -x=foo -x=foo -x= -foo / -x foo -x=foo -x foo -x= foo . -x=foo -x=foo -x=foo -x=foo 0 --xx foo --xx=foo --xx foo --xx foo 0 --xx=foo --xx=foo --xx=foo --xx=foo * No argument +6Optional argument that requires an = before the value ,Optional argument -Required argument .+A mode. Each mode has three main features:  A list of submodes (0)  A list of flags (7) ! Optionally an unnamed argument (6) /0The available sub-modes 1 The names assigned to this mode 2Value to start with 34 Help text 5,A longer help suffix displayed after a mode 6An unnamed argument 7Groups of flags 8LA group of items (modes or flags). The items are treated as a list, but the = group structure is used when displaying the help message. 9:Normal items. ;;Items that are hidden (not displayed in the help message). <FItems that have been grouped, along with a description of each group. =The type of a flag, i.e. --foo=TYPE. >7A help message that goes with either a flag or a mode. ?#A name, either the name of a flag (--foo) or the name of a mode. @:Parse a boolean, accepts as True: true yes on enabled 1. AConvert a group into a list. B3Convert a list into a group, placing all fields in :. CExtract the modes from a /. DExtract the flags from a /. E Extract the value from inside a , or +, or raises an error. F"Check that a mode is well formed. G Change the underlying type of a /. structure. Embed the mode 0Extract the mode and give a way of re-embedding H[Create a mode with a name, an initial value, some help text, a way of processing arguments  and a list of flags. IcCreate a list of modes, with a program name, an initial value, some help text and the child modes. JVCreate a flag taking no argument value, with a list of flag names, an update function  and some help text. K_Create a flag taking an optional argument value, with an optional value, a list of flag names, D an update function, the type of the argument and some help text. LKCreate a flag taking a required argument value, with a list of flag names, D an update function, the type of the argument and some help text. MOCreate an argument flag, with an update function and the type of the argument. NYCreate a boolean flag, with a list of flag names, an update function and some help text. 2 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN2  !"#$%&'"#$%&'()-,+**+,-. /01234567/0123456789:;<9:;<=>?@ABCDEFGHIJKLMNOProcess the flags obtained by getArgs with a mode. Displays R an error and exits with failure if the command line fails to parse, or returns 1 the associated value. Implemented in terms of Q. P/Process a list of flags (usually obtained from getArgs) with a mode. Displays R an error and exits with failure if the command line fails to parse, or returns 2 the associated value. Implemeneted in terms of Q. Q/Process a list of flags (usually obtained from getArgs) with a mode. Returns  Left= and an error message if the command line fails to parse, or Right and  the associated value. OPQOPQRClass for default values. S!Provide a default value, such as (), False, 0, [], Nothing. RSRSRSS T8The data type representing some text, typically used as [Text]. The formatting  is described by:  VK values represent a paragraph of text, and may be wrapped depending on the W.  If a VG value is wrapped then all leading space will be treated as an indent.  U. values represent columns of text. Within any [Text] all columns of the same length c are grouped in tabs, with the final column being wrapped if necessary. All columns are placed a adjacent with no space between them - for this reason most columns will start with a space. UVWHow to output the text. X0Display as text wrapped at a certain width (see Z). YDisplay as HTML. Z.Wrap with the default width of 80 characters. [+Show some text using the given formatting. ;Split the text into strips of no-more than the given width TUVWXYZ[WYXZTVU[TVUUVWYXXYZ[ \'Specify the format to output the help. ]Display all modes. ^Display only the first mode. _Equivalent to ]* if there is not too much text, otherwise ^. `%Generate a help message from a mode. Help text for all modes ! <program> [OPTIONS] <file_args>  <options> + <program> MODE [SUBMODE] [OPTIONS] [FLAG] Help text for only this mode ! <program> [OPTIONS] <file_args>  <options>  <program> MODE [FLAGS]  <options> \]^_`\_^]]^_`a Create a help flag triggered by -?/--help. b Create a help flag triggered by -?/--help . The user A may optionally modify help by specifying the format, such as: * --help=all - help for all modes + --help=html - help in HTML format 7 --help=100 - wrap the text at 100 characters ; --help=100,one - full text wrapped at 100 characters c#Create a version flag triggered by -V/ --version. d$Create verbosity flags triggered by -v/ --verbose and  -q/--quiet > !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQ\]^_`abcd>QPO?>=@89:;<AB./01234567CD)-,+*E(!"#$%&' FGHIJKLMNabcd\_^]`abcd e@Describes whether an option takes an argument or not, and if so 5 how the argument is injected into a value of type a. foptional argument goption requires argument hno argument expected iEach i describes a single option/flag. The arguments to j are: ! list of short option characters & list of long option strings (without --, may not be 1 character long)  argument descriptor $ explanation of option for userdata jk/What to do with options following non-options. Changes: Only l is allowed, both  RequireOrder and  ReturnInOrder  have been removed. lm@Return a string describing the usage of a command, derived from A the header (first argument) and the options described by the  second argument. nEProcess the command-line, and return the list of values that matched  (and those that didn't). The arguments are:  The order requirements (see k)  The option descriptions (see i) 9 The actual command line arguments (presumably got from  System.Environment.getArgs). n= returns a triple consisting of the option arguments, a list 1 of non-options, and a list of error messages. Changes:> The list of errors will contain at most one entry, and if an < error is present then the other two lists will be empty. oChanges: This is exactly the same as n, but the 3rd element of the . tuple (second last) will be an empty list. p@Given a help text and a list of option descriptions, generate a /.. efghijklmnop pnomklijehgf ehgffghijjkllmnop0Both Any will be the same type as ReadContainer 4If c is the container type, and a is the atom type: ! Type (c a) -> c a -> a -> c a %The Any will be the type as ReadAtom *      !"#$%&'()*+,-.%      !"#$%&'()%           !"#$%&'("#$%&'()/0,The number of arguments that have been seen q5A structure to store the additional data relating to --help,   --version, --quiet and  --verbose. rs$The underlying value being wrapped. tJust if --help4 is given, then gives the help message for display. uJust if --verion7 is given, then gives the version message for display. vJust if --quiet or  --verbose, is given, then gives the verbosity to use. w3Private: Only exported due to Haddock limitations. 123456789:;< qrstuvw12 qrstuvwrstuvw12x?Take annotated records and run the corresponding command line.  Shortcut for z . y. y-Take annotated records and turn them in to a . value, that can  make use of the System.Console.CmdArgs.Explicit functions (i.e. process). CAnnotated records are impure, and will only contain annotations on L their first use. The result of this function is pure, and can be reused. zERun a Mode structure. This function reads the command line arguments ! and then performs as follows: C If invalid arguments are given, it will display the error message  and exit.  If --help6 is given, it will display the help message and exit.  If  --version1 is given, it will display the version and exit. = In all other circumstances the program will return a value.  Additionally, if either --quiet or  --verbose is given (see ) $ it will set the verbosity (see ). {,Perform the necessary actions dictated by a rq structure.  If t is Just-, it will display the help message and exit.  If u is Just(, it will display the version and exit. 4 In all other circumstances it will return a value.  Additionally, if v is Just (see ) $ it will set the verbosity (see ). |Modes: ":I want a program with multiple modes, like darcs or cabal." CTakes a list of modes, and creates a mode which includes them all. = If you want one of the modes to be chosen by default, see . 2 data Modes = Mode1 | Mode2 | Mode3 deriving Data % cmdArgs $ modes [Mode1,Mode2,Mode3] }Flag: "II want several different flags to set this one field to different values." LThis annotation takes a type which is an enumeration, and provides multiple 2 separate flags to set the field to each value. % data State = On | Off deriving Data # data Mode = Mode {state :: State} M cmdArgs $ Mode {state = enum [On &= help "Turn on",Off &= help "Turn off"]}  --on Turn on  --off Turn off - .RSqrstuvwxyz{|}!xyz{qrstuvw|} .xyz{|}- .RSqrstuvwxyz{|}=       ! " # $ % & ' ( )*+,-./0123 4 4 5 6 7 7 8 9 : ; < = > ? @ A B C C D E F G H I J K L L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` abcdefghijklmnopqrstuvwxyz{|}~\RQ             !       !"##$%&'()*+,-./001234+,5-6789: cmdargs-0.2System.Console.CmdArgs.Implicit System.Console.CmdArgs.VerbositySystem.Console.CmdArgs.ExplicitSystem.Console.CmdArgs.DefaultSystem.Console.CmdArgs.TextSystem.Console.CmdArgs.GetOpt#System.Console.CmdArgs.Implicit.AnnData.Generics.Any'System.Console.CmdArgs.Implicit.Capture%System.Console.CmdArgs.Implicit.Step1Data.Generics.Any.Prelude"System.Console.CmdArgs.Implicit.UI$System.Console.CmdArgs.Explicit.Type'System.Console.CmdArgs.Explicit.Process$System.Console.CmdArgs.Explicit.Help$System.Console.CmdArgs.Implicit.Read%System.Console.CmdArgs.Implicit.Step2%System.Console.CmdArgs.Implicit.Step3System.Console.CmdArgsbase Data.DataData Data.TypeableTypeableAnn&=opttyptypFiletypDirhelpnameargsargPos groupnamedetailssummaryautoprogramexplicit verbosity VerbosityLoudNormalQuiet setVerbosity getVerbosityisNormalisLoud whenNormalwhenLoudArgargValueargTypeFlag flagNamesflagInfo flagValueflagTypeflagHelpUpdateFlagInfoFlagNone FlagOptRareFlagOptFlagReqModemodeGroupModes modeNames modeValue modeCheckmodeHelpmodeHelpSuffixmodeArgsmodeGroupFlagsGroup groupUnnamed groupHiden groupNamedFlagHelpHelpName parseBool fromGrouptoGroup modeModes modeFlags fromFlagOpt checkModeremapmodemodesflagNoneflagOptflagReqflagArgflagBool processArgs processValueprocessDefaultdefTextColsLine TextFormatWrapHTML defaultWrapshowText HelpFormat HelpFormatAll HelpFormatOneHelpFormatDefaulthelpTextflagHelpSimpleflagHelpFormat flagVersionflagsVerbosityArgDescrOptArgReqArgNoArgOptDescrOptionArgOrderPermute usageInfogetOptgetOpt'convertCmdArgs cmdArgsValue cmdArgsHelpcmdArgsVersioncmdArgsVerbositycmdArgsPrivatecmdArgs cmdArgsMode cmdArgsRun cmdArgsApplyenum ProgVerbosity ProgProgram ProgSummaryModeHelpSuffix ModeDefault FlagInheritFlagEnumFlagType FlagArgPosFlagArgs FlagOptional GroupNameExplicitAnyTAny FieldNameCtorName readTupleTypefromAnytoConstrtypeOf dataTypeOf isAlgType typeShell typeShellFulltypeNamectorfieldschildrencompose0 recomposectors decomposecomposegetFieldsetFieldarityCaptureCtorMissingValueManyrefmanycaptureforceFlag1Mode1Prog1step1mapModeexpand groupnamesinherit inheritMode inheritFlagflattenmoveAnn flattenProg flattenMode flattenFlag flattenValueheadtailconsnulljust_nil_appendunittupleisListisMaybeisTuplefromList fromMaybe fromTuple LookupNameFound AmbiguousNotFoundSvalerrs processModeerrupd processFlags processFlag lookupNameshowWrapwrapshowHTML helpTextAll helpTextOne helpTextMode helpGrouphelpFlagReadAtom ReadTupleReadEnum ReadString ReadDouble ReadFloat ReadIntegerReadIntReadBool ReadContainer ReadMaybeReadListfromReadContainertoReadContainer toReadAtom toReadEnumreader addContainerreadAtomreadEnum readTuplesplitunconcatreadHelp isReadBoolArg2 arg2FlagHelparg2Updarg2Posarg2Opt Flag2Type Flag2Value Flag2Bool Flag2StringfromFlag2StringFlag2 flag2Names flag2Groupflag2Updflag2Opt flag2FlagHelp flag2HelpMode2 mode2Names mode2Group mode2Value mode2Help mode2Suffix mode2Flags mode2ArgsProg2 prog2Summary prog2Name prog2Helpprog2Verbosityprog2ModeDefault prog2Modesstep2 transProg transMode transFlag transFlagTypetransArgCmdArgsPrivatecmdArgsHasValuestep3common commonFlagstoGroups transArgs orderArgsliftProgliftMode