1
0
Fork 0

Prefix commands with $ to format the command itself

This commit is contained in:
Duncan Ogilvie 2025-06-25 16:56:28 +02:00
parent b1a14260f9
commit 8fe261cb82
1 changed files with 12 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include "expressionparser.h" #include "expressionparser.h"
#include "variable.h" #include "variable.h"
#include "cmd-undocumented.h" #include "cmd-undocumented.h"
#include "stringformat.h"
COMMAND* cmd_list = 0; COMMAND* cmd_list = 0;
@ -207,6 +208,17 @@ bool cbCommandProvider(char* cmd, int maxlen);
void cmdsplit(const char* cmd, StringList & commands) void cmdsplit(const char* cmd, StringList & commands)
{ {
// Allow prefixing commands with $ to format them
String cmdFormatted;
if(*cmd == '$')
{
cmd++;
while(*cmd == ' ')
cmd++;
cmdFormatted = stringformatinline(cmd);
cmd = cmdFormatted.c_str();
}
commands.clear(); commands.clear();
auto len = strlen(cmd); auto len = strlen(cmd);
auto inquote = false; auto inquote = false;