UNPKG

askeroo

Version:

A modern CLI prompt library with flow control, history navigation, and conditional prompts

27 lines 865 B
#!/usr/bin/env node import { ask, group, text } from "../src/index.js"; import { completedFields } from "../src/built-ins/completed-fields/index.js"; const flow = async () => { // Show completed fields after first field await completedFields(); // First, let's collect some data const answers = await group(async () => { return { name: await text({ label: "Name" }), email: await text({ label: "Email" }), phone: await text({ label: "Phone" }), }; }, { id: "answers", flow: "phased" }); return { answers }; }; (async () => { try { const result = await ask(flow); console.log("\nResult:", JSON.stringify(result, null, 2)); } catch (error) { console.error("Error:", error); process.exit(1); } })(); //# sourceMappingURL=completed-fields.js.map