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

fix: Report any unknown options found on the command line. #159

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

jvlcek
Copy link
Contributor

@jvlcek jvlcek commented Oct 21, 2024

Card ID: CCT-524

The rhc subcommands, connect, disconnect and status ignore any unknown options given. This PR will fix this by returning an error when any unknown options are found.

The following tests were performed:

Test 1: One unknown argument give.

% sudo  ./rhc connect activation-key 
error: unknown option(s): activation-key 

Test 2: Valid arguments given but unknown arguments were also given. The extra unknown
arguments will produce an error.

% sudo  ./rhc connect --activation-key ${MY_KEY} --organization ${MY_ORG}  bobs your uncle
error: unknown option(s): bobs your uncle 

@Lorquas
Copy link
Member

Lorquas commented Oct 21, 2024

Can one of the admins verify this patch?

@jirihnidek
Copy link
Contributor

/packit build

@jirihnidek jirihnidek self-assigned this Oct 22, 2024
Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I have few requests and suggestions.

util.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
@jvlcek
Copy link
Contributor Author

jvlcek commented Oct 22, 2024

Thank you for the review input @jirihnidek! It's very much appreciated. I actually reflected on this after I submitted it and realized I should dry up the code. Your suggestions are spot on.

I believe I have addressed them in commit: af612bd

and retested the following:

lima% sudo  ./rhc connect activation-key
error: unknown option(s): activation-key

lima% sudo  ./rhc connect --activation-key ${MY_KEY} --organization ${MY_ORG}  bobs your uncle
error: unknown option(s): bobs your uncle

lima% sudo ./rhc status --format foo bar
unsupported format: foo (supported formats: "json")

lima% sudo ./rhc status bobs your uncle
error: unknown option(s): bobs your uncle

Card ID: CCT-524

The rhc subcommands, connect, disconnect and status ignore any
unknown options given. This PR will fix this by returning an
error when any unknown options are found.
@jvlcek
Copy link
Contributor Author

jvlcek commented Oct 22, 2024

@jirihnidek I believe I've addressed all of the changes you have requested. Please let me know what you think now.

Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for updates 👍

@jirihnidek
Copy link
Contributor

/packit build

@jirihnidek jirihnidek merged commit ff9ec60 into RedHatInsights:main Oct 23, 2024
22 of 25 checks passed
@jvlcek
Copy link
Contributor Author

jvlcek commented Oct 23, 2024

Thank you for the help with this @jirihnidek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants