You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

81 lines
2.1 KiB

package provide punk::mix [namespace eval punk::mix {
variable version
set version 0.2
}]
namespace eval punk::mix {
proc runcli {args} {
if {![llength $args]} {
tailcall punk::mix::clicommands help
} else {
tailcall punk::mix::clicommands {*}$args
}
}
}
oo::object create punk::mix::clicommands
oo::objdefine punk::mix::clicommands {
#namespace ensemble configure [namespace current] -unknown punk::mix::clicommands::_unknown
method set_alias {cmdname} {
uplevel #0 [list interp alias {} $cmdname {} punk::mix::runcli]
}
#method _unknown {ns args} {
# puts stderr "arglen:[llength $args]"
# puts stdout "_unknown '$ns' '$args'"
#
# list punk::mix::clicommands::help {*}$args
#}
method 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
}
method 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 <commandname>
#' ```
#'
#'
set commands [namespace export]
set helpstr ""
append helpstr "commands:\n"
foreach cmd $commands {
append helpstr " $cmd"
}
return $helpstr
}
unexport destroy
}
#package require punk
#package require punk::mix_extension
#punk::ensemble::extend punk::mix::clicommands punk::mix_extension