beetlebug▾
/

tcl::OptProc OptKeyRegister

Keeps a description of arguments under a key, for tcl::OptKeyParse.

tcl::OptKeyRegister DESCRIPTION ?KEY?

Description

Keeps DESCRIPTION, in the form of tcl::OptProc, under KEY, and gives KEY. With no KEY, the key is the next free integer from 0. A second description with the same KEY replaces the first.

Arguments

ArgumentTypeDefaultDescription
DESCRIPTIONlistrequiredThe list of the flags and the parameters.
KEYstringnoneThe name of the description.

Returns

The key.

Examples

Each example of this page runs after package require opt.

% tcl::OptKeyRegister {{x -int 0 "x"} {-y}} k1
k1

% tcl::OptKeyRegister {{-z}}
0

Errors

% tcl::OptKeyRegister
wrong # args: should be "tcl::OptKeyRegister desc ?key?"
-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

See also