MCPcopy Create free account
hub / github.com/bombshell-dev/clack / main

Function main

examples/basic/date.ts:4–19  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import color from 'picocolors';
3
4async function main() {
5 const result = (await p.date({
6 message: color.magenta('Pick a date'),
7 format: 'YMD',
8 minDate: new Date('2026-01-01'),
9 maxDate: new Date('2026-12-31'),
10 })) as Date;
11
12 if (p.isCancel(result)) {
13 p.cancel('Operation cancelled.');
14 process.exit(0);
15 }
16
17 const fmt = (d: Date) => d.toISOString().slice(0, 10);
18 p.outro(`Selected date: ${color.cyan(fmt(result))}`);
19}
20
21main().catch(console.error);

Callers 1

date.tsFile · 0.70

Calls 2

fmtFunction · 0.85
cancelMethod · 0.80

Tested by

no test coverage detected