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

Add target flags to target view command #289

Merged
merged 3 commits into from
May 11, 2023

Conversation

petersutter
Copy link
Member

What this PR does / why we need it:
This PR adds target flags to the target view command.

This is beneficial when gardenctl is used within a script, and the script needs to determine the current target while also taking the target flags into account.

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

Special notes for your reviewer:

Release note:

The `target` `view` command (alias `gtv`) now also considers the target flags

@petersutter petersutter added the area/ipcei IPCEI (Important Project of Common European Interest) label May 5, 2023
@petersutter petersutter requested a review from a team as a code owner May 5, 2023 08:13
@gardener-robot gardener-robot added needs/review Needs review size/s Size of pull request is small (see gardener-robot robot/bots/size.py) labels May 5, 2023
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label May 5, 2023
@gardener-robot-ci-2 gardener-robot-ci-2 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels May 5, 2023
@petersutter petersutter force-pushed the enh/target/view/support-target-flags branch from fdd8d9d to 555b7c0 Compare May 5, 2023 08:31
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels May 5, 2023
@petersutter petersutter force-pushed the enh/target/view/support-target-flags branch from 555b7c0 to 0e2cd38 Compare May 9, 2023 17:54
@gardener-robot-ci-3 gardener-robot-ci-3 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label May 9, 2023
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label May 9, 2023
@@ -35,6 +36,9 @@ func NewCmdView(f util.Factory, ioStreams util.IOStreams) *cobra.Command {

o.AddFlags(cmd.Flags())

f.TargetFlags().AddFlags(cmd.Flags())
flags.RegisterCompletionFuncsForTargetFlags(cmd, f, ioStreams, cmd.Flags())
Copy link
Member

Choose a reason for hiding this comment

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

Not related to this PR but why do we pass the flagset to this function. It is not used. The flags must already be registered. And I think it was a very bad idea to name this package flags which always create a name conflict if you want to have variable named flags. I anyway think it should be part of the same package the TargetFlags belongs to.

Copy link
Member Author

Choose a reason for hiding this comment

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

true, I have created an issue for it #296

Copy link
Member

@holgerkoser holgerkoser left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/review Needs review labels May 10, 2023
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label May 10, 2023
@petersutter petersutter requested a review from grolu May 10, 2023 09:58
@petersutter petersutter merged commit 291dfaa into master May 11, 2023
@petersutter petersutter deleted the enh/target/view/support-target-flags branch May 11, 2023 12:08
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ipcei IPCEI (Important Project of Common European Interest) needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) reviewed/lgtm Has approval for merging reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) size/s Size of pull request is small (see gardener-robot robot/bots/size.py) status/closed Issue is closed (either delivered or triaged)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Target view command should also consider target flags
6 participants