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

silence usage when required flag is not passed #86693

Merged
merged 1 commit into from Jan 2, 2020

Conversation

@sallyom
Copy link
Contributor

sallyom commented Dec 28, 2019

What type of PR is this?

/kind cleanup

What this PR does / why we need it:
Instead of printing the usage menu, only print the error message when a user does not provide a required flag. Usage menus are long, user should only see the required flag message.

Does this PR introduce a user-facing change?:

If a required flag is not provided to a command, the user will only see the required flag error message, instead of the entire usage menu.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@sallyom

This comment has been minimized.

Copy link
Contributor Author

sallyom commented Dec 28, 2019

/cc @soltysh

@k8s-ci-robot k8s-ci-robot requested a review from soltysh Dec 28, 2019
@k8s-ci-robot k8s-ci-robot requested review from dixudx and eparis Dec 28, 2019
@@ -45,6 +45,7 @@ func ActsAsRootCommand(cmd *cobra.Command, filters []string, groups ...CommandGr
Filtered: filters,
}
cmd.SetFlagErrorFunc(templater.FlagErrorFunc())
cmd.SilenceUsage = true

This comment has been minimized.

Copy link
@drsantos20

drsantos20 Dec 29, 2019

hi, @sallyom do we have a test for this change?

This comment has been minimized.

Copy link
@soltysh

soltysh Jan 2, 2020

Contributor

@sallyom good point, make sure to add one covering this fix and the one from #82423 in a follow up PR.

@soltysh
soltysh approved these changes Jan 2, 2020
Copy link
Contributor

soltysh left a comment

/lgtm
/approve

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Jan 2, 2020

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sallyom, soltysh

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

@fejta-bot

This comment has been minimized.

Copy link

fejta-bot commented Jan 2, 2020

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit c72d5fd into kubernetes:master Jan 2, 2020
15 checks passed
15 checks passed
cla/linuxfoundation sallyom authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-dependencies Job succeeded.
Details
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-kind Job succeeded.
Details
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-node-e2e-containerd Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
tide In merge pool.
Details
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.