-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(cli): function to turn yargs output to cliArguments #32696
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #32696 +/- ##
=======================================
Coverage 66.96% 66.96%
=======================================
Files 329 329
Lines 18663 18663
Branches 3258 3258
=======================================
Hits 12497 12497
Misses 5839 5839
Partials 327 327
Flags with carried forward coverage won't be shown. Click here to find out more.
|
}); | ||
} | ||
|
||
function buildCliArgsFunction(config: CliConfig): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for all of the following buildXxx
functions, I am sure there is a more idiomatic way of achieving what I want via typewriter. I have done it this way because it felt the simplest for me as of right now, and I believe it will be easier to refactor later with the benefit of knowing exactly what the generated function should look like.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
break; | ||
|
||
case 'acknowledge': | ||
commandOptions = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at our current for this command I see:
aws-cdk/packages/aws-cdk/lib/cli.ts
Lines 433 to 434 in fcf4ecd
case 'ack': | |
return cli.acknowledge(args.ID); |
Should this PR also handle positional arguments? I would expect we have a strongly typed args.acknowledge.id
or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. A big part of my refactor is to make sure we don't have to use args
, argv
, and configuration.settings
everywhere and instead just have 1 object with arguments.
Currently those positional arguments are found in index 1 and beyond on argv._
: argv._: [Command, ...string]
It will be a bit awkward to figure out the right way to deal with that, which I would like to do in a separate PR.
@@ -2,6 +2,7 @@ | |||
// GENERATED FROM packages/aws-cdk/lib/config.ts. | |||
// Do not edit by hand; all changes will be overwritten at build time from the config file. | |||
// ------------------------------------------------------------------------------------------- | |||
// istanbul ignore file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this actually do something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. I forgot to yarn build
aws-cdk to remove them...
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Comments on closed issues and PRs are hard for our team to see. |
This PR has no impact on CLI functionality
This PR generates a new function,
convertToCliArgs
, that takes in the output of theyargs
configuration and turns it into aCliArguments
type. This allows us to subsequently utilize the strongly-typed object incli.ts
, but this PR does not actually do that.The ultimate benefit is that now we can ensure exactly what goes into this type. We can then enforce that any property allowed to be specified via
cdk.json
is also an option in the cli. When all my refactoring is done, there will be no options that are only specified viacdk.json
, and no options only specified via CLI.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license