MCPcopy
hub / github.com/bombshell-dev/clack / main

Function main

examples/basic/index.ts:5–91  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import color from 'picocolors';
4
5async function main() {
6 console.clear();
7
8 await setTimeout(1000);
9
10 p.updateSettings({
11 aliases: {
12 w: 'up',
13 s: 'down',
14 a: 'left',
15 d: 'right',
16 },
17 });
18
19 p.intro(`${color.bgCyan(color.black(' create-app '))}`);
20
21 const project = await p.group(
22 {
23 path: () =>
24 p.text({
25 message: 'Where should we create your project?',
26 placeholder: './sparkling-solid',
27 validate: (value) => {
28 if (!value) return 'Please enter a path.';
29 if (value[0] !== '.') return 'Please enter a relative path.';
30 },
31 }),
32 password: () =>
33 p.password({
34 message: 'Provide a password',
35 validate: (value) => {
36 if (!value) return 'Please enter a password.';
37 if (value.length < 5) return 'Password should have at least 5 characters.';
38 },
39 }),
40 type: ({ results }) =>
41 p.select({
42 message: `Pick a project type within "${results.path}"`,
43 initialValue: 'ts',
44 maxItems: 5,
45 options: [
46 { value: 'ts', label: 'TypeScript' },
47 { value: 'js', label: 'JavaScript' },
48 { value: 'rust', label: 'Rust' },
49 { value: 'go', label: 'Go' },
50 { value: 'python', label: 'Python' },
51 { value: 'coffee', label: 'CoffeeScript', hint: 'oh no' },
52 ],
53 }),
54 tools: () =>
55 p.multiselect({
56 message: 'Select additional tools.',
57 initialValues: ['prettier', 'eslint'],
58 options: [
59 { value: 'prettier', label: 'Prettier', hint: 'recommended' },
60 { value: 'eslint', label: 'ESLint', hint: 'recommended' },
61 { value: 'stylelint', label: 'Stylelint' },
62 { value: 'gh-action', label: 'GitHub Action' },

Callers 1

index.tsFile · 0.70

Calls 4

cancelMethod · 0.80
startMethod · 0.80
stopMethod · 0.80
clearMethod · 0.65

Tested by

no test coverage detected