You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "cstamas (via GitHub)" <gi...@apache.org> on 2025/06/09 16:51:24 UTC
[PR] Make method possible override [commons-cli]
cstamas opened a new pull request, #379:
URL: https://github.com/apache/commons-cli/pull/379
Simpler variation of #378
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add new options for parsing: ignore and skip [commons-cli]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #379:
URL: https://github.com/apache/commons-cli/pull/379#issuecomment-2960769588
TY @cstamas, merged!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make method possible to override [commons-cli]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on code in PR #379:
URL: https://github.com/apache/commons-cli/pull/379#discussion_r2137683423
##########
src/main/java/org/apache/commons/cli/DefaultParser.java:
##########
@@ -711,11 +764,29 @@ public CommandLine parse(final Options options, final String[] arguments, final
*
* @return the list of atomic option and value tokens
* @throws ParseException if there are any problems encountered while parsing the command line tokens.
+ * @see #parse(Options, String[], Properties, NonOptionAction)
*/
public CommandLine parse(final Options options, final String[] arguments, final Properties properties, final boolean stopAtNonOption)
throws ParseException {
+ return parse(options, arguments, properties, stopAtNonOption ? NonOptionAction.STOP : NonOptionAction.THROW);
+ }
+
+ /**
+ * Parses the arguments according to the specified options and properties.
+ *
+ * @param options the specified Options
+ * @param arguments the command line arguments
+ * @param properties command line option name-value pairs
+ * @param nonOptionAction see {@link NonOptionAction}.
+ *
+ * @return the list of atomic option and value tokens
+ * @throws ParseException if there are any problems encountered while parsing the command line tokens.
+ * @since 1.10.0
+ */
+ public CommandLine parse(final Options options, final String[] arguments, final Properties properties, final NonOptionAction nonOptionAction)
Review Comment:
If we add an API, this could be an opportunity to simplify call sites to use variable arguments:
```
public CommandLine parse(final Options options, final Properties properties, final NonOptionAction nonOptionAction, final String... arguments)
```
WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add new options for parsing: ignore and skip [commons-cli]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on PR #379:
URL: https://github.com/apache/commons-cli/pull/379#issuecomment-2960254024
> I don't see tests for the enum value `STOP` but we see new tests that use the other enum values.
The new `legacyStopAtNonOption` uses it implicitly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make method possible to override [commons-cli]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on code in PR #379:
URL: https://github.com/apache/commons-cli/pull/379#discussion_r2137696844
##########
src/main/java/org/apache/commons/cli/DefaultParser.java:
##########
@@ -711,11 +764,29 @@ public CommandLine parse(final Options options, final String[] arguments, final
*
* @return the list of atomic option and value tokens
* @throws ParseException if there are any problems encountered while parsing the command line tokens.
+ * @see #parse(Options, String[], Properties, NonOptionAction)
*/
public CommandLine parse(final Options options, final String[] arguments, final Properties properties, final boolean stopAtNonOption)
throws ParseException {
+ return parse(options, arguments, properties, stopAtNonOption ? NonOptionAction.STOP : NonOptionAction.THROW);
+ }
+
+ /**
+ * Parses the arguments according to the specified options and properties.
+ *
+ * @param options the specified Options
+ * @param arguments the command line arguments
+ * @param properties command line option name-value pairs
+ * @param nonOptionAction see {@link NonOptionAction}.
+ *
+ * @return the list of atomic option and value tokens
+ * @throws ParseException if there are any problems encountered while parsing the command line tokens.
+ * @since 1.10.0
+ */
+ public CommandLine parse(final Options options, final String[] arguments, final Properties properties, final NonOptionAction nonOptionAction)
Review Comment:
Sounds reasonable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add new options for parsing: ignore and skip [commons-cli]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #379:
URL: https://github.com/apache/commons-cli/pull/379#issuecomment-2960777134
@cstamas
When do you need a release?
Is there anything else you'd like to contribute before that?
TY!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make method possible to override [commons-cli]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory commented on PR #379:
URL: https://github.com/apache/commons-cli/pull/379#issuecomment-2956762344
I'll review/merge and so on in a few hours...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add new options for parsing: ignore and skip [commons-cli]
Posted by "garydgregory (via GitHub)" <gi...@apache.org>.
garydgregory merged PR #379:
URL: https://github.com/apache/commons-cli/pull/379
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make method possible to override [commons-cli]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on PR #379:
URL: https://github.com/apache/commons-cli/pull/379#issuecomment-2956690072
Thanks for checking it out. Pushed tests and some more changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Make method possible to override [commons-cli]
Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on PR #379:
URL: https://github.com/apache/commons-cli/pull/379#issuecomment-2958302850
> I'm somewhat confused - unsurprising 😉 - as to what some combinations mean.
I got too, as IMHO not all combos of booleans made sense, so I switched to enum.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org