aboutsummaryrefslogtreecommitdiff
path: root/starkit/main.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'starkit/main.tcl')
-rw-r--r--starkit/main.tcl35
1 files changed, 35 insertions, 0 deletions
diff --git a/starkit/main.tcl b/starkit/main.tcl
new file mode 100644
index 0000000..724f807
--- /dev/null
+++ b/starkit/main.tcl
@@ -0,0 +1,35 @@
+
+package require starkit
+
+set method [starkit::startup]
+if { $method eq "sourced"} return
+
+array set help {
+ demo { Launch a package demo
+
+ Usage: demo package
+ }
+}
+
+set action [lindex $argv 0]
+set path [file dirname [info script]]
+
+set validActions [array names help]
+if { $action eq "" ||
+ ($action eq "help" && [llength $argv] == 1 &&
+ [lsearch $validActions $action] < 0) } {
+ puts "Specify one of the following commands:\n"
+ foreach c [array names help] {
+ puts -nonewline " $c"
+ }
+ puts "\n\nFor more information, type: $argv0 help ?command?"
+ exit
+} elseif { $action eq "help" } {
+ set cmd [lindex $argv 1]
+ puts $help($cmd)
+ exit
+}
+
+set argv [lrange $argv 1 end]
+
+source [file join $path $action.tcl]