| | |
| | | * properties file, no-prompt etc. These will appear toward the bottom of |
| | | * the usage statement. |
| | | */ |
| | | private final ArgumentGroup ioArgGroup = new ArgumentGroup( |
| | | protected final ArgumentGroup ioArgGroup = new ArgumentGroup( |
| | | INFO_DESCRIPTION_IO_ARGS.get(), Integer.MIN_VALUE + 1); |
| | | |
| | | /** |
| | |
| | | * has already been defined. |
| | | */ |
| | | public void addArgument(final Argument argument) throws ArgumentException { |
| | | addArgument(argument, null); |
| | | } |
| | | |
| | | /** |
| | | * Adds the provided argument to the set of arguments handled by this |
| | | * parser. |
| | | * |
| | | * @param argument |
| | | * The argument to be added. |
| | | * @param group |
| | | * The argument group to which the argument belongs. |
| | | * @throws ArgumentException |
| | | * If the provided argument conflicts with another argument that |
| | | * has already been defined. |
| | | */ |
| | | public void addArgument(final Argument argument, ArgumentGroup group) throws ArgumentException { |
| | | final Character shortID = argument.getShortIdentifier(); |
| | | if (shortID != null && shortIDMap.containsKey(shortID)) { |
| | | final String conflictingName = shortIDMap.get(shortID).getName(); |
| | |
| | | |
| | | argumentList.add(argument); |
| | | |
| | | final ArgumentGroup group = getStandardGroup(argument); |
| | | if (group == null) { |
| | | group = getStandardGroup(argument); |
| | | } |
| | | group.addArgument(argument); |
| | | argumentGroups.add(group); |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * Adds the provided argument to the set of arguments handled by this parser |
| | | * and puts the argument in the default group. |
| | | * |
| | | * @param argument |
| | | * The argument to be added. |
| | | * @throws ArgumentException |
| | | * If the provided argument conflicts with another argument that |
| | | * has already been defined. |
| | | */ |
| | | protected void addDefaultArgument(final Argument argument) throws ArgumentException { |
| | | addArgument(argument, defaultArgGroup); |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether this parser will allow unnamed trailing arguments. |
| | | * These will be arguments at the end of the list that are not preceded by |
| | | * either a long or short identifier and will need to be manually parsed by |
| | |
| | | final Character shortID = a.getShortIdentifier(); |
| | | final String longID = a.getLongIdentifier(); |
| | | if (shortID != null) { |
| | | final int currentLength = buffer.length(); |
| | | |
| | | if (isUsageArgument(a)) { |
| | | buffer.append("-?, "); |
| | | } |
| | |
| | | newBuffer.append(a.getValuePlaceholder()); |
| | | } |
| | | |
| | | final int currentLength = buffer.length(); |
| | | final int lineLength = (buffer.length() - currentLength) + newBuffer.length(); |
| | | if (lineLength > MAX_LINE_WIDTH) { |
| | | buffer.append(EOL); |