-
Notifications
You must be signed in to change notification settings - Fork 208
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
Support skipping parameters and credentials during generate #3100
Support skipping parameters and credentials during generate #3100
Conversation
Adds a `skip` option to the prompt allow users to skip parameter and credential generation of specific entries. Signed-off-by: Kim Christensen <kimworking@gmail.com>
pkg/generator/generator.go
Outdated
@@ -52,7 +53,7 @@ func genSurvey(name string, surveyType SurveyType) (secrets.SourceMap, error) { | |||
// extra space-suffix to align question and answer. Unfortunately misaligns help text | |||
sourceTypePrompt := &survey.Select{ | |||
Message: fmt.Sprintf("How would you like to set %s %q\n ", surveyType, name), | |||
Options: []string{questionSecret, questionValue, questionEnvVar, questionPath, questionCommand}, | |||
Options: []string{questionSecret, questionValue, questionEnvVar, questionPath, questionCommand, questionSkip}, |
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.
How are you handling if required is set to true?
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.
Go catch, no currently was focusing on the parameters, noticed that is was used for both credentials and parameters, and forgot about. I will update
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.
@schristoff Updated, to only allow skipping parameters or credentials that aren't required. Discover that the CNAB bundle has a required parameter for both credentials and paramters. All parameters without a default value is required in the accroding the CNAB bundle.
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.
How do you feel about changing this to passing in an opts ...Options
and those options contain description and required?
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.
@schristoff that could make sense, it would allow us to easily extend the generator with new options over time. My only "concern" is if it is a refactor that gives value long term. I mean how many options would there be? But after the talk about more metadata on credentials it might actually be worth it.
I will update try to update the PR to use options, then we can see how it would look and feel.
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.
If it is too much work to implement - nbd on choosing to move forward with this way.
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.
@schristoff I have updated this PR to use options, what do you think?
Signed-off-by: Kim Christensen <kimworking@gmail.com>
Signed-off-by: Kim Christensen <kimworking@gmail.com>
What does this change
Adds a
skip
option to the prompt allow users to skip parameter and credential generation of specific entries.The prompt will look like this:
What issue does it fix
Closes #3074 and closes #3075
Notes for the reviewer
No tests have been created for this as it requires user interaction
Checklist