tcl::OptProc OptProcArgGiven
In a proc of tcl::OptProc, tells whether the call gave a flag or a parameter.
tcl::OptProcArgGiven NAME
Description
Gives 1 when the last call of the proc that runs it had the item NAME, such as -q, and 0 when the item has its default. NAME has no regard to case.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| NAME | string | required | The name of an item, such as -q. |
Returns
1 or 0.
Examples
Each example of this page runs after package require opt.
% tcl::OptProc h {{-q}} {tcl::OptProcArgGiven -q}
> list [h] [h -q]
0 1
Errors
# Outside a proc, the command has no call to read.
% tcl::OptProcArgGiven -q
bad level "0"
-errorcode NONE
% tcl::OptProcArgGiven
wrong # args: should be "tcl::OptProcArgGiven argname"
-errorcode TCL WRONGARGS
Facts
- Capability
package. A new interpreter does not have it until the host turns it on.- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1