Skip to content

Commit 3c79410

Browse files
author
github-actions
committed
chore: self mutation
Signed-off-by: github-actions <[email protected]>
1 parent 5437650 commit 3c79410

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

packages/aws-cdk/lib/cli/convert-to-user-input.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export function convertYargsToUserInput(args: any): UserInput {
246246
generateOnly: args.generateOnly,
247247
libVersion: args.libVersion,
248248
fromPath: args.fromPath,
249+
fromGitUrl: args.fromGitUrl,
249250
templatePath: args.templatePath,
250251
TEMPLATE: args.TEMPLATE,
251252
};
@@ -484,6 +485,7 @@ export function convertConfigToUserInput(config: any): UserInput {
484485
generateOnly: config.init?.generateOnly,
485486
libVersion: config.init?.libVersion,
486487
fromPath: config.init?.fromPath,
488+
fromGitUrl: config.init?.fromGitUrl,
487489
templatePath: config.init?.templatePath,
488490
};
489491
const migrateOptions = {

packages/aws-cdk/lib/cli/parse-command-line-arguments.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,13 +869,28 @@ export function parseCommandLineArguments(args: Array<string>): any {
869869
type: 'string',
870870
desc: 'Path to a local custom template directory or multi-template repository',
871871
requiresArg: true,
872-
conflicts: ['lib-version'],
872+
conflicts: ['lib-version', 'from-git-url'],
873+
})
874+
.option('from-git-url', {
875+
default: undefined,
876+
type: 'string',
877+
desc: 'Git repository URL to clone custom template from',
878+
requiresArg: true,
879+
conflicts: ['lib-version', 'from-path'],
873880
})
874881
.option('template-path', {
875882
default: undefined,
876883
type: 'string',
877884
desc: 'Path to a specific template within a multi-template repository',
878885
requiresArg: true,
886+
})
887+
.check((argv) => {
888+
if (argv['template-path'] && !argv['from-path'] && !argv['from-git-url']) {
889+
const error = new Error('--template-path can only be used with --from-path or --from-git-url');
890+
error.name = 'ValidationError';
891+
throw error;
892+
}
893+
return true;
879894
}),
880895
)
881896
.command('migrate', 'Migrate existing AWS resources into a CDK app', (yargs: Argv) =>

packages/aws-cdk/lib/cli/user-input.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,13 @@ export interface InitOptions {
13781378
*/
13791379
readonly fromPath?: string;
13801380

1381+
/**
1382+
* Git repository URL to clone custom template from
1383+
*
1384+
* @default - undefined
1385+
*/
1386+
readonly fromGitUrl?: string;
1387+
13811388
/**
13821389
* Path to a specific template within a multi-template repository
13831390
*

0 commit comments

Comments
 (0)