mirror of
https://github.com/codex-storage/cli.git
synced 2025-02-28 16:40:43 +00:00
main loop
This commit is contained in:
parent
b1e49eef87
commit
2297d01966
@ -1,12 +1,21 @@
|
|||||||
export class MainMenu {
|
export class MainMenu {
|
||||||
constructor(uiService) {
|
constructor(uiService) {
|
||||||
this.ui = uiService;
|
this.ui = uiService;
|
||||||
|
this.running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
show = async () => {
|
show = async () => {
|
||||||
this.ui.showLogo();
|
this.ui.showLogo();
|
||||||
this.ui.showInfoMessage("hello");
|
this.ui.showInfoMessage("hello");
|
||||||
|
|
||||||
|
while (this.running) {
|
||||||
|
await this.promptMainMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ui.showInfoMessage("K-THX-BYE");
|
||||||
|
};
|
||||||
|
|
||||||
|
promptMainMenu = async() => {
|
||||||
await this.ui.askMultipleChoice("Select an option",[
|
await this.ui.askMultipleChoice("Select an option",[
|
||||||
{
|
{
|
||||||
label: "optionOne",
|
label: "optionOne",
|
||||||
@ -15,10 +24,13 @@ export class MainMenu {
|
|||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
label: "optionTwo",
|
label: "optionTwo",
|
||||||
action: async function() {
|
action: this.closeMainMenu
|
||||||
console.log("B!")
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
closeMainMenu = async() => {
|
||||||
|
console.log("B!")
|
||||||
|
this.running = false;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user