info commands
Gives the names of the commands that a script can call from the current namespace.
info commands ?PATTERN?
Description
With no PATTERN, gives the name of each command of the current namespace and of the global namespace: the built-in commands, the procs, and each other command. With PATTERN, the list has only the names that match it as a glob pattern.
A PATTERN with ::, such as ::ns::*, lists the commands of that namespace with their full names. In a namespace other than ::, a PATTERN with no :: gives each command of the current namespace with its full name, and each global command with its plain name.
The list is not sorted.
Arguments
| Argument | Type | Default | Description |
|---|---|---|---|
| PATTERN | glob pattern | none | The names to keep. |
Returns
A list of command names.
Examples
% proc myp {} {}; info commands myp
myp
# Tcl 9.1 only
% lsort [info commands lse*]
lsearch lseq lset
# Tcl 8.6 only
% lsort [info commands lse*]
lsearch lset
% namespace eval ns {proc q {} {}}; info commands ::ns::*
::ns::q
% namespace eval ns {proc q {} {}}; namespace eval ns {info commands q}
::ns::q
% info commands nope
Errors
% info commands a b
wrong # args: should be "info commands ?pattern?"
-errorcode TCL WRONGARGS
Differences from Tcl
- In a namespace other than
::, a PATTERN with no::gives the commands of the current namespace with their full names. Tcl gives the plain names.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztcl 1.0.0-beta.1