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

Remove Printing Err When Running Root Command #615

Merged
merged 1 commit into from
Jan 21, 2020

Conversation

danielhelfand
Copy link
Contributor

Fixes #612

Proposed Changes

  • Remove printing err when running kn root command

Release

Fix subcommand is required error from showing when running kn by itself

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jan 21, 2020
@knative-prow-robot knative-prow-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 21, 2020
@knative-prow-robot
Copy link
Contributor

Hi @danielhelfand. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@danielhelfand danielhelfand changed the title remove printing err when running root command Remove Printing Err When Running Root Command Jan 21, 2020
Copy link
Collaborator

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

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

/ok-to-test
/lgtm
/approve

@knative-prow-robot knative-prow-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jan 21, 2020
@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 21, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: danielhelfand, navidshaikh

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 21, 2020
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2020
@@ -34,10 +34,12 @@ func main() {
defer cleanup()
rand.Seed(time.Now().UnixNano())
err = core.NewDefaultKnCommand().Execute()
if err != nil {
fmt.Fprintln(os.Stderr, err)
if err.Error() == "subcommand is required" {
os.Exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry - didn't have time to try this myself (stuck in calls), but if we immediately exit w/o printing anything, what does the user see?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just want to make sure we're not exiting w/o some indication of what went wrong so the user can fix it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, in the most recent push, the only Error() ignored is subcommand is required, which is occurring when you run kn by itself. So running kn will result in the following:

Manage your Knative building blocks:

* Serving: Manage your services and release new software to them.
* Eventing: Manage event subscriptions and channels. Connect up event sources.

Usage:
  kn [command]

Available Commands:
  completion  Output shell completion code
  help        Help about any command
  plugin      Plugin command group
  revision    Revision command group
  route       Route command group
  service     Service command group
  source      Event source command group
  trigger     Trigger command group
  version     Prints the client version

Flags:
      --config string        kn config file (default is $HOME/.kn/config.yaml)
  -h, --help                 help for kn
      --kubeconfig string    kubectl config file (default is $HOME/.kube/config)
      --log-http             log http traffic
      --lookup-plugins       look for kn plugins in $PATH
      --plugins-dir string   kn plugins directory (default "~/.kn/plugins")

Use "kn [command] --help" for more information about a command.

If the error is not subcommand is required, this approach should still print the error as originally implemented.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok thanks.

@navidshaikh
Copy link
Collaborator

/retest

@navidshaikh
Copy link
Collaborator

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 21, 2020
@knative-prow-robot knative-prow-robot merged commit a56afab into knative:master Jan 21, 2020
coryrc pushed a commit to coryrc/client that referenced this pull request May 14, 2020
* Create presubmit jobs for knative/client

Also enable tide for the new repo.

* Add the missing coverage job/tabs

This is a workaround for knative#615.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

subcommand is required Message When Using kn Root Command
5 participants