mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
03.58.2008 5eb6573e3292d012f0490a55f4957009372c476c
Fix for issue 2809 (Missing option -V in cli usage)

Update the definition of the version argument and use the short identifier if there is no other argument using it.
2 files modified
30 ■■■■ changed files
opends/src/messages/messages/core.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/args/ArgumentParser.java 28 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/core.properties
@@ -587,8 +587,6 @@
INFO_DSCORE_DESCRIPTION_CONFIG_FILE_282=Path to the file \
 containing the information needed by the configuration handler to obtain the \
 Directory Server configuration
INFO_DSCORE_DESCRIPTION_VERSION_283=Display Directory Server version \
 information
INFO_DSCORE_DESCRIPTION_FULLVERSION_284=Display extended Directory Server \
 version information
INFO_DSCORE_DESCRIPTION_SYSINFO_285=Display general system information
opends/src/server/org/opends/server/util/args/ArgumentParser.java
@@ -79,6 +79,10 @@
  // 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 OpenDS
  // version.
  private Argument versionArgument;
  // The set of unnamed trailing arguments that were provided for this parser.
  private ArrayList<String> trailingArguments;
@@ -610,6 +614,24 @@
      throw new ArgumentException(message);
    }
    if (versionArgument != null)
    {
      if (shortID == versionArgument.getShortIdentifier())
      {
        // Update the version argument to not display its short identifier.
        try {
          versionArgument = new BooleanArgument(
                  OPTION_LONG_PRODUCT_VERSION,
                  null,
                  OPTION_LONG_PRODUCT_VERSION,
                  INFO_DESCRIPTION_PRODUCT_VERSION.get());
          this.generalArgGroup.addArgument(versionArgument);
        } catch (ArgumentException e) {
          // ignore
        }
      }
    }
    String longID = argument.getLongIdentifier();
    if (longID != null)
    {
@@ -1700,12 +1722,12 @@
    this.argumentGroups.add(ioArgGroup);
    try {
      Argument version = new BooleanArgument(
      versionArgument = new BooleanArgument(
              OPTION_LONG_PRODUCT_VERSION,
              null,
              OPTION_SHORT_PRODUCT_VERSION,
              OPTION_LONG_PRODUCT_VERSION,
              INFO_DESCRIPTION_PRODUCT_VERSION.get());
      this.generalArgGroup.addArgument(version);
      this.generalArgGroup.addArgument(versionArgument);
    } catch (ArgumentException e) {
      // ignore
    }