#!/usr/bin/tclsh set thisdir [file dirname [file normalize $argv0]] set libdir $thisdir/lib #set typedir $thisdir/atypes set excludelist { pkgIndex.tcl helgaPkg.tcl } namespace eval ::helga {} set filelist [glob -directory $libdir *] #set filelist [concat $filelist [glob -directory $typedir *]] foreach fl $filelist { set flbase [lindex [file split $fl] end] if { [lsearch $excludelist $flbase] == -1 } { source $fl } } set outxml "" # global commands set specials { hadd hget } set gcmdlist [info procs ::helga::global::*] set gcmdlist [lsort $gcmdlist] append outxml "" foreach cmd $gcmdlist { set cmdbase [namespace tail $cmd] if { [string range $cmdbase end-3 end] != "args" } { append outxml "$cmdbase" if { [lsearch $specials $cmdbase] != -1 } { set infoCmd "info procs ::helga::global::${cmdbase}?*args" set subCmds [eval $infoCmd] set subCmds [lsort $subCmds] set trimIndexLeft [expr 17 + [string length $cmdbase]] set trimIndexRight "end-4" foreach subCmd $subCmds { set trimmedName [string range $subCmd $trimIndexLeft $trimIndexRight] append outxml "$trimmedName" } } append outxml "" } } append outxml "" # all other namespaces append outxml "" set nslist [namespace children ::helga] set nslist [lsort $nslist] foreach ns $nslist { set nsbase [namespace tail $ns] if { $nsbase == "global" } { continue } append outxml "" append outxml "$nsbase" set file $libdir/${nsbase}.tcl set grepres [exec grep -n "namespace eval ::helga" $file] set startingline [expr [lindex [split $grepres :] 0] - 1] set filehead [exec head -n $startingline $file] set headsplit [split $filehead \n] set found false set desc "" for { set i [expr $startingline - 1] } { $i >= 0 } { incr i -1 } { set line [string trim [lindex $headsplit $i]] if { $line != "" && $line != "#" } { set found true lappend desc $line } elseif { $found } { break } } set desc [lreverse $desc] set out "" foreach line $desc { set line [string range $line 1 end] set line [string trim $line] if { $out != "" } { append out " " } append out "$line" } append outxml "$out" append outxml "" set cmdlist [info procs ${ns}::*] set cmdlist [lsort $cmdlist] foreach cmd $cmdlist { set cmdbase [namespace tail $cmd] if { [string range $cmdbase end-3 end] != "args" } { append outxml "$cmdbase" } } append outxml "" append outxml "" } append outxml "" append outxml "" puts $outxml