Beispiel #1
0
  @Override
  public void visitSynopsisOption(OptionModel<?> option) {
    // TODO Should probably be using req=plain

    hadOptions = true;
    String argTag = "arg";
    final ArgumentModel<?> argument = option.getArgument();
    if (argument.getMultiplicity().isRequired()) {
      argTag += " choice=\"req\"";
    } else {
      argTag += " choice=\"opt\"";
    }

    docbook.open(argTag);

    if (option.getLongName() != null) {
      longOptionSynopsis(option);
      if (option.getArgumentType() == ArgumentType.REQUIRED) {
        docbook.text("=");
        multiplicity(argument, argument.getName());
      } else if (option.getArgumentType() == ArgumentType.OPTIONAL) {
        docbook.text("[=");
        multiplicity(argument, argument.getName());
        docbook.text("]");
      }
    } else {
      shortOptionSynopsis(option);
      if (option.getArgumentType() == ArgumentType.REQUIRED) {
        multiplicity(argument, argument.getName());
      }
    }

    docbook.close("arg").text("\n");
  }
Beispiel #2
0
  @Override
  public void visitSynopsisArgument(ArgumentModel<?> argument) {
    // <arg choice="opt">--out=REPO</arg>
    if (!hadFirstArgument) {
      docbook.open("arg choice=\"opt\"").text("--").close("arg").text("\n");
      hadFirstArgument = true;
    }

    String argTag = "arg";
    if (argument.getMultiplicity().isRequired()) {
      argTag += " choice=\"req\"";
    } else {
      argTag += " choice=\"opt\"";
    }

    if (argument.getMultiplicity().isMultivalued()) {
      argTag += " rep=\"repeat\"";
    }
    docbook.open(argTag).text(argument.getName()).close("arg").text("\n");
  }
Beispiel #3
0
 private void multiplicity(ArgumentModel<?> argument, String name) {
   docbook.open("replaceable").text(name).close("replaceable");
   if (argument.getMultiplicity().isMultivalued()) {
     docbook.text("...");
   }
 }