Version 1 of Browse available extensions and their commands

Updated 2003-01-22 13:32:43

Purpose: to provide a command that allows one to see what extensions/packages are available within a particular interpreter's environment, as well as what commands/procs are available within a particular extension/package.


The following code is a first draft at providing this functionality. It is incomplete - currently the code only outputs a sorted list of packages available to package require, along with their versions.

I'll hopefully have time to enhance this to add the ability to list commands from a package - once I figure out how to do that.

 #! /usr/tcl84/bin/tclsh
 # Name: WhatsAvailable
 # Purpose: List the packages, versions, and commands within a package
 #              able to be package required by the tcl interpreter.
 # Version: 1.0
 # Author: Larry W. Virden

 catch {package require "" }
 set pkglist [lsort -dictionary [package names]]
 foreach i $pkglist {
        set a [lsort -dictionary [package versions $i] ]
        puts [format "%s, versions: %s " $i $a]
 }

See also Introspection.

[ Category Application | ]