| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
package joptsimple; |
| 7 | |
|
| 8 | |
import java.util.List; |
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
class RequiredArgumentOptionSpec extends ArgumentAcceptingOptionSpec { |
| 18 | |
RequiredArgumentOptionSpec( String option ) { |
| 19 | 96 | super( option, true ); |
| 20 | 96 | } |
| 21 | |
|
| 22 | |
RequiredArgumentOptionSpec( List options, String description ) { |
| 23 | 138 | super( options, true, description ); |
| 24 | 138 | } |
| 25 | |
|
| 26 | |
protected void detectOptionArgument( OptionParser parser, ArgumentList arguments, |
| 27 | |
OptionSet detectedOptions ) { |
| 28 | |
|
| 29 | 98 | if ( !arguments.hasMore() ) |
| 30 | 4 | throw new OptionMissingRequiredArgumentException( options() ); |
| 31 | |
|
| 32 | 94 | addArguments( detectedOptions, arguments.next() ); |
| 33 | 90 | } |
| 34 | |
|
| 35 | |
void accept( OptionSpecVisitor visitor ) { |
| 36 | 28 | visitor.visit( this ); |
| 37 | 28 | } |
| 38 | |
} |