Skip to content
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

Merged
merged 1 commit into from Jun 9, 2020
Merged

Conversation

davidcheung
Copy link
Contributor

  • also adding support for project conditional prompts

@davidcheung davidcheung requested a review from bmonkman June 9, 2020 17:31
exit.Fatal("Prompt failed %v\n", err)
func getProjectPrompts(projectName string) map[string]PromptHandler {
return map[string]PromptHandler{
"projectName": {
Copy link
Member

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?

Copy link
Contributor Author

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"),
Copy link
Member

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)
Copy link
Member

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.

Copy link
Member

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 {
Copy link
Member

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.

Copy link
Contributor Author

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

@davidcheung davidcheung force-pushed the prompt-default branch 3 times, most recently from ad1f9a1 to ef5cb76 Compare June 9, 2020 20:04
- also adding support for project conditional prompts
@davidcheung davidcheung merged commit a09ffcf into master Jun 9, 2020
@davidcheung davidcheung deleted the prompt-default branch June 9, 2020 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants