-
Notifications
You must be signed in to change notification settings - Fork 164
Feat/create path flag #3113
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
Feat/create path flag #3113
Conversation
|
Hi @intojhanurag. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3113 +/- ##
==========================================
+ Coverage 58.32% 59.07% +0.75%
==========================================
Files 134 134
Lines 17350 17364 +14
==========================================
+ Hits 10119 10258 +139
+ Misses 6292 6137 -155
- Partials 939 969 +30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hey @gauron99 , It is ready for review. |
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.
thanks for the contribution! I added a few questions/suggestions
cmd/create.go
Outdated
| // Retain positional [path] for backward compatibility (warned later). | ||
| cmd.Flags().StringP("path", "p", ".", "Path to the function project directory (default: current directory) ($FUNC_PATH)") | ||
|
|
||
| // Bind the --path flag to viper so it can be read in newCreateConfig |
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.
why do we need to bind this to read later? we are not binding other flags and we still read them in createConfig.
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.
I initially tried reading --path without binding it to viper, but viper.GetString("path") returned empty, And with binding it is working🙂
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.
OK I see it. There is a bindEnv function thats being called. You should be able to add path as one of the arguments there and that binds all those flags i mentioned.
|
/ok-to-test |
|
Hey @gauron99, let me know if any changes are needed. I'm not sure why one of the tests is failing. |
cmd/create.go
Outdated
| // Retain positional [path] for backward compatibility (warned later). | ||
| cmd.Flags().StringP("path", "p", ".", "Path to the function project directory (default: current directory) ($FUNC_PATH)") | ||
|
|
||
| // Bind the --path flag to viper so it can be read in newCreateConfig |
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.
OK I see it. There is a bindEnv function thats being called. You should be able to add path as one of the arguments there and that binds all those flags i mentioned.
cmd/create.go
Outdated
| $ {{.Name}} create -l go -t cloudevents myfunc | ||
| `, | ||
| SuggestFor: []string{"vreate", "creaet", "craete", "new"}, | ||
| PreRunE: bindEnv("language", "template", "repository", "confirm", "verbose"), |
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.
we should be able to add path here
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.
Make sense , thanks :)
@intojhanurag looks like a flake, I will re-run if it fails again |
|
Thanks! /lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauron99, intojhanurag The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR fixes the --path flag in the func create command. Previously, cfg.Path was empty when using --path because the path computation happened after the confirm check, causing initialization failure
Before
After