tcl::OptProc
tcl::OptProc name description body
The opt package 0.4.9 of the Tcl library, with package require opt: a proc whose words are checked against a description of flags and parameters. Each item of the description is a flag (-name) or a parameter (name, or ?name? when it is optional), with a type (-int, -float, -boolean, -string, -list, -choice LIST, -any), a default value, and a help text. A flag can be a prefix of its name in any case. The body sees a variable for each item. -help gives a table of the items, and a missing, bad, or extra word gives an error with that table.
This page also has tcl::OptKeyRegister, tcl::OptKeyDelete, tcl::OptKeyParse, tcl::OptKeyError, tcl::OptParse, tcl::OptProcArgGiven, tcl::OptCheckType, tcl::Lempty, tcl::Lget, tcl::Lvarset, tcl::Lvarset1, tcl::Lvarincr, tcl::Lvarpop, tcl::Lassign, tcl::SetMax, tcl::SetMin.
Examples
package require optgives0.4.9tcl::OptProc greet {{name -string "who"} {-loud}} {list $name $loud}; greet Ann -lgivesAnn 1
Facts
- Capability:
package. A new interpreter does not have this command. See Limits and capabilities. - Compute cost: one compute unit for the call, and more for the commands that it runs.