/** * Parses the given command line arguments according to the option specifications given to the parser. * * @param arguments arguments to parse * @return an {@link OptionSet} describing the parsed options, their arguments, and any non-option arguments found * @throws OptionException if problems are detected while parsing * @throws NullPointerException if the argument list is {@code null} */ public OptionSet parse( String... arguments ) { ArgumentList argumentList = new ArgumentList( arguments ); OptionSet detected = new OptionSet( defaultValues() ); while ( argumentList.hasMore() ) state.handleArgument( this, argumentList, detected ); reset(); ensureRequiredOptions( detected ); return detected; }
/** * Parses the given command line arguments according to the option specifications given to the parser. * * @param arguments arguments to parse * @return an {@link OptionSet} describing the parsed options, their arguments, and any non-option arguments found * @throws OptionException if problems are detected while parsing * @throws NullPointerException if the argument list is {@code null} */ public OptionSet parse( String... arguments ) { ArgumentList argumentList = new ArgumentList( arguments ); OptionSet detected = new OptionSet( defaultValues() ); while ( argumentList.hasMore() ) state.handleArgument( this, argumentList, detected ); reset(); ensureRequiredOptions( detected ); return detected; }
/** * Parses the given command line arguments according to the option specifications given to the parser. * * @param arguments arguments to parse * @return an {@link OptionSet} describing the parsed options, their arguments, and any non-option arguments found * @throws OptionException if problems are detected while parsing * @throws NullPointerException if the argument list is {@code null} */ public OptionSet parse( String... arguments ) { ArgumentList argumentList = new ArgumentList( arguments ); OptionSet detected = new OptionSet( defaultValues() ); while ( argumentList.hasMore() ) state.handleArgument( this, argumentList, detected ); reset(); ensureRequiredOptions( detected ); return detected; }
/** * Parses the given command line arguments according to the option specifications given to the parser. * * @param arguments arguments to parse * @return an {@link OptionSet} describing the parsed options, their arguments, and any non-option arguments found * @throws OptionException if problems are detected while parsing * @throws NullPointerException if the argument list is {@code null} */ public OptionSet parse( String... arguments ) { ArgumentList argumentList = new ArgumentList( arguments ); OptionSet detected = new OptionSet( recognizedOptions.toJavaUtilMap() ); detected.add( recognizedOptions.get( NonOptionArgumentSpec.NAME ) ); while ( argumentList.hasMore() ) state.handleArgument( this, argumentList, detected ); reset(); ensureRequiredOptions( detected ); ensureAllowedOptions( detected ); return detected; }
/** * Parses the given command line arguments according to the option specifications given to the parser. * * @param arguments arguments to parse * @return an {@link OptionSet} describing the parsed options, their arguments, and any non-option arguments found * @throws OptionException if problems are detected while parsing * @throws NullPointerException if the argument list is {@code null} */ public OptionSet parse( String... arguments ) { ArgumentList argumentList = new ArgumentList( arguments ); OptionSet detected = new OptionSet( recognizedOptions.toJavaUtilMap() ); detected.add( recognizedOptions.get( NonOptionArgumentSpec.NAME ) ); while ( argumentList.hasMore() ) state.handleArgument( this, argumentList, detected ); reset(); ensureRequiredOptions( detected ); ensureAllowedOptions( detected ); return detected; }