mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-10-23 10:13:13 +02:00
21 lines
615 B
TypeScript
21 lines
615 B
TypeScript
import { Terminal } from "../../Terminal";
|
|
import { TerminalHelpText, HelpTexts } from "../HelpText";
|
|
|
|
export function help(args: (string | number | boolean)[]): void {
|
|
if (args.length !== 0 && args.length !== 1) {
|
|
Terminal.error("Incorrect usage of help command. Usage: help");
|
|
return;
|
|
}
|
|
if (args.length === 0) {
|
|
TerminalHelpText.forEach((line) => Terminal.print(line));
|
|
} else {
|
|
const cmd = args[0] + "";
|
|
const txt = HelpTexts[cmd];
|
|
if (txt == null) {
|
|
Terminal.error("No help topics match '" + cmd + "'");
|
|
return;
|
|
}
|
|
txt.forEach((t) => Terminal.print(t));
|
|
}
|
|
}
|