forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamplify.ts
345 lines (342 loc) · 8.44 KB
/
amplify.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
const envNameGenerator: Fig.Generator = {
script: "amplify env list --json",
postProcess: function (out) {
const envContent = JSON.parse(out);
return envContent["envs"].map((env: string) => {
return { name: env, description: "Environment" };
});
},
};
const amplifyCategories: Fig.Subcommand[] = [
{
name: "notifications",
},
{
name: "analytics",
},
{
name: "api",
},
{
name: "auth",
},
{
name: "function",
},
{
name: "hosting",
},
{
name: "interactions",
},
{
name: "predictions",
},
{
name: "storage",
},
{
name: "xr",
},
];
const categoryCommands: Fig.Subcommand[] = [
{
name: "add",
description:
"Adds a resource for an Amplify category in your local backend",
},
{
name: "update",
description:
"Update resource for an Amplify category in your local backend",
},
{
name: "remove",
description:
"Removes a resource for an Amplify category in your local backend",
},
{
name: "console",
description: "Opens the web console for the category",
},
{
name: "push",
description:
"Provisions cloud resources with the latest local developments",
options: [
{
name: "-y",
description: "Answer all question as 'Yes'",
},
],
},
];
const completionSpec: Fig.Spec = {
name: "amplify",
description:
"A set of tools and services to help front-end web and mobile developers build scalable full stack applications",
subcommands: [
{
name: "init",
description:
"Initializes a new project, sets up deployment resources in the cloud, and makes your project ready for Amplify",
},
{
name: "configure",
description:
"Configures the attributes of your project for amplify-cli, such as switching front-end framework and adding/removing cloud-provider plugins",
},
{
name: "push",
description:
"Provisions cloud resources with the latest local developments",
options: [
{
name: "-y",
description: "Answer all question as 'Yes'",
},
],
subcommands: [...amplifyCategories],
},
{
name: "pull",
description:
"Fetch upstream backend environment definition changes from the cloud and updates the local environment to match that definition",
},
{
name: "publish",
description:
"Executes amplify push, and then builds and publishes client-side application for hosting",
},
{
name: "serve",
description:
"Executes amplify push, and then executes the project's start command to test run the client-side application locally",
},
{
name: "status",
description:
"Shows the state of local resources not yet pushed to the cloud (Create/Update/Delete)",
subcommands: [
...amplifyCategories,
{
name: "-v",
description:
"Shows the detailed verbose diff between local and deployed resources, including cloudformation-diff",
},
],
},
{
name: "delete",
description:
"Deletes all of the resources tied to the project from the cloud",
},
{
name: "add",
description:
"Adds a resource for an Amplify category in your local backend",
subcommands: amplifyCategories,
},
{
name: "update",
description:
"Update resource for an Amplify category in your local backend",
subcommands: amplifyCategories,
},
{
name: "remove",
description:
"Removes a resource for an Amplify category in your local backend",
subcommands: amplifyCategories,
},
{
name: "notifications",
subcommands: categoryCommands,
},
{
name: "analytics",
subcommands: categoryCommands,
},
{
name: "api",
subcommands: [
{
name: "gql-compile",
description:
"Compiles your GraphQL schema and generates a corresponding cloudformation template",
},
{
name: "migrate",
description:
"Migrates GraphQL schemas to the latest GraphQL transformer version",
},
{
name: "override",
description:
"Generates overrides file to apply custom modifications to CloudFormation",
},
{
name: "rebuild",
description:
"Removes and recreates all DynamoDB tables backing a GraphQL API. Useful for resetting test data during the development phase of an app",
},
...categoryCommands,
],
},
{
name: "auth",
subcommands: categoryCommands,
},
{
name: "function",
subcommands: [
{
name: "build",
description:
"Builds all the functions in the project (does an npm install on the functions src directory)",
},
...categoryCommands,
],
},
{
name: "hosting",
subcommands: categoryCommands,
},
{
name: "interactions",
subcommands: categoryCommands,
},
{
name: "predictions",
subcommands: categoryCommands,
},
{
name: "storage",
subcommands: categoryCommands,
},
{
name: "xr",
subcommands: categoryCommands,
},
{
name: "mock",
description: "Run mock server for testing categories locally",
},
{
name: "codegen",
description:
"Generates GraphQL statements(queries, mutations and eventHandlers) and type annotations",
},
{
name: "console",
description: "Opens the web console for the selected cloud resource",
},
{
name: "logout",
description:
"If using temporary cloud provider credentials, this logs out of the account",
},
{
name: "env",
description: "Display all commands available for new Amplify project",
subcommands: [
{
name: "add",
description: "Adds a new environment",
},
{
name: "pull",
description: "Pulls the current env from the cloud",
options: [
{
name: "--restore",
description: "Overwrite your local changes",
},
],
},
{
name: "checkout",
description: "Switches to selected environment",
args: {
name: "env-name",
description: "Env name",
generators: envNameGenerator,
},
options: [
{
name: "--restore",
description: "Overwrite your local changes",
},
],
},
{
name: "list",
description: "Displays a list of all the environments",
options: [
{
name: "--details",
description: "See more details",
},
{
name: "--json",
description: "Format the output",
},
],
},
{
name: "get",
description: "Displays the environment details",
options: [
{
name: "--name",
description: "Mandatory flag",
isRequired: true,
args: {
name: "env-name",
description: "Env name",
generators: envNameGenerator,
},
},
],
},
{
name: "import",
description: "Imports an environment",
options: [
{
name: "--name",
description: "Mandatory flag",
isRequired: true,
args: {
name: "env-name",
description: "Env name",
generators: envNameGenerator,
},
},
{
name: "--config",
description: "Specify provider configs",
isRequired: true,
args: {},
},
{
name: "--awsInfo",
description: "Specify AWS configs",
args: {},
},
],
},
{
name: "remove",
description: "Removes an environment",
args: {
name: "env-name",
description: "Env name",
generators: envNameGenerator,
},
},
],
},
],
};
export default completionSpec;