mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 15:12:27 +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 */
|
/** Split commands string while also applying aliases */
|
||||||
export function parseCommands(commands: string): string[] {
|
export function parseCommands(commands: string): string[] {
|
||||||
// Remove any unquoted whitespace longer than length 1
|
// 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.
|
// Split the commands, apply aliases once, then split again and filter out empty strings.
|
||||||
const commandsArr = splitCommands(commands).map(substituteAliases).flatMap(splitCommands).filter(Boolean);
|
const commandsArr = splitCommands(commands).map(substituteAliases).flatMap(splitCommands).filter(Boolean);
|
||||||
return commandsArr;
|
return commandsArr;
|
||||||
|
Loading…
Reference in New Issue
Block a user