mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-25 02:32:55 +02:00
Mixing spaces and tabs, extra semicolons and lonely ifs are now forbidden
This commit is contained in:
@@ -68,13 +68,11 @@ export function ParseCommand(command: string): (string | number | boolean)[] {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (inQuote === ``) {
|
||||
} else if (inQuote === ``) {
|
||||
inQuote = `"`;
|
||||
} else if (inQuote === `"`) {
|
||||
inQuote = ``;
|
||||
}
|
||||
}
|
||||
} else if (c === "'") {
|
||||
// Single quotes, same thing as above
|
||||
if (!escaped && prevChar === " ") {
|
||||
@@ -88,13 +86,11 @@ export function ParseCommand(command: string): (string | number | boolean)[] {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (inQuote === ``) {
|
||||
} else if (inQuote === ``) {
|
||||
inQuote = `'`;
|
||||
} else if (inQuote === `'`) {
|
||||
inQuote = ``;
|
||||
}
|
||||
}
|
||||
} else if (c === " " && inQuote === ``) {
|
||||
const arg = command.substr(start, i - start);
|
||||
|
||||
|
||||
@@ -179,13 +179,11 @@ export function ls(
|
||||
i--;
|
||||
if (!style) {
|
||||
terminal.print(row);
|
||||
} else {
|
||||
if (linked) {
|
||||
} else if (linked) {
|
||||
terminal.printRaw(<ClickableScriptRow row={row} prefix={prefix} hostname={server.hostname} />);
|
||||
} else {
|
||||
terminal.printRaw(<span style={style}>{row}</span>);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,11 +14,9 @@ export function unalias(
|
||||
if (args.length !== 1) {
|
||||
terminal.error("Incorrect usage of unalias name. Usage: unalias [alias]");
|
||||
return;
|
||||
} else {
|
||||
if (removeAlias(args[0] + "")) {
|
||||
} else if (removeAlias(args[0] + "")) {
|
||||
terminal.print(`Removed alias ${args[0]}`);
|
||||
} else {
|
||||
terminal.error(`No such alias exists: ${args[0]}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,28 +66,22 @@ export function tabCompletion(
|
||||
if (arg === "") {
|
||||
if (longestStartSubstr === command) {
|
||||
return allPossibilities;
|
||||
} else {
|
||||
if (semiColonIndex === -1) {
|
||||
} else if (semiColonIndex === -1) {
|
||||
// No semicolon, so replace the whole command
|
||||
return longestStartSubstr;
|
||||
} else {
|
||||
// Replace only after the last semicolon
|
||||
return `${oldValue.slice(0, semiColonIndex + 1)} ${longestStartSubstr}`;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (longestStartSubstr === arg) {
|
||||
} else if (longestStartSubstr === arg) {
|
||||
// List all possible options
|
||||
return allPossibilities;
|
||||
} else {
|
||||
if (semiColonIndex == -1) {
|
||||
} else if (semiColonIndex == -1) {
|
||||
// No semicolon, so replace the whole command
|
||||
return `${command} ${longestStartSubstr}`;
|
||||
} else {
|
||||
// Replace only after the last semicolon
|
||||
return `${oldValue.slice(0, semiColonIndex + 1)} ${command} ${longestStartSubstr}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user