| | |
| | | |
| | | /** The argument that will be used to indicate the file properties. */ |
| | | private StringArgument filePropertiesPathArgument; |
| | | |
| | | /** |
| | | * The argument that will be used to indicate that we'll not look for |
| | | * default properties file. |
| | | */ |
| | | /** The argument that will be used to indicate that we'll not look for default properties file. */ |
| | | private BooleanArgument noPropertiesFileArgument; |
| | | |
| | | /** |
| | | * The argument that will be used to trigger the display of usage |
| | | * information. |
| | | */ |
| | | /** The argument that will be used to trigger the display of usage information. */ |
| | | private Argument usageArgument; |
| | | |
| | | /** |
| | | * The argument that will be used to trigger the display of the OpenDJ |
| | | * version. |
| | | */ |
| | | /** The argument that will be used to trigger the display of the OpenDJ version. */ |
| | | private Argument versionArgument; |
| | | |
| | | /** The set of unnamed trailing arguments that were provided for this parser. */ |
| | |
| | | * the end of the list. |
| | | */ |
| | | private final boolean allowsTrailingArguments; |
| | | |
| | | /** |
| | | * Indicates whether long arguments should be treated in a case-sensitive |
| | | * manner. |
| | | */ |
| | | /** Indicates whether long arguments should be treated in a case-sensitive manner. */ |
| | | private final boolean longArgumentsCaseSensitive; |
| | | |
| | | /** Indicates whether the usage or version information has been displayed. */ |
| | | private boolean usageOrVersionDisplayed; |
| | | /** Indicates whether the version argument was provided. */ |
| | | private boolean versionPresent; |
| | | |
| | | /** The handler to call to print the product version. */ |
| | | private VersionHandler versionHandler = new VersionHandler() { |
| | | @Override |
| | |
| | | * displaying usage information. |
| | | */ |
| | | private final LocalizableMessage toolDescription; |
| | | /** A short description for this tool, suitable in a man page summary line. */ |
| | | private LocalizableMessage shortToolDescription; |
| | | |
| | | /** |
| | | * The display name that will be used for the trailing arguments in the |
| | | * usage information. |
| | | */ |
| | | /** The display name that will be used for the trailing arguments in the usage information. */ |
| | | private final String trailingArgsDisplayName; |
| | | |
| | | /** The raw set of command-line arguments that were provided. */ |
| | |
| | | return toolDescription; |
| | | } |
| | | |
| | | /** |
| | | * A short description for this tool, suitable in a man page summary line. |
| | | */ |
| | | private LocalizableMessage shortToolDescription; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getShortToolDescription() { |
| | | return shortToolDescription != null ? shortToolDescription : LocalizableMessage.EMPTY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setShortToolDescription(final LocalizableMessage shortDescription) { |
| | | this.shortToolDescription = shortDescription; |
| | |
| | | */ |
| | | private DocDescriptionSupplement docToolDescriptionSupplement; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getDocToolDescriptionSupplement() { |
| | | this.docToolDescriptionSupplement = |
| | |
| | | return this.docToolDescriptionSupplement.getDocDescriptionSupplement(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setDocToolDescriptionSupplement(final LocalizableMessage supplement) { |
| | | this.docToolDescriptionSupplement = |
| | |
| | | * intended for use in generated reference documentation. |
| | | */ |
| | | private class DocSubcommandsDescriptionSupplement implements DocDescriptionSupplement { |
| | | /** |
| | | * A supplement to the description intended for use in generated reference documentation. |
| | | */ |
| | | /** A supplement to the description intended for use in generated reference documentation. */ |
| | | private LocalizableMessage docDescriptionSupplement; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getDocDescriptionSupplement() { |
| | | return docDescriptionSupplement != null ? docDescriptionSupplement : LocalizableMessage.EMPTY; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setDocDescriptionSupplement(final LocalizableMessage docDescriptionSupplement) { |
| | | this.docDescriptionSupplement = docDescriptionSupplement; |
| | | } |
| | |
| | | |
| | | private DocDescriptionSupplement docSubcommandsDescriptionSupplement; |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getDocSubcommandsDescriptionSupplement() { |
| | | this.docSubcommandsDescriptionSupplement = |
| | |
| | | return this.docSubcommandsDescriptionSupplement.getDocDescriptionSupplement(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void setDocSubcommandsDescriptionSupplement(final LocalizableMessage supplement) { |
| | | this.docSubcommandsDescriptionSupplement = |
| | |
| | | SortedSet<Argument> sortArguments(final List<Argument> arguments) { |
| | | final SortedSet<Argument> result = new TreeSet<>(new Comparator<Argument>() { |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int compare(final Argument o1, final Argument o2) { |
| | | final String s1 = getIdentifier(o1); |
| | |
| | | String argValue = null; |
| | | final int equalPos = argName.indexOf('='); |
| | | if (equalPos < 0) { |
| | | // This is fine. The value is not part of the argument name |
| | | // token. |
| | | // This is fine. The value is not part of the argument name token. |
| | | } else if (equalPos == 0) { |
| | | // The argument starts with "--=", which is not acceptable. |
| | | throw new ArgumentException(ERR_ARGPARSER_LONG_ARG_WITHOUT_NAME.get(arg)); |
| | | } else { |
| | | // The argument is in the form --name=value, so parse them |
| | | // both out. |
| | | // The argument is in the form --name=value, so parse them both out. |
| | | argValue = argName.substring(equalPos + 1); |
| | | argName = argName.substring(0, equalPos); |
| | | } |
| | | |
| | | // If we're not case-sensitive, then convert the name to |
| | | // lowercase. |
| | | // If we're not case-sensitive, then convert the name to lowercase. |
| | | final String origArgName = argName; |
| | | if (!longArgumentsCaseSensitive) { |
| | | argName = toLowerCase(argName); |
| | |
| | | final Argument a = longIDMap.get(argName); |
| | | if (a == null) { |
| | | if (OPTION_LONG_HELP.equals(argName)) { |
| | | // "--help" will always be interpreted as requesting |
| | | // usage information. |
| | | // "--help" will always be interpreted as requesting usage information. |
| | | writeToUsageOutputStream(getUsage()); |
| | | return; |
| | | } else if (OPTION_LONG_PRODUCT_VERSION.equals(argName)) { |