From 8c001bd1aec044cb0fa66a840dcdb941fc638be3 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Mon, 10 Jan 2022 16:32:50 -0600 Subject: [PATCH 1/2] Allow autocomplete for partial executables --- src/Terminal/determineAllPossibilitiesForTabCompletion.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts index e765f1757..f50960b26 100644 --- a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts +++ b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts @@ -183,7 +183,7 @@ export async function determineAllPossibilitiesForTabCompletion( * has input ./partialexecutablename so autocomplete the script or program. * Put './' in front of each script/executable */ - if (isCommand("./") && index == -1) { + if (input.startsWith("./") && index == -1) { //All programs and scripts for (let i = 0; i < currServ.scripts.length; ++i) { allPos.push("./" + currServ.scripts[i].filename); @@ -286,7 +286,8 @@ export async function determineAllPossibilitiesForTabCompletion( } async function scriptAutocomplete(): Promise { - if (!isCommand("run") && !isCommand("tail") && !isCommand("kill")) return; + if (!isCommand("run") && !isCommand("tail") && !isCommand("kill") && !input.startsWith("./")) return; + if (input.startsWith("./")) input = "run " + input.slice(2); const commands = ParseCommands(input); if (commands.length === 0) return; const command = ParseCommand(commands[commands.length - 1]); From 5cd7e2cfbc10d5af29c5d38657a2de537a57288c Mon Sep 17 00:00:00 2001 From: nickofolas Date: Mon, 10 Jan 2022 16:39:06 -0600 Subject: [PATCH 2/2] Add support for contract completion --- src/Terminal/determineAllPossibilitiesForTabCompletion.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts index f50960b26..b1fba5eaf 100644 --- a/src/Terminal/determineAllPossibilitiesForTabCompletion.ts +++ b/src/Terminal/determineAllPossibilitiesForTabCompletion.ts @@ -193,6 +193,11 @@ export async function determineAllPossibilitiesForTabCompletion( for (let i = 0; i < homeComputer.programs.length; ++i) { allPos.push("./" + homeComputer.programs[i]); } + + //Contracts on current server + for (let i = 0; i < currServ.contracts.length; ++i) { + allPos.push("./" + currServ.contracts[i].fn) + } return allPos; }