Allow autocomplete for partial executables

This commit is contained in:
nickofolas 2022-01-10 16:32:50 -06:00
parent f742782e4a
commit 8c001bd1ae

@ -183,7 +183,7 @@ export async function determineAllPossibilitiesForTabCompletion(
* has input ./partialexecutablename so autocomplete the script or program. * has input ./partialexecutablename so autocomplete the script or program.
* Put './' in front of each script/executable * Put './' in front of each script/executable
*/ */
if (isCommand("./") && index == -1) { if (input.startsWith("./") && index == -1) {
//All programs and scripts //All programs and scripts
for (let i = 0; i < currServ.scripts.length; ++i) { for (let i = 0; i < currServ.scripts.length; ++i) {
allPos.push("./" + currServ.scripts[i].filename); allPos.push("./" + currServ.scripts[i].filename);
@ -286,7 +286,8 @@ export async function determineAllPossibilitiesForTabCompletion(
} }
async function scriptAutocomplete(): Promise<string[] | undefined> { async function scriptAutocomplete(): Promise<string[] | undefined> {
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); const commands = ParseCommands(input);
if (commands.length === 0) return; if (commands.length === 0) return;
const command = ParseCommand(commands[commands.length - 1]); const command = ParseCommand(commands[commands.length - 1]);