-
Notifications
You must be signed in to change notification settings - Fork 21
/
dim.ts
169 lines (168 loc) · 4.21 KB
/
dim.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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import { Command, CompletionsCommand, GithubProvider, HelpCommand, UpgradeCommand } from "./deps.ts";
import {
CleanAction,
GenerateAction,
InitAction,
InstallAction,
ListAction,
SearchAction,
UninstallAction,
UpdateAction,
VerifyAction,
} from "./libs/actions.ts";
import { NAME, VERSION } from "./libs/consts.ts";
await new Command()
.name(NAME)
.version(VERSION)
.default("help")
.command(
"init",
new Command()
.description("Init the project.")
.action(new InitAction().execute),
)
.command(
"install",
new Command()
.arguments("[url:string]")
.option(
"-p, --postProcesses <postProcesses>",
"Specify post-processing when installing.",
{ collect: true },
)
.option(
"-n, --name <name:string>",
"Specify the name.This is required.",
)
.option(
"-H, --headers <headers:string>",
"Specify the header. Can specify multiple times.",
{ collect: true },
)
.option(
"-f, --file <file:string>",
"Specify the dim.json file when installing data.",
)
.option(
"-F, --force",
"Forced install. Overwrite already exist data file.",
)
.option(
"-A, --asyncInstall",
"Execute asyncronous install.",
)
.option(
"-P, --pageInstall <pageInstall:string>",
"Execute install from links in specified page.",
)
.option(
"-e, --expression <expression:string>",
"Filter PageInstall result by regular expression.",
)
.description(
"Install the data.\n" +
"Specify the url of data. If you dont't specify argument, install all data which is not installed dependency.",
)
.action(new InstallAction().execute),
)
.command(
"uninstall",
new Command()
.arguments("<name:string>")
.description(
"Uninstall the data.\n" +
"Specify the data name.",
)
.action(new UninstallAction().execute),
)
.command(
"clean",
new Command()
.description(
"Delete only data_files and init the project.",
)
.action(new CleanAction().execute),
)
.command(
"list",
new Command()
.option(
"-s, --simple",
"Simple format.",
)
.description("Show the data list.")
.action(new ListAction().execute),
)
.command(
"update",
new Command()
.arguments("[name:string]")
.option(
"-A, --asyncInstall",
"Execute asyncronous install.",
)
.description("Update the data.")
.action(new UpdateAction().execute),
)
.command(
"upgrade",
new UpgradeCommand({
main: "dim.ts",
args: [
"--allow-run",
"--allow-read",
"--allow-net",
"--allow-write",
"--unstable",
],
provider: [
new GithubProvider({ repository: "c-3lab/dim" }),
],
}),
)
.command(
"search",
new Command()
.option(
"-n, --number <number:integer>",
"Specify the number of data to get by option -n (default 10).",
{
default: 10,
},
)
.option(
"-i, --install",
"Interactive installation.",
)
.arguments("<keyword:string>")
.description("Search data from package_search CKAN API")
.action(new SearchAction().execute),
)
.command(
"verify",
new Command()
.description(
"Verify if the data is changed, to compare the integrities.\n",
)
.action(new VerifyAction().execute),
)
.command(
"generate",
new Command()
.option(
"-t, --target <target:string>",
"Specify the target data name or file path to send to GPT-3 API.",
)
.option(
"-o, --output <output:string>",
"Specify to output file path of generated post-process.",
)
.arguments("<prompt:string>")
.description(
"Auto-generate code about target data using GPT-3 API. \nFor example, conversion processing, visualization processing, etc.",
)
.action(new GenerateAction().execute),
)
.command("help", new HelpCommand())
.command("complete", new CompletionsCommand())
.parse(Deno.args);