mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-10-23 02:03:14 +02:00
20 lines
603 B
TypeScript
20 lines
603 B
TypeScript
import { Terminal } from "../../Terminal";
|
|
import { Player } from "@player";
|
|
|
|
export function history(args: (string | number | boolean)[]): void {
|
|
if (args.length === 0) {
|
|
Terminal.commandHistory.forEach((command, index) => {
|
|
Terminal.print(`${index.toString().padStart(2)} ${command}`);
|
|
});
|
|
return;
|
|
}
|
|
const arg = args[0] + "";
|
|
if (arg === "-c" || arg === "--clear") {
|
|
Player.terminalCommandHistory = [];
|
|
Terminal.commandHistory = [];
|
|
Terminal.commandHistoryIndex = 1;
|
|
} else {
|
|
Terminal.error("Incorrect usage of history command. usage: history [-c]");
|
|
}
|
|
}
|