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

Global flag refactor #792

Merged
merged 1 commit into from
Sep 12, 2019
Merged

Global flag refactor #792

merged 1 commit into from
Sep 12, 2019

Conversation

kensipe
Copy link
Member

@kensipe kensipe commented Sep 10, 2019

What type of PR is this?
/component kudoctl
/kind cleanup

What this PR does / why we need it:
It was decided that we want to remove --repo out of globals
@gerred and I discussed adding --namespace into globals

There is some refactored code to support the changes

Which issue(s) this PR fixes:
Fixes #760

Special notes for your reviewer:
Think about creating a common struct for repo needs and having a function that will add those details to flags.

Does this PR introduce a user-facing change?:

NONE

@kensipe
Copy link
Member Author

kensipe commented Sep 11, 2019

/retest

@kensipe
Copy link
Member Author

kensipe commented Sep 11, 2019

looks like it fails on ci.. but integration-tests work fine locally... I'll dig in tomorrow.

Copy link
Contributor

@zen-dog zen-dog left a comment

Choose a reason for hiding this comment

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

Nice work! 🚢

@@ -34,16 +34,14 @@ var (
)

type options struct {
install.RepositoryOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice usage of embedded types. Out of curiosity: what is your reasoning to embed a struct vs. making it a field e.g. Repo install.RepositoryOptions?

Copy link
Member Author

Choose a reason for hiding this comment

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

this example is too simple to see it yet... but the flatter structure is easy to work with (although involves some magic:( ). I was thinking of having grouping of common options (for instance options needed for working with repos, options needed for working with k8s). Then embed those options into the options for your command. I was further thinking of having a function for each of these structs for flag setup... thereby guaranteeing that cli messages are consistent. This would result in outer structure function calling the inner... I'm not sure if it adds too much complexity for what it gains. thoughts welcome 🙏

Copy link
Member

Choose a reason for hiding this comment

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

Yep, this makes sense.

@@ -34,16 +34,14 @@ var (
)

type options struct {
install.RepositoryOptions
Copy link
Member

Choose a reason for hiding this comment

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

Yep, this makes sense.

@kudo-ci
Copy link

kudo-ci commented Sep 12, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gerred, kensipe, zen-dog

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kensipe
Copy link
Member Author

kensipe commented Sep 12, 2019

/retest

@kensipe kensipe merged commit d895faf into master Sep 12, 2019
@kudo-ci kudo-ci deleted the ken/global-env branch September 12, 2019 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move Global Flags to Specific Cmds that Need them
4 participants