diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-03-10 22:04:24 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-03-10 22:13:15 +0530 |
| commit | 971854bfefad4c644ac3d5f5d6003f24d551bf1d (patch) | |
| tree | 0f5ee90fd5968d345b157d38964094837315edf0 /src/CommandParser.cpp | |
| parent | d400369084107104f51fe217d5781c8d7bd07ff9 (diff) | |
| download | null-browser-971854bfefad4c644ac3d5f5d6003f24d551bf1d.tar.gz null-browser-971854bfefad4c644ac3d5f5d6003f24d551bf1d.zip | |
Add completer + simplify command parsing + class generator
Diffstat (limited to 'src/CommandParser.cpp')
| -rw-r--r-- | src/CommandParser.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/CommandParser.cpp b/src/CommandParser.cpp index ccb84bc..7a8eb00 100644 --- a/src/CommandParser.cpp +++ b/src/CommandParser.cpp @@ -9,11 +9,15 @@ Cmd CommandParser::parse(QString input) { auto parts = input.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts); if (parts.isEmpty()) - return Cmd(); + return {.command = Noop, .argsString = "", .rawInput = input}; + + auto cmdStr = parts.first(); + auto cmd = toCommandType(cmdStr); + auto rawArgs = input.slice(cmdStr.length()); - auto cmd = toCommandType(parts.first()); parts.removeFirst(); - return Cmd(cmd, parts); + + return {.command = cmd, .argsString = rawArgs, .rawInput = input}; } CommandType CommandParser::toCommandType(QString cmd) { |
