change: selects now use inputmanager
fix: bad exit logic feat: field rename now supports renaming things with multiple widgets
This commit is contained in:
@@ -6,6 +6,7 @@ import { selectMenuInteractive } from "./selectMenu.ts";
|
||||
import { TerminalBlock, TerminalLayout } from "./TerminalLayout.ts";
|
||||
import { cliAlert, cliLog } from "./prompts.ts";
|
||||
import type { ITool } from "../types.ts";
|
||||
import { InputManager } from "./InputManager.ts";
|
||||
|
||||
// Register tools here (filename, no extension)
|
||||
const toolRegistry: [string, Promise<{ default: ITool }>][] = [
|
||||
@@ -55,6 +56,12 @@ export class PdfToolsCli {
|
||||
}
|
||||
|
||||
public async run() {
|
||||
const im = InputManager.getInstance();
|
||||
im.activate();
|
||||
im.addEventListener("exit", () => {
|
||||
this.closeMessage = "Exiting...";
|
||||
this.cleanup();
|
||||
});
|
||||
try {
|
||||
await this.importTools();
|
||||
const titleBlock = new TerminalBlock();
|
||||
@@ -78,11 +85,13 @@ export class PdfToolsCli {
|
||||
}
|
||||
} finally {
|
||||
this.cleanup();
|
||||
Deno.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
private cleanup() {
|
||||
this.terminalLayout.clearAll();
|
||||
InputManager.getInstance().deactivate();
|
||||
Deno.stdin.setRaw(false);
|
||||
if (this.closeMessage) console.log(this.closeMessage);
|
||||
}
|
||||
|
Reference in New Issue
Block a user