1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0032685: Draw Harness - help output smashes command names without delimiter

"help" procedure now ensures to put space between listed commands.
This commit is contained in:
kgv 2021-11-25 00:05:19 +03:00 committed by smoskvin
parent b6b55c3d96
commit 4e69a6ac05

View File

@ -30,51 +30,56 @@ set tcl_prompt2 {puts -nonewline "> "}
################################################# #################################################
# the help command in TCL # the help command in TCL
################################################# #################################################
proc help {{command ""} {helpstring ""} {group "Procedures"}} { proc help {{theCommand ""} {theHelpString ""} {theGroup "Procedures"}} {
global Draw_Helps Draw_Groups global Draw_Helps Draw_Groups
if {$command == ""} { if {$theCommand == ""} {
# help general # help general
foreach h [lsort [array names Draw_Groups]] { set aCmdWidth 15
dputs -intense "\n\n$h" foreach aGrpIter [lsort [array names Draw_Groups]] {
set i 0 dputs -intense "\n\n$aGrpIter"
foreach f [lsort $Draw_Groups($h)] { set i 1
if {$i == 0} { set aLine ""
puts "" foreach aCmdIter [lsort $Draw_Groups($aGrpIter)] {
puts -nonewline " " if {$i == 1} {
puts -nonewline "$aLine\n"
set aLine " "
} }
puts -nonewline $f
for {set j [string length $f]} {$j < 15} {incr j} { append aLine $aCmdIter
puts -nonewline " " set aLineLen [string length $aLine]
for {set j [expr $aLineLen + 1]} {$j < [expr $aCmdWidth * $i + 2]} {incr j} {
append aLine " "
} }
append aLine " "
incr i incr i
if {$i == 4} {set i 0} if {$i == 5} {set i 1}
} }
puts "" puts "$aLine"
} }
} elseif {$helpstring == ""} { } elseif {$theHelpString == ""} {
# help function # help function
set isfound 0 set isFound 0
foreach f [lsort [array names Draw_Helps]] { foreach f [lsort [array names Draw_Helps]] {
if {[string match $command $f]} { if {[string match $theCommand $f]} {
dputs -nonewline -intense $f dputs -nonewline -intense $f
for {set j [string length $f]} {$j < 15} {incr j} { for {set j [string length $f]} {$j < 15} {incr j} {
puts -nonewline " " puts -nonewline " "
} }
puts " : $Draw_Helps($f)" puts " : $Draw_Helps($f)"
set isfound 1 set isFound 1
} }
} }
if {!$isfound} { if {!$isFound} {
if {[string first * $command] != -1} { if {[string first * $theCommand] != -1} {
puts "No matching commands found!" puts "No matching commands found!"
} else { } else {
puts "No help found for '$command'! Please try 'help $command*' to find matching commands." puts "No help found for '$theCommand'! Please try 'help $theCommand*' to find matching commands."
} }
} }
} else { } else {
# set help # set help
lappend Draw_Groups($group) $command lappend Draw_Groups($theGroup) $theCommand
set Draw_Helps($command) $helpstring set Draw_Helps($theCommand) $theHelpString
} }
flush stdout flush stdout
} }