Esempio n. 1
0
 /** Returns a string to display usage. */
 public String getUsage() {
   StringBuffer usage = new StringBuffer("");
   for (Option o : optsNames.values()) {
     if (o.getHidden()) continue;
     for (int i = 0; i < argMaxLen.size(); ++i) {
       String s = (i < o.getOpts().length) ? o.getOpts()[i] : "";
       int width = argMaxLen.get(i).intValue() + 1;
       String f = String.format(" %-" + width + "s", s);
       usage.append(f).append(" ");
     }
     usage.append(" ").append(o.getDesc()).append("\n");
   }
   return usage.toString();
 }