Skip to content

Commit

Permalink
add --watch to create-changeset. Fixes #16
Browse files Browse the repository at this point in the history
  • Loading branch information
tavisrudd committed Feb 27, 2018
1 parent 771b9e3 commit 8513bba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/cfn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,17 @@ export async function updateStackMain(argv: GenericCLIArguments): Promise<number


export async function createChangesetMain(argv: GenericCLIArguments): Promise<number> {
return new CreateChangeSet(argv, await loadStackArgs(argv)).run();
const changesetRunner = new CreateChangeSet(argv, await loadStackArgs(argv));
const changesetExitCode = await changesetRunner.run();
if (argv.watch && changesetExitCode === 0) {
console.log();
await watchStack(changesetRunner.stackName, new Date(), DEFAULT_EVENT_POLL_INTERVAL, argv.watchInactivityTimeout);
console.log();
await summarizeCompletedStackOperation(changesetRunner.stackName);
return 0;
} else {
return changesetExitCode;
}
};

export async function listStacksMain(argv: GenericCLIArguments): Promise<number> {
Expand Down
8 changes: 8 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ export function buildArgs(commands = lazy, wrapMainHandler = wrapCommandHandler)
description('create a cfn changeset based on stack-args.yaml'),
(args) => args
.demandCommand(0, 0)
.option('watch', {
type: 'boolean', default: false,
description: 'Watch stack after creating changeset. This is useful when exec-changeset is called by others.'
})
.option('watch-inactivity-timeout', {
type: 'number', default: (60 * 3),
description: description('how long to wait for events when the stack is in a terminal state')
})
.option('description', {
type: 'string', default: undefined,
description: description('optional description of changeset')
Expand Down

0 comments on commit 8513bba

Please sign in to comment.