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

feat: CCIE-180 allow running 'fogg init' with flags instead of realtime user prompts #693

Merged

Conversation

hspitzley-czi
Copy link
Contributor

Summary

A description of changes or issues addressed by this PR. Provide links to relevant PRs if any.

Test Plan

Say unittests, or list out steps to verify changes.

References

(Optional) Additional links to provide more context.

@hspitzley-czi hspitzley-czi requested a review from a team as a code owner August 1, 2022 16:17
@hspitzley-czi hspitzley-czi requested a review from alldoami August 1, 2022 16:17
cmd/init.go Outdated Show resolved Hide resolved
cmd/init.go Outdated
return found
}

func userPrompt(cmd *cobra.Command) (string, string, string, string, string, string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after 3 output vars, I usually revert to making a struct because I forget the ordering of the variables, especially when they are all of the same type. It might make it a little cleaner to do something like this:

Suggested change
func userPrompt(cmd *cobra.Command) (string, string, string, string, string, string, error) {
type FoggProject struct {
Project, Region, Bucket, Table, Profile, Owner string
}
func userPrompt(cmd *cobra.Command) (*FoggProject, error) {

and then in error cases you'd do something like

if err != nil {
  return nil, errors.Wrap(err, "a summary of the error")
}

Copy link
Contributor

@jakeyheath jakeyheath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor go conventions

@hspitzley-czi hspitzley-czi merged commit 07010d4 into main Aug 1, 2022
@hspitzley-czi hspitzley-czi deleted the hspitzley/CCIE-180_allow_fogg_init_without_user_prompt branch August 1, 2022 17:44
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.

2 participants