QuiCM/Headquarters

Format triggers are finnicky when combined with regular parsing

Closed this issue · 1 comments

QuiCM commented

Given the trigger run command {command}
and the executor

Execute(IContextObject context, string command, string[] parameters)
{
}

an input string of "run command test param1 param2" would fail, as param1 and param2 would be included in the {command} regex.

A trigger of run command {command} with params and the same input string and executor functions correctly.

QuiCM commented

With the nature of regexing (format params use (?<parameterName>.+)), I'm going to call this tentatively closed by bf2f50c.
A CommandParameter attribute should be used to restrict a format parameter if this use case arises:

Execute(IContextObject context, [CommandParameter(repetitions: n)] string command, string[] parameters){}

Where n is an integer