-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.new.ts
More file actions
33 lines (29 loc) · 771 Bytes
/
command.new.ts
File metadata and controls
33 lines (29 loc) · 771 Bytes
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
import { brightRed, YargsInstance } from "./deps.ts"
import { new_handler } from "./tank.ts"
const name_opt = {
alias: "name",
describe: "Project name.",
type: "string",
}
const bs_opt = {
alias: "bs",
default: false,
describe: "Adds Vite + Tailwind configurations.",
type: "boolean",
}
export const NEW = {
command: "<new>",
describe: "Creates a new project.",
builder: (cli: YargsInstance) =>
cli
.options({ n: name_opt, b: bs_opt })
.check(function ({ n, b }: { n: string; b: boolean }) {
// todo: e2e
if (!n) {
throw new Error(brightRed("Project name required."))
}
return true
}),
handler: new_handler,
example: ["tank new -n my-site", "Creates an unfancy new project."],
}