File tree Expand file tree Collapse file tree
src/main/java/org/apache/commons/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -558,7 +558,7 @@ private void handleToken(final String token) throws ParseException {
558558 if (token != null ) {
559559 currentToken = token ;
560560 if (skipParsing ) {
561- cmd . addArg (token );
561+ addArg (token );
562562 } else if ("--" .equals (token )) {
563563 skipParsing = true ;
564564 } else if (currentOption != null && currentOption .acceptsArg () && isArgument (token )) {
@@ -588,12 +588,22 @@ protected void handleUnknownToken(final String token) throws ParseException {
588588 if (token .startsWith ("-" ) && token .length () > 1 && !stopAtNonOption ) {
589589 throw new UnrecognizedOptionException ("Unrecognized option: " + token , token );
590590 }
591- cmd . addArg (token );
591+ addArg (token );
592592 if (stopAtNonOption ) {
593593 skipParsing = true ;
594594 }
595595 }
596596
597+ /**
598+ * Adds token to command line {@link CommandLine#addArg(String)}.
599+ *
600+ * @param token the unrecognized option/argument.
601+ * @since 1.10.0
602+ */
603+ protected void addArg (final String token ) {
604+ cmd .addArg (token );
605+ }
606+
597607 /**
598608 * Tests if the token is a valid argument.
599609 *
You can’t perform that action at this time.
0 commit comments