forked from withfig/autocomplete
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request withfig#293 from Nutlope/master
[AMPLIFY] Add amplify env spec
- Loading branch information
Showing
1 changed file
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
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" }; | ||
}); | ||
}, | ||
}; | ||
|
||
export 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: "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.", | ||
required: true, | ||
args: { | ||
name: "env-name", | ||
description: "Env name", | ||
generators: envNameGenerator, | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "import", | ||
description: "Imports an environment.", | ||
options: [ | ||
{ | ||
name: "--name", | ||
description: "Mandatory flag.", | ||
required: true, | ||
args: { | ||
name: "env-name", | ||
description: "Env name", | ||
generators: envNameGenerator, | ||
}, | ||
}, | ||
{ | ||
name: "--config", | ||
description: "Specify provider configs.", | ||
required: true, | ||
args: {}, | ||
}, | ||
{ | ||
name: "--awsInfo", | ||
description: "Specify AWS configs.", | ||
args: {}, | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "remove", | ||
description: "Removes an environment.", | ||
args: { | ||
name: "env-name", | ||
description: "Env name", | ||
generators: envNameGenerator, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}; |