2025-02-25 13:59:26 +01:00
|
|
|
export class MainMenu {
|
2025-04-01 14:09:20 +02:00
|
|
|
constructor(uiService, menuLoop, installMenu, configMenu) {
|
2025-02-25 13:59:26 +01:00
|
|
|
this.ui = uiService;
|
2025-04-01 14:09:20 +02:00
|
|
|
this.loop = menuLoop;
|
2025-03-07 13:14:32 +01:00
|
|
|
this.installMenu = installMenu;
|
2025-03-31 15:02:37 +02:00
|
|
|
this.configMenu = configMenu;
|
2025-04-01 14:09:20 +02:00
|
|
|
|
|
|
|
|
this.loop.initialize(this.promptMainMenu);
|
2025-02-25 13:59:26 +01:00
|
|
|
}
|
|
|
|
|
|
2025-02-25 14:37:28 +01:00
|
|
|
show = async () => {
|
|
|
|
|
this.ui.showLogo();
|
2025-03-07 13:14:32 +01:00
|
|
|
|
2025-04-01 14:09:20 +02:00
|
|
|
await this.loop.showLoop();
|
2025-02-25 15:25:14 +01:00
|
|
|
|
|
|
|
|
this.ui.showInfoMessage("K-THX-BYE");
|
|
|
|
|
};
|
|
|
|
|
|
2025-03-07 13:14:32 +01:00
|
|
|
promptMainMenu = async () => {
|
|
|
|
|
await this.ui.askMultipleChoice("Select an option", [
|
|
|
|
|
{
|
2025-04-09 09:31:22 +02:00
|
|
|
label: "Install/uninstall Codex",
|
2025-03-07 13:14:32 +01:00
|
|
|
action: this.installMenu.show,
|
|
|
|
|
},
|
2025-03-31 15:02:37 +02:00
|
|
|
{
|
|
|
|
|
label: "Configure Codex",
|
|
|
|
|
action: this.configMenu.show,
|
|
|
|
|
},
|
2025-02-25 14:37:28 +01:00
|
|
|
{
|
2025-03-07 13:14:32 +01:00
|
|
|
label: "Exit",
|
2025-04-01 14:09:20 +02:00
|
|
|
action: this.loop.stopLoop,
|
2025-02-25 14:37:28 +01:00
|
|
|
},
|
2025-03-07 13:14:32 +01:00
|
|
|
]);
|
2025-02-25 13:59:26 +01:00
|
|
|
};
|
|
|
|
|
}
|