work in progress to improve help
git-svn-id: svn://svn.berlios.de/openocd/trunk@792 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
@@ -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} {
|
||||
|
||||
Reference in New Issue
Block a user