| Description: |
I have tkchat run most of the time and sometimes I just
want to test 1 liners like regexp/lsearch switches/
string is ... and so on. I then tend to run tkcon, but
I guess it would be easier to just check in tkchat.
A simple implementation is as follows (could be
expanded to distinct break/continue/return/error):
proc ::tkchat::checkCommand { msg } {
switch -re -- $msg {
(...)
{^/eval\s} {
set evalCode [catch [string range $msg 6 end]
evalResult]
switch -- $evalCode {
0 {
if {![string equal $evalResult ""]} {
tkchat::addMessage .txt "" ""
"Result:\t$evalResult" ACTION end [clock seconds]
}
}
default {
tkchat::addMessage .txt "" "" "Error
($evalCode):\t$evalResult" ACTION end [clock seconds]
}
}
}
|