Ejemplo n.º 1
0
  private void formatOptionNames(List list, SubCommand cmd, StringBuffer buff, String template) {
    for (Iterator i = list.iterator(); i.hasNext(); ) {
      String opt = (String) i.next();
      if (!cmd.isOptionAlias(opt)) {
        Object[] params = {opt, cmd.getShortOptionName(opt)};
        buff.append("\n").append(MessageFormat.format(template, params));
        List aliases = cmd.getOptionAliases(opt);

        if ((aliases != null) && !aliases.isEmpty()) {
          for (Iterator j = aliases.iterator(); j.hasNext(); ) {
            String alias = (String) j.next();
            String[] p = {alias, cmd.getShortOptionName(alias)};
            buff.append(",").append(MessageFormat.format(template, (Object[]) p));
          }
        }
      }
    }
  }
Ejemplo n.º 2
0
  private void formatOption(
      StringBuffer buff,
      String opt,
      List aliases,
      SubCommand cmd,
      String format,
      String aliasFormat) {
    Object[] params = {opt, cmd.getShortOptionName(opt), cmd.getOptionDescription(opt)};
    buff.append(MessageFormat.format(aliasFormat, params));
    int sz = aliases.size();

    for (int i = 0; i < sz; i++) {
      String alias = (String) aliases.get(i);
      Object[] p = {alias, cmd.getShortOptionName(alias), cmd.getOptionDescription(alias)};
      if (i == (sz - 1)) {
        buff.append(MessageFormat.format(format, p));
      } else {
        buff.append(MessageFormat.format(aliasFormat, p));
      }
    }

    buff.append("\n");
  }
Ejemplo n.º 3
0
 private void formatOption(StringBuffer buff, String opt, SubCommand cmd, String format) {
   Object[] params = {opt, cmd.getShortOptionName(opt), cmd.getOptionDescription(opt)};
   buff.append(MessageFormat.format(format, params));
   buff.append("\n");
 }