changeset 599:76d19fa28753

utillib: Add command matching helper function.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Feb 2021 12:15:54 +0200
parents 40db54427950
children 90da5691cc81
files utillib.tcl
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
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
 ###