-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·69 lines (64 loc) · 2.2 KB
/
index.js
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
#! /usr/bin/env node
import { useCommand, create, initCommand } from "./src/index.mjs";
import { Command } from "commander";
const program = new Command();
program
.command("use")
.description("Select a template and create a new PR")
.argument("[path]", "Path to templates directory - string - optional", "")
.option(
"-t, --title <string>",
"Title of your new PR - string - optional",
""
)
.action((path, { title }) => useCommand(path, title));
program
.command("init")
.description("Initialize a directory for your templates")
.argument("[path]", "Path to your new directory - string - optional")
.argument("[dirName]", "Name of your new directory - string - optional")
.option(
"-y, --yes",
"Skip prompts and arguments and immediately create the default directory - boolean - optional"
)
.option(
"-i, --initial",
"After initializing, segway into the create workflow to add templates - boolean - optional"
)
.option(
"-o, --own <string>",
"Path to your own templates - string - optional",
""
)
.option(
"-t, --title <string>",
"Title of your new PR template. Only works when selecting one template - string - optional",
""
)
.option(
"-a, --all",
"Skip prompts and arguments and immediately add all templates - boolean - optional"
)
.action((path, dirName, { yes, initial, own, title, all }) =>
initCommand(path, dirName, yes, initial, own, title, all)
);
program
.command("create")
.description("Add a template to your codebase")
.argument("[path]", "Path to your new directory - string - optional")
.option(
"-o, --own <string>",
"Path to your own templates - string - optional",
""
)
.option(
"-t, --title <string>",
"Title of your new PR template. Only works when selecting one template - string - optional",
""
)
.option(
"-a, --all",
"Skip prompts and arguments and immediately add all templates - boolean - optional"
)
.action((path, { own, title, all }) => create(path, own, title, all));
program.parse(process.argv);