package
package option ?arg ...?
Loads packages by name and version. With the capabilities package and file, the handler tclPkgUnknown reads the pkgIndex.tcl file of each folder of auto_path and of each folder in it, as Tcl does. A script can also run package ifneeded itself. A build with modules loads the built-in ztcl:: modules by name. With no capability, only names, present, provide, require, and versions exist.
Subcommands
| Synopsis | What it does |
|---|---|
package require ?-exact? NAME ?VERSION ...? |
Loads a package and gives its version. |
package provide NAME ?VERSION? |
Says that the package is loaded, or gives its version. |
package ifneeded NAME VERSION ?SCRIPT? |
The script that loads a version. |
package present ?-exact? NAME ?VERSION? |
The version of a loaded package, or an error. |
package names |
The names of the known packages. |
package versions NAME |
The versions of a package that ifneeded knows. |
package forget ?NAME ...? |
Forgets packages. |
package vcompare V1 V2 |
-1, 0, or 1. |
package vsatisfies VERSION REQ ?REQ ...? |
1 when VERSION fits a requirement such as 1.2, 1.2-, or 1.2-2.0. |
| `package prefer ?latest | stable?` |
package unknown ?CMD? |
The command that runs for a missing package. |
Examples
A click on an example runs it in the shell of the page.
package require ztcl::json:1.0package provide jot 0.1.0; package present jot:0.1.0
Facts
- Capability: none.
- Compute cost: one compute unit for the call, and more for the commands that it runs.