diff --git a/pkg/protocol/RegexMatcher.go b/pkg/protocol/RegexMatcher.go index 0e2774c..ed444cf 100644 --- a/pkg/protocol/RegexMatcher.go +++ b/pkg/protocol/RegexMatcher.go @@ -21,3 +21,14 @@ type RegexMatcher struct { func (m RegexMatcher) Match(data string) bool { return m.matcher.MatchString(data) } + +// Build Permet de construire une chaine respectant une commande. Retourne la chaine et bool (TRUE si correct et FALSE si incorrect) +func (m RegexMatcher) Build(cmd string, datas ...string) (string, bool) { + str := cmd + + for _, data := range datas { + str += " " + data + } + + return str, m.Match(str) +}