Mercurial > hg > egg-tcls
diff utillib.tcl @ 599:76d19fa28753
utillib: Add command matching helper function.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 04 Feb 2021 12:15:54 +0200 |
parents | 1ace0cbde1dd |
children | 543f1d72361e |
line wrap: on
line diff
--- a/utillib.tcl Wed Feb 03 13:37:10 2021 +0200 +++ b/utillib.tcl Thu Feb 04 12:15:54 2021 +0200 @@ -128,6 +128,17 @@ } +proc utl_cmd_match { ucommands uid ustr } { + upvar $ucommands ucmds + + if {[info exists ucmds($uid)] && [regexp -nocase -- $ucmds($uid) $ustr]} { + return 1 + } else { + return 0 + } +} + + ### ### SQL database handling ###