| SMLDoc |
signature GETOPT =
sig
type 'a opt_descr =
{short : string, long : string list, desc : 'a arg_descr, help : string}
datatype 'a arg_order = RequireOrder | Permute | ReturnInOrder of string -> 'a
datatype 'a arg_descr =
NoArg of 'a
| ReqArg of (string -> 'a) * string
| OptArg of (string option -> 'a) * string
val usageInfo : string -> 'a opt_descr list -> string
val getOpt
: 'a arg_order ->
'a opt_descr list ->
string list -> 'a list * string list * string list
end
Two rather obscure features are missing: The Bash 2.0 non-option hack (if you don't already know it, you probably don't want to hear about it...) and the recognition of long options with a single dash (e.g. '-help' is recognised as '--help', as long as there is no short option 'h').
Other differences between GNU's getopt and this implementation:
- To enforce a coherent description of options and arguments, there are explanation fields in the option/argument descriptor.
- Error messages are now more informative, but no longer POSIX compliant... :-(
- Author:
- (c) 1998 Bell Labs, Lucent Technologies.
- Version:
- $Id: SigGETOPT.html,v 1.9 2007/02/17 07:01:57 kiyoshiy Exp $
Type detail |
---|
type 'a opt_descr =
{short : string, long : string list, desc : 'a arg_descr, help : string}
Datatype detail |
---|
datatype 'a arg_order = RequireOrder | Permute | ReturnInOrder of string -> 'a
datatype 'a arg_descr =
NoArg of 'a
| ReqArg of (string -> 'a) * string
| OptArg of (string option -> 'a) * string
DataConstructor detail |
---|
constructor RequireOrder : 'a arg_order
constructor Permute : 'a arg_order
constructor ReturnInOrder : (string -> 'a) -> 'a arg_order
constructor NoArg : 'a -> 'a arg_descr
constructor ReqArg : (string -> 'a) * string -> 'a arg_descr
constructor OptArg : (string option -> 'a) * string -> 'a arg_descr
Value detail |
---|
val usageInfo : string -> 'a opt_descr list -> string
val getOpt
: 'a arg_order ->
'a opt_descr list -> string list -> 'a list * string list * string list
| SMLDoc: Documentation generator for SML |