-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.ts
72 lines (71 loc) · 1.96 KB
/
init.ts
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
import { Command } from "https://deno.land/x/cliffy@v0.25.4/command/mod.ts";
import { defaultOptions, inputHandler, process } from "./writeConfigFile.ts";
await new Command()
.name("dci")
.version("v2.8.1")
.description("Generate a Deno configuration file.")
.help({
colors: (Deno.build.os === "windows") ? false : true,
})
.option(
"-a, --fill [fill:boolean]",
"Create the config file as .jsonc with the possible options listed as comments",
)
.option(
"-b, --bench [bench:boolean]",
"Add config for deno bench only. Requires Deno 1.29 or higher",
)
.option(
"-c, --jsonc [jsonc:boolean]",
"Create the config file as .jsonc. Alias for --fill",
)
.option(
"-f, --force [force:boolean]",
"Allow overwriting an existing config file",
)
.option(
"-n, --name <name:string>",
"Set a custom name for the config file",
)
.option(
"-m, --fmt [fmt:boolean]",
"Add config for deno fmt only",
)
.option(
"-p, --map [map:boolean]",
"Add config for an import map. Requires Deno 1.20 or higher",
)
.option(
"-l, --lint [lint:boolean]",
"Add config for deno lint only",
)
.option(
"-o, --lock [lock:boolean]",
"Enable or disable lock file generation",
)
.option(
"-i, --lockfile <lockfile:string>",
"Set a custom name for the lock file",
)
.option(
"-k, --task [task:boolean]",
"Add config for deno tasks only. Requires Deno 1.20 or higher",
)
.option(
"-s, --test [test:boolean]",
"Add config for deno test only. Requires Deno 1.24 or higher",
)
.option(
"-t, --tsconfig [tsconfig:boolean]",
"Add config for typescript compiler options only.",
)
.option(
"-y, --yes [yes:boolean]",
"Skip the prompts and use all defaults",
)
// deno-lint-ignore no-explicit-any
.action(async (options: any) => {
const processedOptions = process({ ...defaultOptions, ...options });
await inputHandler(processedOptions);
})
.parse(Deno.args);