@ Override public boolean parseArguments ( final PrintStream messageStream , String [ ] args ) { final OptionSet parsedArguments ; final OptionParser parser = getOptionParser ( ) ; try { // Preprocess the arguments before the parser sees them, replacing any tagged options // and their values with raw option names and surrogate key values, so that tagged // options can be recognized by the parser. The actual values will be retrieved using // the key when the fields's values are set. parsedArguments = parser . parse ( tagParser . preprocessTaggedOptions ( args ) ) ; } catch ( final OptionException e ) { throw new CommandLineException ( e . getMessage ( ) ) ; } // Check if special short circuiting arguments were set if ( isSpecialFlagSet ( parsedArguments , SpecialArgumentsCollection . HELP_FULLNAME ) ) { messageStream . print ( usage ( true , isSpecialFlagSet ( parsedArguments , SpecialArgumentsCollection . SHOW_HIDDEN_FULLNAME ) ) ) ; return false ; } else if ( isSpecialFlagSet ( parsedArguments , SpecialArgumentsCollection . VERSION_FULLNAME ) ) { messageStream . println ( getVersion ( ) ) ; return false ; } else if ( parsedArguments . has ( SpecialArgumentsCollection . ARGUMENTS_FILE_FULLNAME ) ) { // If a special arguments file was specified, read arguments from it and recursively call parseArguments() final List < String > newArgs = expandFromArgumentFile ( parsedArguments ) ; if ( ! newArgs . isEmpty ( ) ) { // If we've expanded any argument files, we need to do another pass on the entire list post-expansion, // so clear any tag surrogates created in this pass (they'll be regenerated in the next pass). tagParser . resetTagSurrogates ( ) ; newArgs . addAll ( Arrays . asList ( args ) ) ; return parseArguments ( messageStream , newArgs . toArray ( new String [ newArgs . size ( ) ] ) ) ; } } return propagateParsedValues ( parsedArguments ) ; }
Parse command - line arguments and store values in callerArguments object passed to ctor .