mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 13:43:49 +01:00
Fix quoted section detection
This commit is contained in:
parent
3106c03b5b
commit
c4776753f1
@ -22,7 +22,7 @@ export function splitCommands(commandString: string): string[] {
|
||||
/** Split commands string while also applying aliases */
|
||||
export function parseCommands(commands: string): string[] {
|
||||
// Remove any unquoted whitespace longer than length 1
|
||||
commands = commands.replace(/(?:"[^"]+"|'[^']+'|\s{2,})+?/g, (match) => (match.startsWith(" ") ? " " : match));
|
||||
commands = commands.replace(/(?:"[^"]*"|'[^']*'|\s{2,})+?/g, (match) => (match.startsWith(" ") ? " " : match));
|
||||
// Split the commands, apply aliases once, then split again and filter out empty strings.
|
||||
const commandsArr = splitCommands(commands).map(substituteAliases).flatMap(splitCommands).filter(Boolean);
|
||||
return commandsArr;
|
||||
|
Loading…
Reference in New Issue
Block a user