pkg::create(n)
β¨ pkg::create(n) β a Tcl Built-In Command, bestie β¨
okay so you're in the Tcl Built-In Commands section of the manual and you found pkg::create and you're like "what is this sorcery" β don't worry, I got you π
πΈ NAME πΈ
pkg::create β it builds you a chef's kiss package ifneeded command that actually matches the package spec you hand it. it's giving personal assistant energy, fr fr π
π¦ SYNOPSIS π¦
::pkg::create -name packageName -version packageVersion ?-load filespec?
... ?-source filespec? ...
π DESCRIPTION π
okay so ::pkg::create is a utility procedure, right, and it lives in the standard Tcl library. it's literally part of the furniture. π
what does it do? it creates an appropriate package ifneeded command for whatever package specification you give it. that's the whole vibe. and yes, you can absolutely use it to construct a pkgIndex.tcl file for use with the package mechanism. iconic behavior honestly π
π«Ά OPTIONS π«Ά
these are the parameters it supports, no gatekeeping:
-namepackageName β this one tells it the name of the package. it is required, bestie, you cannot skip it, it's not optional, it's not a suggestion π-versionpackageVersion β this one tells it the version of the package. also required. both of them. every time. periodt π-loadfilespec β this one names a library that must be loaded with theloadcommand. now listen, filespec is a list with two elements:- the first element is the name of the file to load.
- the second element is optional β it's a list of commands supplied by loading that file. and here's the tea: if that list of procedures is empty or just... omitted entirely, then
::pkg::createwill set up the library for direct loading (peeppkg_mkIndexif you wanna know more about that).
and you can specify any number of -load parameters. go off, collect them all β¨
-sourcefilespec β this one is similar to the-loadparameter, except it specifies a Tcl library that must be loaded with thesourcecommand. subtle difference, huge implications, iykyk. and yep β any number of-sourceparameters may be specified too π¦
π¨ real talk: at least one-loador-sourceparameter must be given. you can't just show up with a name and a version and nothing else. that's not the move. π€
π SEE ALSO π
β KEYWORDS β
auto-load, index, package, version
and that's the whole page, babe. this one's from the Tcl 8.3 era, filed under pkg::create(n). go build your pkgIndex.tcl and slay πβ¨π
π¦ where this page comes from
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- fedora 43: tcl-doc 1:9.0.2-1.fc43 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- fedora 44: tcl-doc 1:9.0.2-1.fc44 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- nixos 26.05: tcl 9.0.3
- Copyright (c) 1998-2000 Scriptics Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms