Esempio n. 1
0
  protected void usage(ParseException e, boolean showHiddenOptions) {
    if (e != null) {
      System.err.println("Error parsing command line arguments: " + e.getMessage());
    }

    Options opts = showHiddenOptions ? getAllOptions() : mOptions;
    PrintWriter pw = new PrintWriter(System.err, true);
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp(
        pw,
        formatter.getWidth(),
        getCommandUsage(),
        null,
        opts,
        formatter.getLeftPadding(),
        formatter.getDescPadding(),
        null);
    pw.flush();

    String trailer = getTrailer();
    if (trailer != null && trailer.length() > 0) {
      System.err.println();
      System.err.println(trailer);
    }
  }
Esempio n. 2
0
    private void usage(ParseException e, boolean exit) {
      if (e != null) {
        System.err.println(e.getMessage());
        System.err.println();
        System.err.println();
      }

      PrintWriter pw = new PrintWriter(System.err, true);
      HelpFormatter formatter = new HelpFormatter();
      formatter.setWidth(80);
      formatter.printHelp(
          pw,
          formatter.getWidth(),
          getCommandUsage(),
          null,
          getOptions(false),
          formatter.getLeftPadding(),
          formatter.getDescPadding(),
          null);
      pw.flush();

      System.err.println();
      System.err.println("term filter: ");
      System.err.println(
          "    - each f[n], t[n] pair represents a term filter, f[n], t[n] don't have to both exist");
      System.err.println("    - f[n] represents a term field name, t[n] represents a term text");
      System.err.println("    - the final filter is formed by ORing all term filters together");
      System.err.println("    - maximum of " + NUM_TERM_FILTERS + " term filters are allowed");

      System.err.println();
      System.err.println("    examples:");
      System.err.println("        -f1 l.content -t1 foo" + " (term l.content=foo)");
      System.err.println(
          "        -f2 from" + "              (all terms with from as the field name)");
      System.err.println("        -t3 bar" + "               (all terms with bar as the text)");

      System.err.println();
      System.err.println();
      System.err.println("Sample command lines:");
      System.err.println(
          "zmjava com.zimbra.cs.index.LuceneViewer -a dump -i /opt/zimbra/index/0/2/index/0 -o /tmp/user1-index-dump.txt");
      System.err.println(
          "zmjava com.zimbra.cs.index.LuceneViewer -a dump -v -f1 l.content -t1 jay -f2 subject -t2 howdy -i /opt/zimbra/index/0/2/index/0 -o /tmp/user1-index-dump.txt");
      System.err.println(
          "zmjava com.zimbra.cs.index.LuceneViewer -a dump -f1 from [email protected] -i /opt/zimbra/index/0/2/index/0 -o /tmp/user1-index-dump.txt");

      if (exit) {
        System.exit(1);
      }
    }
Esempio n. 3
0
 /**
  * Prints usage information.
  *
  * @param stream print stream for the output
  */
 public static void usage(final PrintStream stream) {
   log.fine("Printing usage information");
   final HelpFormatter helpFormatter = new HelpFormatter();
   PrintWriter printWriter = new PrintWriter(stream);
   helpFormatter.printHelp(
       printWriter,
       helpFormatter.getWidth(),
       "bitwriter [options] [--] [input-file]...",
       null,
       options,
       helpFormatter.getLeftPadding(),
       helpFormatter.getDescPadding(),
       "(C) 2015 Tomáš Pecina <*****@*****.**>, license: GNU/GPL");
   printWriter.close();
 }
Esempio n. 4
0
 @Override
 public void execute(ApplicationContext currentContext) throws CLIException {
   HelpFormatter formatter = new HelpFormatter();
   Writer writer = currentContext.getDevice().getWriter();
   PrintWriter pw = new PrintWriter(writer, true);
   Options options =
       CommandFactory.getCommandFactory(CommandFactory.Type.SCHEDULER).supportedOptions();
   formatter.printHelp(
       pw,
       110,
       USAGE,
       "",
       options,
       formatter.getLeftPadding(),
       formatter.getDescPadding(),
       "",
       false);
 }
Esempio n. 5
0
  @Override
  public void execute(ApplicationContext currentContext) throws CLIException {
    HelpFormatter formatter = new HelpFormatter();
    Writer writer = currentContext.getDevice().getWriter();

    ProActiveVersionUtility.writeProActiveVersionWithBreakEndLine(currentContext, System.out);

    PrintWriter pw = new PrintWriter(writer, true);
    formatter.printHelp(
        pw,
        110,
        USAGE,
        "",
        CommandFactory.getCommandFactory(CommandFactory.Type.ALL).supportedOptions(),
        formatter.getLeftPadding(),
        formatter.getDescPadding(),
        "",
        false);
  }