Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/bombshell-dev/clack. Effortlessly build beautiful command-line apps bomb.sh/docs/clack/basics/getting-started
cli command-line command-line-app node prompt prompts
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233import type { CommonOptions } from './common.js';import { spinner } from './spinner.js';
export type Task = { /** * Task title */ title: string; /** * Task function */ task: (message: (string: string) => void) => string | Promise<string> | void | Promise<void>;
/** * If enabled === false the task will be skipped */ enabled?: boolean;};
/** * Define a group of tasks to be executed */export const tasks = async (tasks: Task[], opts?: CommonOptions) => { for (const task of tasks) { if (task.enabled === false) continue;
const s = spinner(opts); s.start(task.title); const result = await task.task(s.message); s.stop(result || task.title); }};