mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 02:03:58 +01:00
Terminal: There is now an interface definition for the autocomplete() 'data' argument.
This commit is contained in:
parent
9ddb1c4379
commit
f0557eadf7
11
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
11
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -6779,3 +6779,14 @@ interface GameInfo {
|
|||||||
commit: string;
|
commit: string;
|
||||||
platform: string;
|
platform: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for autocompletion
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
interface AutocompleteData {
|
||||||
|
servers: string[];
|
||||||
|
scripts: string[];
|
||||||
|
txts: string[];
|
||||||
|
flags(schema: [string, string | number | boolean | string[]][]): any;
|
||||||
|
}
|
||||||
|
@ -10,6 +10,7 @@ import { HelpTexts } from "./HelpText";
|
|||||||
import { isScriptFilename } from "../Script/isScriptFilename";
|
import { isScriptFilename } from "../Script/isScriptFilename";
|
||||||
import { compile } from "../NetscriptJSEvaluator";
|
import { compile } from "../NetscriptJSEvaluator";
|
||||||
import { Flags } from "../NetscriptFunctions/Flags";
|
import { Flags } from "../NetscriptFunctions/Flags";
|
||||||
|
import { AutocompleteData } from "../ScriptEditor/NetscriptDefinitions";
|
||||||
import * as libarg from "arg";
|
import * as libarg from "arg";
|
||||||
|
|
||||||
// An array of all Terminal commands
|
// An array of all Terminal commands
|
||||||
@ -298,11 +299,7 @@ export async function determineAllPossibilitiesForTabCompletion(
|
|||||||
argv: command.slice(2),
|
argv: command.slice(2),
|
||||||
});
|
});
|
||||||
const flagFunc = Flags(flags._);
|
const flagFunc = Flags(flags._);
|
||||||
let pos: string[] = [];
|
const autocompleteData: AutocompleteData = {
|
||||||
let pos2: string[] = [];
|
|
||||||
pos = pos.concat(
|
|
||||||
loadedModule.autocomplete(
|
|
||||||
{
|
|
||||||
servers: GetAllServers().map((server) => server.hostname),
|
servers: GetAllServers().map((server) => server.hostname),
|
||||||
scripts: currServ.scripts.map((script) => script.filename),
|
scripts: currServ.scripts.map((script) => script.filename),
|
||||||
txts: currServ.textFiles.map((txt) => txt.fn),
|
txts: currServ.textFiles.map((txt) => txt.fn),
|
||||||
@ -317,7 +314,12 @@ export async function determineAllPossibilitiesForTabCompletion(
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
|
let pos: string[] = [];
|
||||||
|
let pos2: string[] = [];
|
||||||
|
pos = pos.concat(
|
||||||
|
loadedModule.autocomplete(
|
||||||
|
autocompleteData,
|
||||||
flags._,
|
flags._,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user