This repository has been archived by the owner on Feb 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
073de80
commit 5526764
Showing
2 changed files
with
38 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
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,36 @@ | ||
import { ComandDefinition } from './CommandDefinition' | ||
import { stackOutput } from '../cloudformation/stackOutput' | ||
import chalk from 'chalk' | ||
|
||
export const infoCommand = ({ | ||
stackId, | ||
region, | ||
}: { | ||
stackId: string | ||
region: string | ||
}): ComandDefinition => ({ | ||
command: 'info', | ||
options: [ | ||
{ | ||
flags: '-o, --output <output>', | ||
description: 'If set, only return the value of this output', | ||
}, | ||
], | ||
action: async ({ output }) => { | ||
const outputs = await stackOutput({ | ||
stackId, | ||
region, | ||
}) | ||
if (output) { | ||
if (outputs[output] === undefined) { | ||
throw new Error(`${output} is not defined.`) | ||
} | ||
console.log(outputs[output]) | ||
return | ||
} | ||
Object.entries(outputs).forEach(([k, v]) => { | ||
console.log(chalk.yellow(k), chalk.green(v)) | ||
}) | ||
}, | ||
help: 'Prints information about your stack', | ||
}) |