-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkitchen-sink.ts
More file actions
123 lines (121 loc) · 2.69 KB
/
kitchen-sink.ts
File metadata and controls
123 lines (121 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import { z } from 'zod/v4'
import { Command } from '../src/_entrypoints/_.js'
import { Zod } from '../src/_entrypoints/extensions.js'
// Type instantiation depth exceeded - see https://github.com/jasonkuhrt/oak/issues/XXX
// @ts-ignore - builder type inference
const args = Command.create()
.use(Zod)
.description(
`This is a so-called "kitchen-sink" Oak example. Many features are demonstrated here though the overall CLI itself makes no sense. Take a look around, see how the help renders, try running with different inputs, etc.`,
)
.parameter(
`badDefault`,
z
.string()
.default(() => {
throw new Error(`whoops`)
}),
)
.parameter(
`one`,
z
.enum([`apple`]),
)
.parameter(
`figbar`,
z
.enum([`zebra`, `monkey`, `giraffe`])
.default(`monkey`),
)
.parameter(
`big`,
z
.enum([
`apple`,
`baby`,
`cannabis`,
`dinosaur`,
`elephant`,
`fanna`,
`goat`,
`house`,
`island`,
`jake`,
`kilomanjara`,
])
.optional(),
)
.parameter(
`i install`,
z
.union([
z
.boolean()
.describe(`Use the system-detected package manager.`),
z
.enum([`yarn`, `npm`, `pnpm`])
.describe(`Force use of a specific package manager.`),
])
.describe(`Run dependency install after setup.`)
.default(false),
)
.parameter(
`filePath`,
z
.string()
.describe(`Path to the file to convert.`),
)
.parameter(
`to`,
z
.enum([`json`, `yaml`, `toml`])
.describe(`Format to convert to.`),
)
.parameter(
`from`,
z
.enum([`json`, `yaml`, `toml`])
.optional()
.describe(`Format to convert from. By default inferred from the file extension.`),
)
.parameter(
`verbose v`,
z
.boolean()
.default(false)
.describe(`Log detailed progress as conversion executes.`),
)
.parameter(
`move m`,
z
.boolean()
.default(false)
.describe(`Delete the original file after it has been converted.`),
)
.parametersExclusive(`desert`, (_: any) =>
_.parameter(
`cake`,
z
.enum([`chocolate`, `vanilla`, `strawberry`])
.describe(`An indulgent treat to celebrate peak moments in life!`),
).parameter(
`fruit`,
z
.enum([`apple`, `banana`, `orange`])
.describe(`A sustainable snack for everyday happiness and delight!`),
))
.settings({
parameters: {
environment: {
// $default: true,
big: true,
},
},
})
.parse()
args.filePath
args.desert
args.from
args.move
args.to
args.verbose