-
Notifications
You must be signed in to change notification settings - Fork 263
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
fix(core): generic solution for issue #111 for all command groups #218
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maximilien 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 |
/assign @cppforlife cc: @rhuss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works better than v1 fix of the issue.
@maximilien :
- Can we separate the help section and error message printed with a line please? helps make error message more visible / readable.
- I tested PR by running
./hack/build.sh
, its reporting updates to command docs filesdocs/cmd/kn_revision.md
anddocs/cmd/kn_service.md
as well, lets also include that with the PR. - Can we add some tests please?
I think @maximilien wants just to wait with tests until with which testing setup we want to continue. So let's wait until tomorrows WG meeting. |
bc3484e
to
0abdb7d
Compare
97bd1b4
to
bba7abb
Compare
OK @rhuss, I think I am convinced I added a test for cc: @navidshaikh and @cppforlife |
0c2141a
to
8db55d0
Compare
@maximilien I think you missed to check in the vendored files (use a The PR looks good to me, let's merge it tomorrow if there are no objections against gotest.tools in today's WG call. |
Yes, done, thanks @rhuss, one day I will remember to do this before pushing :) Converting all ginkgo tests now. Best. |
Explores all sub-commands from root and adds a RunE for all commands that are groups with child commands and without a RunE. The added RunE will return the correct errors when the command is called with empty sub-command or with an unknown sub-command. It will also print the command help message first. Added a gotest.tools test for root.go.
The following is the coverage report on pkg/.
|
/lgtm |
@maximilien cool, thanks ! Now that gotest.tools is in, we have to rebase our other PRs which introduce them (but should be hopefully trivial) |
BFS exploration of all sub-commands from
rootCmd
and adds aRunE
for all commands that are command groups with child sub-commands and without aRunE
.The added
RunE
will return the correct errors when the command is called with empty sub-command or with an unknown sub-command. It will also print the command help message first.I did not add a test for this since the we need to decide on #185 and #214 and #134. Once we do I will add the gotest.tools or Ginkgo test for it.