Posted to tcl by Stu at Sun Nov 17 15:34:32 GMT 2019view raw
- namespace eval schema {
- namespace ensemble create
- namespace export command
- namespace eval command {
- namespace ensemble create
- namespace export mod1 mod2
- proc mod1 {args} { return "mod1: $args" }
- proc mod2 {args} { return "mod2: $args" }
- }
- }
- proc schema: {what args} { uplevel 1 [list schema {*}[string map {/ " "} $what] {*}$args] }
- % schema: command/mod1 dog goes woof
- mod1: dog goes woof
- % schema: command/mod2
- mod2:
- % schema: command/mod3
- unknown or ambiguous subcommand "mod3": must be mod1, or mod2