Search in sources :

Example 91 with HelpFormatter

use of org.apache.commons.cli.HelpFormatter in project zm-mailbox by Zimbra.

the class ZoneInfo2iCalendar method usage.

private static void usage(String errmsg) {
    if (errmsg != null) {
        System.err.println(errmsg);
    }
    String usage = "zmtzdata2ical <options> [tzdata source files ...]";
    Options opts = sOptions;
    PrintWriter pw = new PrintWriter(System.err, true);
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp(pw, formatter.getWidth(), usage, null, opts, formatter.getLeftPadding(), formatter.getDescPadding(), null);
    pw.flush();
}
Also used : HelpFormatter(org.apache.commons.cli.HelpFormatter) Options(org.apache.commons.cli.Options) PrintWriter(java.io.PrintWriter)

Example 92 with HelpFormatter

use of org.apache.commons.cli.HelpFormatter in project zm-mailbox by Zimbra.

the class MimeDetect method usage.

private static void usage(Options opts) {
    new HelpFormatter().printHelp(MimeDetect.class.getSimpleName() + " [options] file", opts);
    System.exit(2);
}
Also used : HelpFormatter(org.apache.commons.cli.HelpFormatter)

Example 93 with HelpFormatter

use of org.apache.commons.cli.HelpFormatter in project zm-mailbox by Zimbra.

the class LocalConfigUpgrade method usage.

static void usage(String error) {
    if (error != null)
        System.out.println("Error: " + error);
    Options opts = getAllOptions();
    PrintWriter pw = new PrintWriter(System.out, true);
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp(pw, formatter.getWidth(), getCommandUsage(), null, opts, formatter.getLeftPadding(), formatter.getDescPadding(), null);
    pw.flush();
    if (error != null) {
        System.exit(1);
    } else {
        System.exit(0);
    }
}
Also used : HelpFormatter(org.apache.commons.cli.HelpFormatter) Options(org.apache.commons.cli.Options) PrintWriter(java.io.PrintWriter)

Example 94 with HelpFormatter

use of org.apache.commons.cli.HelpFormatter in project zm-mailbox by Zimbra.

the class ChartUtil method usage.

private static void usage(Options opts, String msg) {
    if (msg != null)
        System.err.println(msg);
    String invocation = "Usage: zmstat-chart -c <arg> -s <arg> -d <arg> [options]";
    PrintWriter pw = new PrintWriter(System.err, true);
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp(pw, formatter.getWidth(), invocation, null, opts, formatter.getLeftPadding(), formatter.getDescPadding(), null);
    pw.flush();
    System.exit(1);
}
Also used : HelpFormatter(org.apache.commons.cli.HelpFormatter) PrintWriter(java.io.PrintWriter)

Example 95 with HelpFormatter

use of org.apache.commons.cli.HelpFormatter in project zm-mailbox by Zimbra.

the class AttributeManagerUtil method usage.

private static void usage(String errmsg) {
    if (errmsg != null) {
        logger.error(errmsg);
    }
    HelpFormatter formatter = new HelpFormatter();
    formatter.printHelp("AttributeManagerUtil [options] where [options] are one of:", options);
    System.exit((errmsg == null) ? 0 : 1);
}
Also used : HelpFormatter(org.apache.commons.cli.HelpFormatter)

Aggregations

HelpFormatter (org.apache.commons.cli.HelpFormatter)273 Options (org.apache.commons.cli.Options)136 CommandLine (org.apache.commons.cli.CommandLine)126 CommandLineParser (org.apache.commons.cli.CommandLineParser)110 ParseException (org.apache.commons.cli.ParseException)103 GnuParser (org.apache.commons.cli.GnuParser)92 Path (org.apache.hadoop.fs.Path)42 PrintWriter (java.io.PrintWriter)35 Option (org.apache.commons.cli.Option)29 Job (org.apache.hadoop.mapreduce.Job)27 Configuration (org.apache.hadoop.conf.Configuration)21 File (java.io.File)17 IOException (java.io.IOException)14 DefaultParser (org.apache.commons.cli.DefaultParser)13 PosixParser (org.apache.commons.cli.PosixParser)12 FileSystem (org.apache.hadoop.fs.FileSystem)12 BasicParser (org.apache.commons.cli.BasicParser)11 ArrayList (java.util.ArrayList)8 URI (java.net.URI)6 FSDataOutputStream (org.apache.hadoop.fs.FSDataOutputStream)6