Skip to main content
Module

x/cliffy/examples/prompt/os_signals.ts

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
File
#!/usr/bin/env -S deno run --unstable
import { tty } from "../../ansi/tty.ts";import { Toggle } from "../../prompt/toggle.ts";
const sig = Deno.signals.interrupt();(async () => { for await (const _ of sig) { tty.cursorLeft.eraseDown.cursorShow(); console.log("\nSigint received. Exiting deno process!"); Deno.exit(1); }})();
const confirmed: boolean = await Toggle.prompt({ message: "Please confirm", cbreak: true,});
console.log({ confirmed });
sig.dispose();