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 module-config default / value #154
Conversation
davidcheung
commented
Jun 9, 2020
- also adding support for project conditional prompts
internal/context/init.go
Outdated
exit.Fatal("Prompt failed %v\n", err) | ||
func getProjectPrompts(projectName string) map[string]PromptHandler { | ||
return map[string]PromptHandler{ | ||
"projectName": { |
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.
Since it was supplied on the command line we probably don't need to prompt for name. Or maybe we make it optional on the command line and then conditionally prompt 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.
#153 yeah we removed the projectName as a positional argument altogether just a little earlier, ill need to rebase with that change
Label: "What's the root of the github org to create repositories in?", | ||
Default: "github.com/", | ||
}, | ||
KeyMatchCondition("ShouldPushRepoUpstream", "y"), |
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.
Nice implementation
|
||
projectConfig.Name = prompts["projectName"].GetParam(projectConfig.Parameters) | ||
|
||
projectConfig.Parameters["ShouldPushRepoUpstream"] = prompts["ShouldPushRepoUpstream"].GetParam(projectConfig.Parameters) |
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.
You don't need to do this as part of this PR but shouldn't these be part of the projectConfig struct rather than parameters? Parameters are passed into project templates, but these values we will be using for zero itself during the create phase.
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'll do this as part of my ticket.
} | ||
|
||
// TODO: validation / allow prompt retry ...etc | ||
func (p PromptHandler) GetParam(projectParams map[string]string) 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.
Seems like this would be a good one to have a test for, exercising the different types.
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 did, i aliased my git a
to git add . -u
and forgot to index the untracked file 😅 fixed now
ad1f9a1
to
ef5cb76
Compare
- also adding support for project conditional prompts
ef5cb76
to
544ab60
Compare