BUGFIX: Tab completion uses wrong command list (#1537)

This commit is contained in:
catloversg
2024-08-04 13:52:29 +07:00
committed by GitHub
parent 829eda2e5a
commit 1ed47b4bc9
3 changed files with 55 additions and 92 deletions
+2 -45
View File
@@ -11,50 +11,7 @@ import libarg from "arg";
import { getAllDirectories, resolveDirectory, root } from "../Paths/Directory";
import { isLegacyScript, resolveScriptFilePath } from "../Paths/ScriptFilePath";
import { enums } from "../NetscriptFunctions";
// TODO: this shouldn't be hardcoded in two places with no typechecks to verify equivalence
// An array of all Terminal commands
const gameCommands = [
"alias",
"analyze",
"backdoor",
"cat",
"cd",
"changelog",
"check",
"clear",
"cls",
"connect",
"cp",
"download",
"expr",
"free",
"grow",
"hack",
"help",
"home",
"hostname",
"ifconfig",
"kill",
"killall",
"ls",
"lscpu",
"mem",
"mv",
"nano",
"ps",
"rm",
"run",
"scan-analyze",
"scan",
"scp",
"sudov",
"tail",
"theme",
"top",
"vim",
"weaken",
];
import { TerminalCommands } from "./Terminal";
/** Suggest all completion possibilities for the last argument in the last command being typed
* @param terminalText The current full text entered in the terminal
@@ -123,7 +80,7 @@ export async function getTabCompletionPossibilities(terminalText: string, baseDi
const addAliases = () => addGeneric({ iterable: Aliases.keys() });
const addGlobalAliases = () => addGeneric({ iterable: GlobalAliases.keys() });
const addCommands = () => addGeneric({ iterable: gameCommands });
const addCommands = () => addGeneric({ iterable: Object.keys(TerminalCommands) });
const addDarkwebItems = () => addGeneric({ iterable: Object.values(DarkWebItems).map((item) => item.program) });
const addServerNames = () =>
addGeneric({