#!/usr/local/bin/tclsh8.3

catch {source "[file dirname [info script]]/lib.tcl"}

proc GetChildNameSpaces {{pNameSpace ""} {pIndent 0}} {
	GetProcs $pNameSpace $pIndent
	set lNameSpaces [lsort -dictionary [namespace children $pNameSpace]]
	foreach lNameSpace $lNameSpaces {
		puts "[string repeat "    " $pIndent]$lNameSpace"
		##GetProcs $lNameSpace $pIndent
		GetChildNameSpaces $lNameSpace [expr $pIndent + 1]
	}
}

proc GetProcs {{pNameSpace ""} {pIndent 0}} {
	set lProcs [info procs "$pNameSpace\::*"]
	
	foreach lProc $lProcs {
		puts "[string repeat "    " $pIndent]$lProc \{[info args $lProc]\}"
	}
}

GetChildNameSpaces $argv
