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

cli: Option parser checks if empty twice #7387

Closed

Conversation

alvasw
Copy link
Contributor

@alvasw alvasw commented Feb 7, 2025

The OptionSet.hasArgument(...) method [1] already check if the argument is empty.

[1] https://github.com/jopt-simple/jopt-simple/blob/jopt-simple-5.0.4/src/main/java/joptsimple/OptionSet.java#L127

Relates to #7386.

@thecockatiel
Copy link
Contributor

thecockatiel commented Feb 7, 2025

will it return false if an option is passed like --trade-id but no value is given?
edit: sorry, I hadn't check the link yet
this is correct

@thecockatiel
Copy link
Contributor

but somehow if you use = and then specify no value, it returns true, and that's why the test is not passing
so the check is probably necessary

@alvasw
Copy link
Contributor Author

alvasw commented Feb 18, 2025

My bad, the check is needed because "--trigger-price=" is turned into "--trigger-price=""" (empty string after equal sign) before parsing it.

@alvasw alvasw removed this from the v1.9.20 milestone Feb 18, 2025
@alvasw alvasw closed this Feb 18, 2025
@alvasw alvasw deleted the remove_duplicate_option_empty_check branch February 18, 2025 21:56
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