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

When typing odo foobar --help should error out with invalid command #5813

Merged
merged 2 commits into from
Jun 21, 2022

Conversation

cdrage
Copy link
Member

@cdrage cdrage commented Jun 10, 2022

What type of PR is this:

/kind bug

What does this PR do / why we need it:

When we type:

odo foobar --help

We should error out that it's an invalid command.

Which issue(s) this PR fixes:

Fixes #5439

PR acceptance criteria:

  • Integration test

How to test changes / Special notes to the reviewer:

Signed-off-by: Charlie Drage [email protected]

@netlify
Copy link

netlify bot commented Jun 10, 2022

Deploy Preview for odo-docusaurus-preview ready!

Name Link
🔨 Latest commit 14cf438
🔍 Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/62b1b898011c050008003bc1
😎 Deploy Preview https://deploy-preview-5813--odo-docusaurus-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 10, 2022
@openshift-ci openshift-ci bot requested review from feloy and valaparthvi June 10, 2022 13:59
@odo-robot
Copy link

odo-robot bot commented Jun 10, 2022

Unit Tests on commit f36c8d4 finished successfully.
View logs: TXT HTML

@valaparthvi
Copy link
Contributor

/approve

@openshift-ci
Copy link

openshift-ci bot commented Jun 10, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: valaparthvi

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. Required by Prow. label Jun 10, 2022
@odo-robot
Copy link

odo-robot bot commented Jun 11, 2022

OpenShift Tests on commit f36c8d4 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jun 11, 2022

Kubernetes Tests on commit f36c8d4 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jun 11, 2022

Windows Tests (OCP) on commit f36c8d4 finished successfully.
View logs: TXT HTML

@odo-robot
Copy link

odo-robot bot commented Jun 11, 2022

Validate Tests on commit f36c8d4 finished successfully.
View logs: TXT HTML

rootCmd.SetHelpFunc(func(command *cobra.Command, args []string) {
// Simple way of checking to see if the command has a parent (if it doesn't, it does not exist)
if !command.HasParent() && len(args) > 0 {
fmt.Printf("unknown command '%s', type --help for a list of all commands\n", args[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

You should print in stderr instead

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jun 20, 2022
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. Required by Prow. label Jun 20, 2022
cdrage added 2 commits June 21, 2022 08:24
<!--
Thank you for opening a PR! Here are some things you need to know before submitting:

1. Please read our developer guideline: https://github.com/redhat-developer/odo/wiki/Dev:-odo-Dev-Guidelines
2. Label this PR accordingly with the '/kind' line
3. Ensure you have written and ran the appropriate tests: https://github.com/redhat-developer/odo/wiki/Dev:-Writing-and-running-tests
4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/Pull-Requests:-Review-guideline

Documentation:

If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Documentation:-Contributing
-->

**What type of PR is this:**

<!--
Add one of the following kinds:
/kind feature
/kind cleanup
/kind tests
/kind documentation

Feel free to use other [labels](https://github.com/redhat-developer/odo/labels) as needed. However one of the above labels must be present or the PR will not be reviewed. This instruction is for reviewers as well.
-->

/kind bug

**What does this PR do / why we need it:**

When we type:
```sh
odo foobar --help
```

We should error out that it's an invalid command.

**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->

Fixes redhat-developer#5439

**PR acceptance criteria:**

- [X] Integration test

**How to test changes / Special notes to the reviewer:**

Signed-off-by: Charlie Drage <[email protected]>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.5% 0.5% Duplication

@feloy
Copy link
Contributor

feloy commented Jun 21, 2022

/lgtm

/override ci/prow/unit
/override ci/prow/v4.10-integration-e2e

@openshift-ci
Copy link

openshift-ci bot commented Jun 21, 2022

@feloy: Overrode contexts on behalf of feloy: ci/prow/unit, ci/prow/v4.10-integration-e2e

In response to this:

/lgtm

/override ci/prow/unit
/override ci/prow/v4.10-integration-e2e

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.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. Required by Prow. label Jun 21, 2022
@openshift-ci openshift-ci bot merged commit b8164cf into redhat-developer:main Jun 21, 2022
cdrage added a commit to cdrage/odo that referenced this pull request Aug 31, 2022
…edhat-developer#5813)

* When typing odo foobar --help should error out with invalid command

<!--
Thank you for opening a PR! Here are some things you need to know before submitting:

1. Please read our developer guideline: https://github.com/redhat-developer/odo/wiki/Dev:-odo-Dev-Guidelines
2. Label this PR accordingly with the '/kind' line
3. Ensure you have written and ran the appropriate tests: https://github.com/redhat-developer/odo/wiki/Dev:-Writing-and-running-tests
4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/Pull-Requests:-Review-guideline

Documentation:

If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Documentation:-Contributing
-->

**What type of PR is this:**

<!--
Add one of the following kinds:
/kind feature
/kind cleanup
/kind tests
/kind documentation

Feel free to use other [labels](https://github.com/redhat-developer/odo/labels) as needed. However one of the above labels must be present or the PR will not be reviewed. This instruction is for reviewers as well.
-->

/kind bug

**What does this PR do / why we need it:**

When we type:
```sh
odo foobar --help
```

We should error out that it's an invalid command.

**Which issue(s) this PR fixes:**
<!--
Specifying the issue will automatically close it when this PR is merged
-->

Fixes redhat-developer#5439

**PR acceptance criteria:**

- [X] Integration test

**How to test changes / Special notes to the reviewer:**

Signed-off-by: Charlie Drage <[email protected]>

* Send message to stderr
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. Required by Prow. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. Required by Prow.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

odo <invalid_command> --help should result in an error
3 participants