Skip to content

Commit

Permalink
chore(cli): explicit defaults to yargs definition and cli arguments (#…
Browse files Browse the repository at this point in the history
…32596)

This makes sure we have a default value (even if its `undefined`) for every option in yargs. There is a special case for arrays where the default will be `[]`. 

I also took the liberty to simplify the eslint exemptions by changing the prettier options.

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
kaizencc authored Dec 26, 2024
1 parent 0e1854d commit 0ce42a5
Show file tree
Hide file tree
Showing 7 changed files with 380 additions and 126 deletions.
42 changes: 21 additions & 21 deletions packages/aws-cdk/lib/cli-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ export interface GlobalOptions {
/**
* Add contextual string parameter (KEY=VALUE)
*
* @default - undefined
* @default - []
*/
readonly context?: Array<string>;

/**
* Name or path of a node package that extend the CDK features. Can be specified multiple times
*
* @default - undefined
* @default - []
*/
readonly plugin?: Array<string>;

Expand Down Expand Up @@ -297,7 +297,7 @@ export interface GlobalOptions {
/**
* Opt in to unstable features. The flag indicates that the scope and API of a feature might still change. Otherwise the feature is generally production ready and fully supported. Can be specified multiple times.
*
* @default - undefined
* @default - []
*/
readonly unstable?: Array<string>;
}
Expand Down Expand Up @@ -429,7 +429,7 @@ export interface BootstrapOptions {
*
* aliases: t
*
* @default - undefined
* @default - []
*/
readonly tags?: Array<string>;

Expand All @@ -443,21 +443,21 @@ export interface BootstrapOptions {
/**
* The AWS account IDs that should be trusted to perform deployments into this environment (may be repeated, modern bootstrapping only)
*
* @default - undefined
* @default - []
*/
readonly trust?: Array<string>;

/**
* The AWS account IDs that should be trusted to look up values in this environment (may be repeated, modern bootstrapping only)
*
* @default - undefined
* @default - []
*/
readonly 'trust-for-lookup'?: Array<string>;

/**
* The Managed Policy ARNs that should be attached to the role performing deployments into this environment (may be repeated, modern bootstrapping only)
*
* @default - undefined
* @default - []
*/
readonly 'cloudformation-execution-policies'?: Array<string>;

Expand Down Expand Up @@ -515,28 +515,28 @@ export interface GcOptions {
/**
* The action (or sub-action) you want to perform. Valid entires are "print", "tag", "delete-tagged", "full".
*
* @default - full
* @default - "full"
*/
readonly action?: string;

/**
* Specify either ecr, s3, or all
*
* @default - all
* @default - "all"
*/
readonly type?: string;

/**
* Delete assets that have been marked as isolated for this many days
*
* @default - undefined
* @default - 0
*/
readonly 'rollback-buffer-days'?: number;

/**
* Never delete assets younger than this (in days)
*
* @default - undefined
* @default - 1
*/
readonly 'created-buffer-days'?: number;

Expand Down Expand Up @@ -573,7 +573,7 @@ export interface DeployOptions {
*
* aliases: E
*
* @default - undefined
* @default - []
*/
readonly 'build-exclude'?: Array<string>;

Expand Down Expand Up @@ -605,7 +605,7 @@ export interface DeployOptions {
*
* aliases: t
*
* @default - undefined
* @default - []
*/
readonly tags?: Array<string>;

Expand Down Expand Up @@ -645,7 +645,7 @@ export interface DeployOptions {
/**
* Additional parameters passed to CloudFormation at deploy time (STACK:KEY=VALUE)
*
* @default - undefined
* @default - {}
*/
readonly parameters?: Array<string>;

Expand Down Expand Up @@ -717,7 +717,7 @@ export interface DeployOptions {
/**
* Maximum number of simultaneous deployments (dependency permitting) to execute.
*
* @default - undefined
* @default - 1
*/
readonly concurrency?: number;

Expand Down Expand Up @@ -782,7 +782,7 @@ export interface RollbackOptions {
/**
* Orphan the given resources, identified by their logical ID (can be specified multiple times)
*
* @default - undefined
* @default - []
*/
readonly orphan?: Array<string>;
}
Expand Down Expand Up @@ -860,7 +860,7 @@ export interface WatchOptions {
*
* aliases: E
*
* @default - undefined
* @default - []
*/
readonly 'build-exclude'?: Array<string>;

Expand Down Expand Up @@ -934,7 +934,7 @@ export interface WatchOptions {
/**
* Maximum number of simultaneous deployments (dependency permitting) to execute.
*
* @default - undefined
* @default - 1
*/
readonly concurrency?: number;
}
Expand Down Expand Up @@ -989,7 +989,7 @@ export interface DiffOptions {
/**
* Number of context lines to include in arbitrary JSON diff rendering
*
* @default - undefined
* @default - 3
*/
readonly 'context-lines'?: number;

Expand Down Expand Up @@ -1129,7 +1129,7 @@ export interface MigrateOptions {
*
* aliases: l
*
* @default - typescript
* @default - "typescript"
*/
readonly language?: string;

Expand Down Expand Up @@ -1185,7 +1185,7 @@ export interface MigrateOptions {
* tag-key: a string that matches resources with at least one tag with the provided key. i.e. "myTagKey"
* tag-value: a string that matches resources with at least one tag with the provided value. i.e. "myTagValue"
*
* @default - undefined
* @default - []
*/
readonly filter?: Array<string>;

Expand Down
Loading

0 comments on commit 0ce42a5

Please sign in to comment.