Esempio n. 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");
  }
Esempio n. 2
0
 private void shortOptionSynopsis(OptionModel<?> option) {
   docbook.text("-" + option.getShortName());
 }
Esempio n. 3
0
 private void longOptionSynopsis(OptionModel<?> option) {
   docbook.text("--" + option.getLongName());
 }