fix: add new exit pathways '^D, exit, logout' (#2)

Signed-off-by: Chapman Pendery <cpendery@vt.edu>
This commit is contained in:
Chapman Pendery
2023-11-02 10:52:28 -07:00
committed by GitHub
parent 16eff3b235
commit cddb54ae3d
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ export const action = async (options: RootCommandOptions) => {
while (options.duration === "session" || !executed) {
const commandToExecute = await render(startingCommand);
if (commandToExecute == null) {
if (commandToExecute == null || commandToExecute.trim().toLowerCase() == "exit" || commandToExecute.trim().toLowerCase() == "logout") {
result = { code: 0 };
break;
}
+5 -1
View File
@@ -30,7 +30,11 @@ function UI({ startingCommand }: { startingCommand: string }) {
}
}, []);
useInput((_, key) => {
useInput((input, key) => {
if (key.ctrl && input.toLowerCase() == "d") {
uiResult = undefined;
exit();
}
if (key.return) {
setIsExiting(true);
}