From 13b08d7cc819c6d41bba9b07a3c92ad6d6e82d86 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 3 Dec 2021 14:44:32 -0500 Subject: [PATCH] terminal parses boolean exactly. --- src/Script/ScriptHelpers.ts | 2 +- src/Terminal/Parser.ts | 6 +++++- src/Terminal/Terminal.ts | 4 ++-- src/Terminal/commands/alias.ts | 2 +- src/Terminal/commands/analyze.ts | 2 +- src/Terminal/commands/backdoor.ts | 2 +- src/Terminal/commands/buy.ts | 2 +- src/Terminal/commands/cat.ts | 2 +- src/Terminal/commands/cd.ts | 2 +- src/Terminal/commands/check.ts | 2 +- src/Terminal/commands/connect.ts | 2 +- src/Terminal/commands/cp.ts | 2 +- src/Terminal/commands/download.ts | 17 +++++++++++------ src/Terminal/commands/expr.ts | 2 +- src/Terminal/commands/free.ts | 2 +- src/Terminal/commands/grow.ts | 2 +- src/Terminal/commands/hack.ts | 2 +- src/Terminal/commands/help.ts | 4 ++-- src/Terminal/commands/home.ts | 2 +- src/Terminal/commands/hostname.ts | 2 +- src/Terminal/commands/kill.ts | 5 ++++- src/Terminal/commands/ls.tsx | 2 +- src/Terminal/commands/mem.ts | 2 +- src/Terminal/commands/mv.ts | 2 +- src/Terminal/commands/nano.ts | 2 +- src/Terminal/commands/ps.ts | 2 +- src/Terminal/commands/rm.ts | 2 +- src/Terminal/commands/run.ts | 2 +- src/Terminal/commands/runProgram.ts | 2 +- src/Terminal/commands/runScript.ts | 2 +- src/Terminal/commands/scan.ts | 2 +- src/Terminal/commands/scananalyze.ts | 2 +- src/Terminal/commands/scp.ts | 2 +- src/Terminal/commands/sudov.ts | 2 +- src/Terminal/commands/tail.ts | 4 ++-- src/Terminal/commands/top.ts | 2 +- src/Terminal/commands/unalias.ts | 2 +- src/Terminal/commands/weaken.ts | 2 +- src/Terminal/commands/wget.ts | 2 +- ...determineAllPossibilitiesForTabCompletion.ts | 16 ++++++++-------- 40 files changed, 67 insertions(+), 55 deletions(-) diff --git a/src/Script/ScriptHelpers.ts b/src/Script/ScriptHelpers.ts index 1c60d4954..360c19929 100644 --- a/src/Script/ScriptHelpers.ts +++ b/src/Script/ScriptHelpers.ts @@ -87,7 +87,7 @@ export function scriptCalculateOfflineProduction(runningScript: RunningScript): //designated server, and false otherwise export function findRunningScript( filename: string, - args: (string | number)[], + args: (string | number | boolean)[], server: BaseServer, ): RunningScript | null { for (let i = 0; i < server.runningScripts.length; ++i) { diff --git a/src/Terminal/Parser.ts b/src/Terminal/Parser.ts index 46157f1db..7e6bf280c 100644 --- a/src/Terminal/Parser.ts +++ b/src/Terminal/Parser.ts @@ -31,7 +31,7 @@ export function ParseCommands(commands: string): string[] { return out; } -export function ParseCommand(command: string): (string | number)[] { +export function ParseCommand(command: string): (string | number | boolean)[] { // This will be used to keep track of whether we're in a quote. This is for situations // like the alias command: // alias run="run NUKE.exe" @@ -101,6 +101,10 @@ export function ParseCommand(command: string): (string | number)[] { // If this is a number, convert it from a string to number if (isNumber(arg)) { args.push(parseFloat(arg)); + } else if (arg === "true") { + args.push(true); + } else if (arg === "false") { + args.push(false); } else { args.push(arg); } diff --git a/src/Terminal/Terminal.ts b/src/Terminal/Terminal.ts index 6bb328175..d140fd5b2 100644 --- a/src/Terminal/Terminal.ts +++ b/src/Terminal/Terminal.ts @@ -718,7 +718,7 @@ export class Terminal implements ITerminal { /****************** END INTERACTIVE TUTORIAL ******************/ /* Command parser */ const commandName = commandArray[0]; - if (typeof commandName === "number") { + if (typeof commandName === "number" || typeof commandName === "boolean") { this.error(`Command ${commandArray[0]} not found`); return; } @@ -729,7 +729,7 @@ export class Terminal implements ITerminal { router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ) => void; } = { "scan-analyze": scananalyze, diff --git a/src/Terminal/commands/alias.ts b/src/Terminal/commands/alias.ts index da06efaab..1e908baf8 100644 --- a/src/Terminal/commands/alias.ts +++ b/src/Terminal/commands/alias.ts @@ -9,7 +9,7 @@ export function alias( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length === 0) { printAliases(); diff --git a/src/Terminal/commands/analyze.ts b/src/Terminal/commands/analyze.ts index c45fdf866..cd8182353 100644 --- a/src/Terminal/commands/analyze.ts +++ b/src/Terminal/commands/analyze.ts @@ -8,7 +8,7 @@ export function analyze( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of analyze command. Usage: analyze"); diff --git a/src/Terminal/commands/backdoor.ts b/src/Terminal/commands/backdoor.ts index ce9ca785e..8f9e84a91 100644 --- a/src/Terminal/commands/backdoor.ts +++ b/src/Terminal/commands/backdoor.ts @@ -10,7 +10,7 @@ export function backdoor( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of backdoor command. Usage: backdoor"); diff --git a/src/Terminal/commands/buy.ts b/src/Terminal/commands/buy.ts index 61e41a686..8fda02b7e 100644 --- a/src/Terminal/commands/buy.ts +++ b/src/Terminal/commands/buy.ts @@ -11,7 +11,7 @@ export function buy( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (!GetServer(SpecialServers.DarkWeb)) { terminal.error( diff --git a/src/Terminal/commands/cat.ts b/src/Terminal/commands/cat.ts index 196843e96..a0234e44b 100644 --- a/src/Terminal/commands/cat.ts +++ b/src/Terminal/commands/cat.ts @@ -10,7 +10,7 @@ export function cat( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 1) { terminal.error("Incorrect usage of cat command. Usage: cat [file]"); diff --git a/src/Terminal/commands/cd.ts b/src/Terminal/commands/cd.ts index ab5576d7a..9603063df 100644 --- a/src/Terminal/commands/cd.ts +++ b/src/Terminal/commands/cd.ts @@ -10,7 +10,7 @@ export function cd( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length > 1) { terminal.error("Incorrect number of arguments. Usage: cd [dir]"); diff --git a/src/Terminal/commands/check.ts b/src/Terminal/commands/check.ts index c2b98c644..be734864a 100644 --- a/src/Terminal/commands/check.ts +++ b/src/Terminal/commands/check.ts @@ -10,7 +10,7 @@ export function check( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length < 1) { terminal.error("Incorrect number of arguments. Usage: check [script] [arg1] [arg2]..."); diff --git a/src/Terminal/commands/connect.ts b/src/Terminal/commands/connect.ts index 9684a125d..6d075dac0 100644 --- a/src/Terminal/commands/connect.ts +++ b/src/Terminal/commands/connect.ts @@ -9,7 +9,7 @@ export function connect( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { // Disconnect from current server in terminal and connect to new one if (args.length !== 1) { diff --git a/src/Terminal/commands/cp.ts b/src/Terminal/commands/cp.ts index e59244079..bd637763e 100644 --- a/src/Terminal/commands/cp.ts +++ b/src/Terminal/commands/cp.ts @@ -9,7 +9,7 @@ export function cp( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { try { if (args.length !== 2) { diff --git a/src/Terminal/commands/download.ts b/src/Terminal/commands/download.ts index cd40319ab..83729eef8 100644 --- a/src/Terminal/commands/download.ts +++ b/src/Terminal/commands/download.ts @@ -11,7 +11,7 @@ export function download( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { try { if (args.length !== 1) { @@ -24,7 +24,7 @@ export function download( const matchEnding = fn.length == 1 || fn === "*.*" ? null : fn.slice(1); // Treat *.* the same as * const zip = new JSZip(); // Helper function to zip any file contents whose name matches the pattern - let zipFiles = (fileNames: string[], fileContents: string[]) => { + const zipFiles = (fileNames: string[], fileContents: string[]) => { for (let i = 0; i < fileContents.length; ++i) { let name = fileNames[i]; if (name.startsWith("/")) name = name.slice(1); @@ -34,13 +34,18 @@ export function download( }; // In the case of script files, we pull from the server.scripts array if (!matchEnding || isScriptFilename(matchEnding)) - zipFiles(server.scripts.map(s => s.filename), server.scripts.map(s => s.code)); + zipFiles( + server.scripts.map((s) => s.filename), + server.scripts.map((s) => s.code), + ); // In the case of text files, we pull from the server.scripts array if (!matchEnding || matchEnding.endsWith(".txt")) - zipFiles(server.textFiles.map(s => s.fn), server.textFiles.map(s => s.text)); + zipFiles( + server.textFiles.map((s) => s.fn), + server.textFiles.map((s) => s.text), + ); // Return an error if no files matched, rather than an empty zip folder - if (Object.keys(zip.files).length == 0) - return terminal.error(`No files match the pattern ${fn}`); + if (Object.keys(zip.files).length == 0) return terminal.error(`No files match the pattern ${fn}`); const zipFn = `bitburner${isScriptFilename(fn) ? "Scripts" : fn === "*.txt" ? "Texts" : "Files"}.zip`; zip.generateAsync({ type: "blob" }).then((content: any) => FileSaver.saveAs(content, zipFn)); return; diff --git a/src/Terminal/commands/expr.ts b/src/Terminal/commands/expr.ts index 060971e29..d92725fd5 100644 --- a/src/Terminal/commands/expr.ts +++ b/src/Terminal/commands/expr.ts @@ -8,7 +8,7 @@ export function expr( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length === 0) { terminal.error("Incorrect usage of expr command. Usage: expr [math expression]"); diff --git a/src/Terminal/commands/free.ts b/src/Terminal/commands/free.ts index 68a668efc..d86917003 100644 --- a/src/Terminal/commands/free.ts +++ b/src/Terminal/commands/free.ts @@ -9,7 +9,7 @@ export function free( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of free command. Usage: free"); diff --git a/src/Terminal/commands/grow.ts b/src/Terminal/commands/grow.ts index 39797fc60..87e6b9f83 100644 --- a/src/Terminal/commands/grow.ts +++ b/src/Terminal/commands/grow.ts @@ -9,7 +9,7 @@ export function grow( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of grow command. Usage: grow"); diff --git a/src/Terminal/commands/hack.ts b/src/Terminal/commands/hack.ts index 32e886b3a..7b6030d26 100644 --- a/src/Terminal/commands/hack.ts +++ b/src/Terminal/commands/hack.ts @@ -9,7 +9,7 @@ export function hack( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of hack command. Usage: hack"); diff --git a/src/Terminal/commands/help.ts b/src/Terminal/commands/help.ts index af818ee38..23de8028f 100644 --- a/src/Terminal/commands/help.ts +++ b/src/Terminal/commands/help.ts @@ -9,7 +9,7 @@ export function help( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0 && args.length !== 1) { terminal.error("Incorrect usage of help command. Usage: help"); @@ -18,7 +18,7 @@ export function help( if (args.length === 0) { TerminalHelpText.forEach((line) => terminal.print(line)); } else { - const cmd = args[0]; + const cmd = args[0] + ""; const txt = HelpTexts[cmd]; if (txt == null) { terminal.error("No help topics match '" + cmd + "'"); diff --git a/src/Terminal/commands/home.ts b/src/Terminal/commands/home.ts index 86c016b36..b20fdebd0 100644 --- a/src/Terminal/commands/home.ts +++ b/src/Terminal/commands/home.ts @@ -8,7 +8,7 @@ export function home( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of home command. Usage: home"); diff --git a/src/Terminal/commands/hostname.ts b/src/Terminal/commands/hostname.ts index 13340e9a7..7c061d93f 100644 --- a/src/Terminal/commands/hostname.ts +++ b/src/Terminal/commands/hostname.ts @@ -8,7 +8,7 @@ export function hostname( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of hostname command. Usage: hostname"); diff --git a/src/Terminal/commands/kill.ts b/src/Terminal/commands/kill.ts index 9c8a70f90..b2eca0431 100644 --- a/src/Terminal/commands/kill.ts +++ b/src/Terminal/commands/kill.ts @@ -9,13 +9,16 @@ export function kill( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { try { if (args.length < 1) { terminal.error("Incorrect usage of kill command. Usage: kill [scriptname] [arg1] [arg2]..."); return; } + if (typeof args[0] === "boolean") { + return; + } // Kill by PID if (typeof args[0] === "number") { diff --git a/src/Terminal/commands/ls.tsx b/src/Terminal/commands/ls.tsx index 09a9c2b5d..f964a86a6 100644 --- a/src/Terminal/commands/ls.tsx +++ b/src/Terminal/commands/ls.tsx @@ -10,7 +10,7 @@ export function ls( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { const numArgs = args.length; function incorrectUsage(): void { diff --git a/src/Terminal/commands/mem.ts b/src/Terminal/commands/mem.ts index a08b11c75..799af2181 100644 --- a/src/Terminal/commands/mem.ts +++ b/src/Terminal/commands/mem.ts @@ -9,7 +9,7 @@ export function mem( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { try { if (args.length !== 1 && args.length !== 3) { diff --git a/src/Terminal/commands/mv.ts b/src/Terminal/commands/mv.ts index 98d07f754..0ed723987 100644 --- a/src/Terminal/commands/mv.ts +++ b/src/Terminal/commands/mv.ts @@ -11,7 +11,7 @@ export function mv( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 2) { terminal.error(`Incorrect number of arguments. Usage: mv [src] [dest]`); diff --git a/src/Terminal/commands/nano.ts b/src/Terminal/commands/nano.ts index 85665424b..18ad8a6eb 100644 --- a/src/Terminal/commands/nano.ts +++ b/src/Terminal/commands/nano.ts @@ -10,7 +10,7 @@ export function nano( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 1) { terminal.error("Incorrect usage of nano command. Usage: nano [scriptname]"); diff --git a/src/Terminal/commands/ps.ts b/src/Terminal/commands/ps.ts index c18254bbb..e62f3fe3a 100644 --- a/src/Terminal/commands/ps.ts +++ b/src/Terminal/commands/ps.ts @@ -8,7 +8,7 @@ export function ps( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of ps command. Usage: ps"); diff --git a/src/Terminal/commands/rm.ts b/src/Terminal/commands/rm.ts index 0e91bc496..dc4b5e126 100644 --- a/src/Terminal/commands/rm.ts +++ b/src/Terminal/commands/rm.ts @@ -9,7 +9,7 @@ export function rm( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 1) { terminal.error("Incorrect number of arguments. Usage: rm [program/script]"); diff --git a/src/Terminal/commands/run.ts b/src/Terminal/commands/run.ts index 99fdf0155..594170cf6 100644 --- a/src/Terminal/commands/run.ts +++ b/src/Terminal/commands/run.ts @@ -11,7 +11,7 @@ export function run( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { // Run a program or a script if (args.length < 1) { diff --git a/src/Terminal/commands/runProgram.ts b/src/Terminal/commands/runProgram.ts index 3c95f5d90..6ed8c70a3 100644 --- a/src/Terminal/commands/runProgram.ts +++ b/src/Terminal/commands/runProgram.ts @@ -9,7 +9,7 @@ export function runProgram( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length < 1) { return; diff --git a/src/Terminal/commands/runScript.ts b/src/Terminal/commands/runScript.ts index 95056c82a..5d83a01b8 100644 --- a/src/Terminal/commands/runScript.ts +++ b/src/Terminal/commands/runScript.ts @@ -14,7 +14,7 @@ export function runScript( router: IRouter, player: IPlayer, server: BaseServer, - commandArgs: (string | number)[], + commandArgs: (string | number | boolean)[], ): void { if (commandArgs.length < 1) { terminal.error( diff --git a/src/Terminal/commands/scan.ts b/src/Terminal/commands/scan.ts index d14d0dbdc..ed1f781fe 100644 --- a/src/Terminal/commands/scan.ts +++ b/src/Terminal/commands/scan.ts @@ -9,7 +9,7 @@ export function scan( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of netstat/scan command. Usage: netstat/scan"); diff --git a/src/Terminal/commands/scananalyze.ts b/src/Terminal/commands/scananalyze.ts index 3f997a4ea..f30c6dc9f 100644 --- a/src/Terminal/commands/scananalyze.ts +++ b/src/Terminal/commands/scananalyze.ts @@ -9,7 +9,7 @@ export function scananalyze( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length === 0) { terminal.executeScanAnalyzeCommand(player, 1); diff --git a/src/Terminal/commands/scp.ts b/src/Terminal/commands/scp.ts index b7ee4fd25..4855bc152 100644 --- a/src/Terminal/commands/scp.ts +++ b/src/Terminal/commands/scp.ts @@ -10,7 +10,7 @@ export function scp( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { try { if (args.length !== 2) { diff --git a/src/Terminal/commands/sudov.ts b/src/Terminal/commands/sudov.ts index 4457d1da0..d5cfc3394 100644 --- a/src/Terminal/commands/sudov.ts +++ b/src/Terminal/commands/sudov.ts @@ -8,7 +8,7 @@ export function sudov( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect number of arguments. Usage: sudov"); diff --git a/src/Terminal/commands/tail.ts b/src/Terminal/commands/tail.ts index 0f959a64b..1773d472f 100644 --- a/src/Terminal/commands/tail.ts +++ b/src/Terminal/commands/tail.ts @@ -12,7 +12,7 @@ export function tail( router: IRouter, player: IPlayer, server: BaseServer, - commandArray: (string | number)[], + commandArray: (string | number | boolean)[], ): void { try { if (commandArray.length < 1) { @@ -67,7 +67,7 @@ export function tail( // if there's no candidate then we just don't know. terminal.error("No such script exists."); - } else { + } else if (typeof commandArray[0] === "number") { const runningScript = findRunningScriptByPid(commandArray[0], server); if (runningScript == null) { terminal.error("No such script exists"); diff --git a/src/Terminal/commands/top.ts b/src/Terminal/commands/top.ts index e3cf72f97..283951f44 100644 --- a/src/Terminal/commands/top.ts +++ b/src/Terminal/commands/top.ts @@ -10,7 +10,7 @@ export function top( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of top command. Usage: top"); diff --git a/src/Terminal/commands/unalias.ts b/src/Terminal/commands/unalias.ts index 10c274bfb..216b55fb1 100644 --- a/src/Terminal/commands/unalias.ts +++ b/src/Terminal/commands/unalias.ts @@ -9,7 +9,7 @@ export function unalias( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 1) { terminal.error("Incorrect usage of unalias name. Usage: unalias [alias]"); diff --git a/src/Terminal/commands/weaken.ts b/src/Terminal/commands/weaken.ts index 41d738152..f060174d9 100644 --- a/src/Terminal/commands/weaken.ts +++ b/src/Terminal/commands/weaken.ts @@ -9,7 +9,7 @@ export function weaken( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 0) { terminal.error("Incorrect usage of weaken command. Usage: weaken"); diff --git a/src/Terminal/commands/wget.ts b/src/Terminal/commands/wget.ts index 9119d01a7..46502e2ca 100644 --- a/src/Terminal/commands/wget.ts +++ b/src/Terminal/commands/wget.ts @@ -9,7 +9,7 @@ export function wget( router: IRouter, player: IPlayer, server: BaseServer, - args: (string | number)[], + args: (string | number | boolean)[], ): void { if (args.length !== 2) { terminal.error("Incorrect usage of wget command. Usage: wget [url] [target file]"); diff --git a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts index ce1edfa9b..53847ac98 100644 --- a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts +++ b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts @@ -265,13 +265,6 @@ export async function determineAllPossibilitiesForTabCompletion( return allPos; } - if (isCommand("kill") || isCommand("tail") || isCommand("mem") || isCommand("check")) { - addAllScripts(); - addAllDirectories(); - - return allPos; - } - if (isCommand("nano")) { addAllScripts(); addAllTextFiles(); @@ -292,7 +285,7 @@ export async function determineAllPossibilitiesForTabCompletion( } async function scriptAutocomplete(): Promise { - if (!isCommand("run")) return; + if (!isCommand("run") && !isCommand("tail") && !isCommand("kill")) return; const commands = ParseCommands(input); if (commands.length === 0) return; const command = ParseCommand(commands[commands.length - 1]); @@ -348,6 +341,13 @@ export async function determineAllPossibilitiesForTabCompletion( addAllDirectories(); } + if (isCommand("kill") || isCommand("tail") || isCommand("mem") || isCommand("check")) { + addAllScripts(); + addAllDirectories(); + + return allPos; + } + if (isCommand("cat")) { addAllMessages(); addAllLitFiles();