Skip to content

Commit

Permalink
Merge pull request withfig#293 from Nutlope/master
Browse files Browse the repository at this point in the history
[AMPLIFY] Add amplify env spec
  • Loading branch information
Brendan Falk authored Jun 13, 2021
2 parents f7bafb0 + 3812787 commit d92f28f
Showing 1 changed file with 118 additions and 0 deletions.
118 changes: 118 additions & 0 deletions dev/amplify.ts
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,
},
},
],
},
],
};

0 comments on commit d92f28f

Please sign in to comment.