namespace eval punk::mix { package require punk::lib package require punk::mix_custom proc runcli {args} { if {![llength $args]} { tailcall punk::mix::clicommands help } else { tailcall punk::mix::clicommands {*}$args } } } namespace eval punk::mix::clicommands { namespace export help new namespace ensemble create namespace ensemble configure [namespace current] -unknown punk::mix::clicommands::_unknown proc set_alias {cmdname} { uplevel #0 [list interp alias {} $cmdname {} punk::mix::runcli] } proc _unknown {ns args} { puts stderr "arglen:[llength $args]" puts stdout "_unknown '$ns' '$args'" list punk::mix::clicommands::help {*}$args } proc new {name} { set curdir [pwd] if {[file exists $curdir/$name]} { error "Unable to create new project at $curdir/$name - file/folder already exists" } set base $curdir/$name file mkdir $base file mkdir $base/src file mkdir $base/modules } } punk::ensemble::extend punk::mix::clicommands punk::mix_custom namespace eval punk::mix::clicommands { proc help {args} { #' **%ensemblecommand% help** *args* #' #' Help for ensemble commands in the command line interface #' #' #' Arguments: #' #' * args - first word of args is the helptopic requested - usually a command name #' - calling help with no arguments will list available commands #' #' Returns: help text (text) #' #' Examples: #' #' ``` #' %ensemblecommand% help #' ``` #' #' set commands [namespace export] set helpstr "" append helpstr "commands:\n" foreach cmd $commands { append helpstr " $cmd" } return $helpstr } } package provide punk::mix [namespace eval punk::mix { variable version set version 0.1 }]