mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-23 08:03:48 +01:00
Merge pull request #2544 from nickofolas/autocomplete-partial-executable
Autocomplete partial executables
This commit is contained in:
commit
9da46668c7
@ -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);
|
||||||
@ -193,6 +193,11 @@ export async function determineAllPossibilitiesForTabCompletion(
|
|||||||
for (let i = 0; i < homeComputer.programs.length; ++i) {
|
for (let i = 0; i < homeComputer.programs.length; ++i) {
|
||||||
allPos.push("./" + homeComputer.programs[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;
|
return allPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +291,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]);
|
||||||
|
Loading…
Reference in New Issue
Block a user