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:

  • -name packageName β€” 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 😭
  • -version packageVersion β€” this one tells it the version of the package. also required. both of them. every time. periodt πŸ’…
  • -load filespec β€” this one names a library that must be loaded with the load command. now listen, filespec is a list with two elements:
    1. the first element is the name of the file to load.
    2. 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::create will set up the library for direct loading (peep pkg_mkIndex if you wanna know more about that).

and you can specify any number of -load parameters. go off, collect them all ✨

  • -source filespec β€” this one is similar to the -load parameter, except it specifies a Tcl library that must be loaded with the source command. subtle difference, huge implications, iykyk. and yep β€” any number of -source parameters may be specified too πŸ¦‹
🚨 real talk: at least one -load or -source parameter 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