|
||||||
| SUMMARY: CHILDREN | PARAMETER | INSTPROC | INSTFILTER | INSTFORWARD | DETAIL: | INSTPROC | |||||
::xotcl::Object | +--::xotcl::Class
ParseArgs is a meta-class that allows its instances to quickly add flags and parse command line arguments. ParseArgs wraps XOTcl's non-positional arguments built-in ability.
| Variables | |||
| Name | Default Value | Class | Comment |
flags |
"" | ::xox::ParseArgs | Flags created with the addFlag method. |
version |
::xotcl::Class | ||
| Methods | |
| Name | Comment |
addFlag {flag}
| Adds a pair of methods that can be used to set flags on the command line |
parse {args}
| Uses XOTcl's configure to parse dashed args |
| Methods from ::xotcl::Class |
allinstances, classParameter, classParameterArray, garbageCollect, getPackage, id, instfilterappend, instmixinappend, insttclcmd,
|
| Methods from ::xotcl::Object |
#, ., ?, ?code, ?methods, ?object, abstract, copy, coverageFilter, defaultmethod, extractConfigureArg, filterappend, garbageCollect, get#, getClean#, hasclass, init, methodTag, mixinappend, move, profileFilter, self, setParameterDefaults, shell, tclcmd, traceFilter,
|
| Instproc Detail |
Adds a pair of methods that can be used to set flags on the command line.
flag ::xox::ParseArgs instproc addFlag {flag} {
my lappend flags $flag
my instproc $flag { } "
::xotcl::my set $flag 1
"
my instproc is$flag { } "
::xotcl::my instvar $flag
return \$$flag
"
}
Uses XOTcl's configure to parse dashed args.
args ::xox::ParseArgs instproc parse {args} {
my instvar flags
set parsedArgs [ my new ]
foreach flag $flags {
$parsedArgs set $flag 0
}
eval "$parsedArgs configure $args"
return $parsedArgs
}