Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/aws-cdk/lib/cli/cli-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export async function makeConfig(): Promise<CliConfig> {
'strict': { type: 'boolean', desc: 'Do not construct stacks with warnings' },
'lookups': { type: 'boolean', desc: 'Perform context lookups (synthesis fails if this is disabled and context lookups need to be performed)', default: true },
'ignore-errors': { type: 'boolean', default: false, desc: 'Ignores synthesis errors, which will likely produce an invalid output' },
'json': { type: 'boolean', alias: 'j', desc: 'Use JSON output instead of YAML when templates are printed to STDOUT', default: false },
'verbose': { type: 'boolean', alias: 'v', desc: 'Show debug logs (specify multiple times to increase verbosity)', default: false, count: true },
'debug': { type: 'boolean', default: false, implies: ['debug-app', 'debug-cli'], desc: 'Produce more detailed output to help diagnose unexpected behavior for the CDK app and CDK CLI. Note that this will significantly slow down synthesis time.' },
'debug-app': { type: 'boolean', default: false, desc: 'Debug the CDK app. Logs additional information during synthesis, such as creation stack traces and sets the CDK_DEBUG environment variable. Will slow down synthesis.' },
Expand Down Expand Up @@ -62,6 +61,7 @@ export async function makeConfig(): Promise<CliConfig> {
options: {
'long': { type: 'boolean', default: false, alias: 'l', desc: 'Display environment information for each stack' },
'show-dependencies': { type: 'boolean', default: false, alias: 'd', desc: 'Display stack dependency information for each stack' },
'json': { type: 'boolean', alias: 'j', desc: 'Use JSON output instead of YAML', default: false },
},
},
'synth': {
Expand All @@ -75,6 +75,7 @@ export async function makeConfig(): Promise<CliConfig> {
exclusively: { type: 'boolean', alias: 'e', desc: 'Only synthesize requested stacks, don\'t include dependencies' },
validation: { type: 'boolean', desc: 'After synthesis, validate stacks with the "validateOnSynth" attribute set (can also be controlled with CDK_VALIDATION)', default: true },
quiet: { type: 'boolean', alias: 'q', desc: 'Do not output CloudFormation Template to stdout', default: false },
json: { type: 'boolean', alias: 'j', desc: 'Use JSON output instead of YAML when templates are printed to STDOUT', default: false },
watch: {
type: 'boolean',
desc: 'Continuously observe the project files, ' +
Expand Down Expand Up @@ -107,6 +108,7 @@ export async function makeConfig(): Promise<CliConfig> {
'force': { alias: 'f', type: 'boolean', desc: 'Always bootstrap even if it would downgrade template version', default: false },
'termination-protection': { type: 'boolean', default: undefined, desc: 'Toggle CloudFormation termination protection on the bootstrap stacks' },
'show-template': { type: 'boolean', desc: 'Instead of actual bootstrapping, print the current CLI\'s bootstrapping template to stdout for customization', default: false },
'json': { type: 'boolean', alias: 'j', desc: 'Use JSON output instead of YAML when the template is printed with --show-template', default: false },
'toolkit-stack-name': { type: 'string', desc: 'The name of the CDK toolkit stack to create', requiresArg: true },
'template': { type: 'string', requiresArg: true, desc: 'Use the template from the given file instead of the built-in one (use --show-template to obtain an example)' },
'previous-parameters': { type: 'boolean', default: true, desc: 'Use previous values for existing parameters (you must specify all parameters on every deployment if this is disabled)' },
Expand Down Expand Up @@ -462,6 +464,9 @@ export async function makeConfig(): Promise<CliConfig> {
name: 'STACK',
variadic: false,
},
options: {
json: { type: 'boolean', alias: 'j', desc: 'Use JSON output instead of YAML', default: false },
},
},
'acknowledge': {
aliases: ['ack'],
Expand Down Expand Up @@ -535,6 +540,7 @@ export async function makeConfig(): Promise<CliConfig> {
reset: { alias: 'e', desc: 'The context key (or its index) to reset', type: 'string', requiresArg: true, default: undefined },
force: { alias: 'f', desc: 'Ignore missing key error', type: 'boolean', default: false },
clear: { desc: 'Clear all context', type: 'boolean', default: false },
json: { alias: 'j', desc: 'Use JSON output instead of a table', type: 'boolean', default: false },
},
},
'docs': {
Expand Down
38 changes: 32 additions & 6 deletions packages/aws-cdk/lib/cli/cli-type-registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@
"default": false,
"desc": "Ignores synthesis errors, which will likely produce an invalid output"
},
"json": {
"type": "boolean",
"alias": "j",
"desc": "Use JSON output instead of YAML when templates are printed to STDOUT",
"default": false
},
"verbose": {
"type": "boolean",
"alias": "v",
Expand Down Expand Up @@ -180,6 +174,12 @@
"default": false,
"alias": "d",
"desc": "Display stack dependency information for each stack"
},
"json": {
"type": "boolean",
"alias": "j",
"desc": "Use JSON output instead of YAML",
"default": false
}
}
},
Expand Down Expand Up @@ -209,6 +209,12 @@
"desc": "Do not output CloudFormation Template to stdout",
"default": false
},
"json": {
"type": "boolean",
"alias": "j",
"desc": "Use JSON output instead of YAML when templates are printed to STDOUT",
"default": false
},
"watch": {
"type": "boolean",
"desc": "Continuously observe the project files, and synthesize the given stack(s) automatically when changes are detected. Never deploys, and never prints templates to stdout (--quiet and --json have no effect)"
Expand Down Expand Up @@ -310,6 +316,12 @@
"desc": "Instead of actual bootstrapping, print the current CLI's bootstrapping template to stdout for customization",
"default": false
},
"json": {
"type": "boolean",
"alias": "j",
"desc": "Use JSON output instead of YAML when the template is printed with --show-template",
"default": false
},
"toolkit-stack-name": {
"type": "string",
"desc": "The name of the CDK toolkit stack to create",
Expand Down Expand Up @@ -1019,6 +1031,14 @@
"arg": {
"name": "STACK",
"variadic": false
},
"options": {
"json": {
"type": "boolean",
"alias": "j",
"desc": "Use JSON output instead of YAML",
"default": false
}
}
},
"acknowledge": {
Expand Down Expand Up @@ -1194,6 +1214,12 @@
"desc": "Clear all context",
"type": "boolean",
"default": false
},
"json": {
"alias": "j",
"desc": "Use JSON output instead of a table",
"type": "boolean",
"default": false
}
}
},
Expand Down
15 changes: 12 additions & 3 deletions packages/aws-cdk/lib/cli/convert-to-user-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function convertYargsToUserInput(args: any): UserInput {
strict: args.strict,
lookups: args.lookups,
ignoreErrors: args.ignoreErrors,
json: args.json,
verbose: args.verbose,
debug: args.debug,
debugApp: args.debugApp,
Expand Down Expand Up @@ -48,6 +47,7 @@ export function convertYargsToUserInput(args: any): UserInput {
commandOptions = {
long: args.long,
showDependencies: args.showDependencies,
json: args.json,
STACKS: args.STACKS,
};
break;
Expand All @@ -58,6 +58,7 @@ export function convertYargsToUserInput(args: any): UserInput {
exclusively: args.exclusively,
validation: args.validation,
quiet: args.quiet,
json: args.json,
watch: args.watch,
STACKS: args.STACKS,
};
Expand All @@ -82,6 +83,7 @@ export function convertYargsToUserInput(args: any): UserInput {
force: args.force,
terminationProtection: args.terminationProtection,
showTemplate: args.showTemplate,
json: args.json,
toolkitStackName: args.toolkitStackName,
template: args.template,
previousParameters: args.previousParameters,
Expand Down Expand Up @@ -272,6 +274,7 @@ export function convertYargsToUserInput(args: any): UserInput {

case 'metadata':
commandOptions = {
json: args.json,
STACK: args.STACK,
};
break;
Expand Down Expand Up @@ -323,6 +326,7 @@ export function convertYargsToUserInput(args: any): UserInput {
reset: args.reset,
force: args.force,
clear: args.clear,
json: args.json,
};
break;

Expand Down Expand Up @@ -389,7 +393,6 @@ export function convertConfigToUserInput(config: any): UserInput {
strict: config.strict,
lookups: config.lookups,
ignoreErrors: config.ignoreErrors,
json: config.json,
verbose: config.verbose,
debug: config.debug,
debugApp: config.debugApp,
Expand All @@ -416,11 +419,13 @@ export function convertConfigToUserInput(config: any): UserInput {
const listOptions = {
long: config.list?.long,
showDependencies: config.list?.showDependencies,
json: config.list?.json,
};
const synthOptions = {
exclusively: config.synth?.exclusively,
validation: config.synth?.validation,
quiet: config.synth?.quiet,
json: config.synth?.json,
watch: config.synth?.watch,
};
const bootstrapOptions = {
Expand All @@ -441,6 +446,7 @@ export function convertConfigToUserInput(config: any): UserInput {
force: config.bootstrap?.force,
terminationProtection: config.bootstrap?.terminationProtection,
showTemplate: config.bootstrap?.showTemplate,
json: config.bootstrap?.json,
toolkitStackName: config.bootstrap?.toolkitStackName,
template: config.bootstrap?.template,
previousParameters: config.bootstrap?.previousParameters,
Expand Down Expand Up @@ -578,7 +584,9 @@ export function convertConfigToUserInput(config: any): UserInput {
const driftOptions = {
fail: config.drift?.fail,
};
const metadataOptions = {};
const metadataOptions = {
json: config.metadata?.json,
};
const acknowledgeOptions = {};
const noticesOptions = {
unacknowledged: config.notices?.unacknowledged,
Expand Down Expand Up @@ -609,6 +617,7 @@ export function convertConfigToUserInput(config: any): UserInput {
reset: config.context?.reset,
force: config.context?.force,
clear: config.context?.clear,
json: config.context?.json,
};
const docsOptions = {
browser: config.docs?.browser,
Expand Down
39 changes: 32 additions & 7 deletions packages/aws-cdk/lib/cli/parse-command-line-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ export function parseCommandLineArguments(args: Array<string>): any {
type: 'boolean',
desc: 'Ignores synthesis errors, which will likely produce an invalid output',
})
.option('json', {
default: false,
type: 'boolean',
alias: 'j',
desc: 'Use JSON output instead of YAML when templates are printed to STDOUT',
})
.option('verbose', {
default: false,
type: 'boolean',
Expand Down Expand Up @@ -202,6 +196,12 @@ export function parseCommandLineArguments(args: Array<string>): any {
type: 'boolean',
alias: 'd',
desc: 'Display stack dependency information for each stack',
})
.option('json', {
default: false,
type: 'boolean',
alias: 'j',
desc: 'Use JSON output instead of YAML',
}),
)
.command(['synth [STACKS..]', 'synthesize [STACKS..]'], 'Synthesizes and prints the CloudFormation template for this stack', (yargs: Argv) =>
Expand All @@ -223,6 +223,12 @@ export function parseCommandLineArguments(args: Array<string>): any {
alias: 'q',
desc: 'Do not output CloudFormation Template to stdout',
})
.option('json', {
default: false,
type: 'boolean',
alias: 'j',
desc: 'Use JSON output instead of YAML when templates are printed to STDOUT',
})
.option('watch', {
default: undefined,
type: 'boolean',
Expand Down Expand Up @@ -335,6 +341,12 @@ export function parseCommandLineArguments(args: Array<string>): any {
type: 'boolean',
desc: "Instead of actual bootstrapping, print the current CLI's bootstrapping template to stdout for customization",
})
.option('json', {
default: false,
type: 'boolean',
alias: 'j',
desc: 'Use JSON output instead of YAML when the template is printed with --show-template',
})
.option('toolkit-stack-name', {
default: undefined,
type: 'string',
Expand Down Expand Up @@ -1022,7 +1034,14 @@ export function parseCommandLineArguments(args: Array<string>): any {
desc: 'Fail with exit code 1 if drift is detected',
}),
)
.command('metadata [STACK]', 'Returns all metadata associated with this stack')
.command('metadata [STACK]', 'Returns all metadata associated with this stack', (yargs: Argv) =>
yargs.option('json', {
default: false,
type: 'boolean',
alias: 'j',
desc: 'Use JSON output instead of YAML',
}),
)
.command(['acknowledge [ID]', 'ack [ID]'], 'Acknowledge a notice so that it does not show up anymore')
.command('notices', 'Returns a list of relevant notices', (yargs: Argv) =>
yargs.option('unacknowledged', {
Expand Down Expand Up @@ -1161,6 +1180,12 @@ export function parseCommandLineArguments(args: Array<string>): any {
default: false,
desc: 'Clear all context',
type: 'boolean',
})
.option('json', {
default: false,
alias: 'j',
desc: 'Use JSON output instead of a table',
type: 'boolean',
}),
)
.command(['docs', 'doc'], 'Opens the reference documentation in a browser', (yargs: Argv) =>
Expand Down
Loading
Loading