summaryrefslogtreecommitdiff
path: root/src/startup.tcl
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-07-11 15:07:58 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-07-11 15:07:58 +0000
commit69c6f1f7eab96ea47328ece9d71292a71af6ce9c (patch)
tree6541cec5290ddb00e0754e77a7d0f90e6b962f42 /src/startup.tcl
parentc5b718f5e85c7a884f7610fea46ceea2c3fbd4a7 (diff)
downloadopenocd+libswd-69c6f1f7eab96ea47328ece9d71292a71af6ce9c.tar.gz
openocd+libswd-69c6f1f7eab96ea47328ece9d71292a71af6ce9c.tar.bz2
openocd+libswd-69c6f1f7eab96ea47328ece9d71292a71af6ce9c.tar.xz
openocd+libswd-69c6f1f7eab96ea47328ece9d71292a71af6ce9c.zip
work in progress to improve help
git-svn-id: svn://svn.berlios.de/openocd/trunk@792 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/startup.tcl')
-rw-r--r--src/startup.tcl28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/startup.tcl b/src/startup.tcl
index acf93be4..029c4e4b 100644
--- a/src/startup.tcl
+++ b/src/startup.tcl
@@ -5,6 +5,20 @@
# Embedded into OpenOCD executable
#
+
+# Help text list. A list of command + help text pairs.
+#
+# Commands can be more than one word and they are stored
+# as "flash banks" "help text x x x"
+
+global ocd_helptext
+set ocd_helptext {}
+
+proc add_help_text {cmd cmd_help} {
+ global ocd_helptext
+ lappend ocd_helptext [list $cmd $cmd_help]
+}
+
# Production command
# FIX!!! need to figure out how to feed back relevant output
# from e.g. "flash banks" command...
@@ -48,6 +62,20 @@ proc flash args {
openocd_throw "flash $args"
}
+#Print help text for a command
+proc tcl_help {args} {
+ global ocd_helptext
+ set cmd $args
+ foreach a [lsort $ocd_helptext] {
+ if {[string length $cmd]==0||[string first $cmd $a]!=-1} {
+ puts [format "%18s - %s" [lindex $a 0] [lindex $a 1]]
+ }
+ }
+}
+
+add_help_text tcl_help "Tcl implementation of help command"
+
+
# If a fn is unknown to Tcl, we try to execute it as an OpenOCD command
proc unknown {args} {
if {[string length $args]>0} {