Example usage for org.apache.commons.cli HelpFormatter setDescPadding

List of usage examples for org.apache.commons.cli HelpFormatter setDescPadding

Introduction

In this page you can find the example usage for org.apache.commons.cli HelpFormatter setDescPadding.

Prototype

public void setDescPadding(int padding) 

Source Link

Document

Sets the 'descPadding'.

Usage

From source file:edu.mines.acmX.exhibit.runner.ModuleManagerRunner.java

private static void printHelp(Options opts) {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setDescPadding(0);
    String header = "\n" + "Welcome to the Interface SDK!\n"
            + "The Interface SDK provides an intelligent environment in which to run modules. "
            + "To build a module visit the github wiki at " + Common.REPOSITORY + "/wiki " + "\n"
            + "Also please find the source code at " + Common.REPOSITORY + " "
            + "where you can find more detail on the open source project.";
    String footer = "\n";
    formatter.printHelp("java -jar [JARNAME]", header, opts, footer, true);
}

From source file:com.dattack.dbping.cli.PingCli.java

private static void showUsage(final Options options) {
    final HelpFormatter formatter = new HelpFormatter();
    final int descPadding = 5;
    final int leftPadding = 4;
    formatter.setDescPadding(descPadding);
    formatter.setLeftPadding(leftPadding);
    final String header = "\n";
    final String footer = "\nPlease report issues at https://github.com/dattack/dbtools/issues";
    formatter.printHelp("dbping ", header, options, footer, true);
}

From source file:com.dattack.dbcopy.cli.DbCopyCli.java

private static void showUsage(final Options options) {
    final HelpFormatter formatter = new HelpFormatter();
    final int descPadding = 5;
    final int leftPadding = 4;
    formatter.setDescPadding(descPadding);
    formatter.setLeftPadding(leftPadding);
    final String header = "\n";
    final String footer = "\nPlease report issues at https://github.com/dattack/dbcopy/issues";
    formatter.printHelp("dbcopy ", header, options, footer, true);
}

From source file:com.dattack.dbtools.drules.DrulesClient.java

private static void showUsage(final Options options) {
    final HelpFormatter formatter = new HelpFormatter();
    final int descPadding = 5;
    final int leftPadding = 4;
    formatter.setDescPadding(descPadding);
    formatter.setLeftPadding(leftPadding);
    final String header = "\n";
    final String footer = "\nPlease report issues at https://github.com/dattack/dbtools/issues";
    formatter.printHelp("drules ", header, options, footer, true);
}

From source file:com.eucalyptus.simpleworkflow.common.client.WorkflowClientStandalone.java

private static void printHelp(final Options opts, final String error) {
    final HelpFormatter formatter = new HelpFormatter();
    formatter.setDescPadding(0);
    String header = "\n" + "Welcome to the Standalone SWF Host!\n"
            + "The program discovers and hosts SWF workflows and activities";
    final String footer = error == null ? "\n" : String.format("\n%s", error);
    formatter.printHelp(/*from ww w .j a va2  s. c o m*/
            "java -cp jarfiles com.eucalyptus.simpleworkflow.common.client.WorkflowClientStandalone", header,
            opts, footer, true);
}

From source file:HLA.java

private static void help(Options options) {
    //String R = "\u001B[30m";
    HelpFormatter formatter = new HelpFormatter();
    formatter.setDescPadding(0);
    String header = "\n" + "Program: Kourami - Graph-guided assembly of HLA typing exons\n" + "Version: "
            + HLA.VERSION + "\n" + "Contact: Heewook Lee <heewookl@cs.cmu.edu>\n\n"
            + "Usage: java -jar <PATH_TO>/Kourami.jar [options] <bam-1> ... <bam-n>\n\n"
            + "   -h,--help                      print this message\n";

    String footer = "\n";
    System.err.println(header);/*from  w w w .j ava2  s . c o  m*/
    PrintWriter tmp = new PrintWriter(System.err);
    formatter.printOptions(tmp, 80, options, 3, 3);
    tmp.println("\n");
    tmp.println("            -hhy+.                o o       o o       o o o o       o o");
    tmp.println(".`           -syss:---.`        o     o o o     o o o         o o o     o o o");
    tmp.println(":+:`     .:/o+++++///ommy+`    o       _  __                               _");
    tmp.println("`yhs/..:osssooooo++++dmNNNdo`   o     | |/ /___  _   _ _ __ __ _ _ __ ___ (_)");
    tmp.println(" /syy///++++ooooooooodNMdNdmh: o      | ' // _ \\| | | | '__/ _` | '_ ` _ \\| |");
    tmp.println(" -do/` .://++++++++oodmmmmmmd-        | . \\ (_) | |_| | | | (_| | | | | | | |");
    tmp.println(" .+:     `.://///+///ommmmdy-         |_|\\_\\___/ \\__,_|_|  \\__,_|_| |_| |_|_|");
    tmp.println("  .          -syo----..``          ");
    tmp.println("            +y+.                \n\n");

    tmp.flush();
    tmp.close();
    System.exit(1);
}

From source file:net.freehal.ui.common.Main.java

private void printHelp(Options options) {
    final String header = "FreeHAL is a self-learning conversation simulator, " + "an artificial intelligence "
            + "which uses semantic nets to organize its knowledge.";
    final String footer = "Please report bugs to <info@freehal.net>.";
    final int width = 120;
    final int descPadding = 5;
    final PrintWriter out = new PrintWriter(System.out, true);

    HelpFormatter formatter = new HelpFormatter();
    formatter.setWidth(width);/*from   w  w w .  j a  va 2  s .co  m*/
    formatter.setDescPadding(descPadding);
    formatter.printUsage(out, width, "java " + Main.class.getName(), options);
    formatter.printWrapped(out, width, header);
    formatter.printWrapped(out, width, "");
    formatter.printOptions(out, width, options, formatter.getLeftPadding(), formatter.getDescPadding());
    formatter.printWrapped(out, width, "");
    formatter.printWrapped(out, width, footer);
}

From source file:net.jsign.PESignerCLI.java

private void printHelp() {
    String header = "Sign and timestamp a Windows executable file.\n\n";
    String footer = "\nPlease report suggestions and issues on the GitHub project at https://github.com/ebourg/jsign/issues";

    HelpFormatter formatter = new HelpFormatter();
    formatter.setOptionComparator(null);
    formatter.setWidth(85);/*ww  w.j  av a 2 s  . c o  m*/
    formatter.setDescPadding(1);
    formatter.printHelp("java -jar jsign.jar [OPTIONS] FILE", header, options, footer);
}

From source file:io.github.felsenhower.stine_calendar_bot.main.CallLevelWrapper.java

/**
 * Prints the help screen for the current Options instance and exits the
 * application//from  www . j  a  v  a 2  s .co m
 */
private void printHelp() {
    HelpFormatter formatter = new HelpFormatter();
    formatter.setOptionComparator(null);
    formatter.setDescPadding(4);
    formatter.setLeftPadding(2);
    formatter.setLongOptSeparator("=");
    formatter.setLongOptPrefix(" --");
    formatter.setSyntaxPrefix(cliStrings.get("Usage"));
    formatter.printHelp(cliStrings.get("UsageTemplate", appInfo.get("Name")),
            cliStrings.get("HelpHeader", appInfo.get("Name"), appInfo.get("Version")), this.options,
            cliStrings.get("HelpFooter", cliStrings.get("Author"), cliStrings.get("License"),
                    appInfo.get("ProjectPage")),
            true);
    System.exit(0);
}

From source file:com.comcast.oscar.cli.CommandRun.java

/**
 * Checks all the commands from the user. Order is IMPORTANT. Do not rearrange without full understanding.
 * @param args// w  w w  .jav a2  s.c o m
 */
public void run(String[] args) {
    BasicParser parser = new BasicParser();
    Options options = new Options();
    BuildOptions.run(options);

    try {
        CommandLine line = parser.parse(options, args);
        HelpFormatter hf = new HelpFormatter();
        hf.setWidth(180);
        hf.setLeftPadding(5);
        hf.setDescPadding(5);

        if (line.hasOption("h")) {
            hf.printHelp(Constants.OSCAR_CLI_USAGE, options);
        }

        if (line.hasOption("version")) {
            System.out.println(Constants.APACHE_20_LICENCE_DISCLAIMER);
            System.out.println(Constants.OSCAR_VERSION);
        }

        if (line.hasOption("s")) {
            comSpecification.setValues(line.getOptionValues("s"));

            if (comSpecification.getConfigurationFileType() == -1) {
                System.err.println(Specification.ERROR);
                System.exit(1);
            }

            if (comSpecification.getTlvDisassemble() == null) {
                System.err.println(Specification.ERROR);
                System.exit(1);
            }
        }

        if (line.hasOption("i")) {
            comInput = new Input(line.getOptionValues("i"));

            if (!comInput.hasInput()) {
                System.err.println(Input.ERROR);
                System.exit(1);
            }
        }

        if (line.hasOption("o")) {
            comOutput = new Output(line.getOptionValues("o"));
        }

        if (line.hasOption("k")) {
            comKey.setKey(line.getOptionValues("k"));
        }

        if (line.hasOption("mbb")) {
            comMergeBulk = new MergeBulk(line.getOptionValues("mbb"));

            if (comMergeBulk.hasInputDir()) {
                comMergeBulk.mergeFiles(comSpecification.getConfigurationFileType(), comKey.getKey());
            } else {
                System.err.println(MergeBulk.ERROR);
                System.exit(1);
            }
        }

        if (line.hasOption("f")) {
            comFirmware = new Firmware(line.getOptionValues("f"));
        }

        if (line.hasOption("T")) {
            comTFTPServer = new TFTPServer(line.getOptionValues("T"));

            if (!comTFTPServer.hasAddress()) {
                System.err.println(TFTPServer.ERROR);
                System.exit(1);
            }
        }

        if (line.hasOption("m")) {
            comMaxCPE = new MaxCPE(line.getOptionValues("m"));
        }

        if (line.hasOption("df")) {
            comDownstreamFrequency = new DownstreamFrequency(line.getOptionValues("df"));
        }

        if (line.hasOption("cvc")) {
            comCVC = new CVC(line.getOptionValues("cvc"));

            if (!comCVC.hasCVC()) {
                System.err.println(CVC.ERROR);
                System.exit(1);
            }
        }

        if (line.hasOption("t")) {
            comTLV = new TLV(line.getOptionValues("t"));
        }

        if (line.hasOption("dm")) {
            comDigitmapInsert = new DigitmapInsert(line.getOptionValues("dm"));

            if (!comDigitmapInsert.hasDigitmap()) {
                System.err.println(DigitmapInsert.ERROR);
                System.exit(1);
            }
        }

        if (line.hasOption("O")) {
            comOID = new OID(line.getOptionValues("O"));

            if (!comOID.hasOID()) {
                System.err.println(OID.ERROR);
                System.exit(1);
            }
        }

        if (line.hasOption("d")) {
            comDecompile = new Decompile(line.getOptionValues("d"));
            decompile();
        }

        if (line.hasOption("c")) {
            compile();
        }

        if (line.hasOption("b")) {
            String[] optionValues = line.getOptionValues("b");

            if (optionValues.length >= 3) {
                bulkBuild(optionValues[0]);
                bulkBuildCommand(new File(optionValues[1]), new File(optionValues[2]));
            } else if (optionValues.length >= 2) {
                bulkBuild(optionValues[0]);
                bulkBuildCommand(new File(optionValues[1]));
            } else {
                System.err.println(Constants.ERR_MIS_PAR);
                hf.printHelp(Constants.OSCAR_CLI_USAGE, options);
            }
        }

        if (line.hasOption("ftd")) {
            comFullTLVDisplay.printFullTLVDisplay(comSpecification.getConfigurationFileType());
        }

        if (line.hasOption("x")) {
            comHexDisplay = new HexDisplay(line.getOptionValues("x"));

            if (comInput.hasInput()) {
                if (comInput.isBinary()) {
                    comHexDisplay.printHexDisplayFromBinary(comInput.getInput());
                } else {
                    comHexDisplay.printHexDisplayFromText(comInput.getInput(),
                            comSpecification.getConfigurationFileType());
                }
            } else {
                System.err.println(Input.ERROR);
                System.exit(1);
            }
        }

        if (line.hasOption("j")) {
            if (comInput.hasInput()) {
                if (comInput.isBinary()) {
                    comJSONDisplay.printJSONDisplayFromBinary(comInput.getInput(),
                            comSpecification.getTlvDisassemble(), comSpecification.getConfigurationFileType());
                } else {
                    comJSONDisplay.printJSONDisplayFromText(comInput.getInput(),
                            comSpecification.getTlvDisassemble());
                }
            } else {
                System.err.println(Input.ERROR);
                System.exit(1);
            }
        }

        if (line.hasOption("ddm")) {
            if (comInput.hasInput()) {
                if (comInput.isBinary()) {
                    comDigitmapDisplay.printDigitmapDisplayFromBinary(comInput.getInput());
                } else {
                    comDigitmapDisplay.printDigitmapDisplayFromText(comInput.getInput());
                }
            }
        }

        if (line.hasOption("j2t")) {
            comJSONtoTLV = new JSONtoTLV(line.getOptionValues("j2t"));

            if (comJSONtoTLV.fileExists()) {
                comJSONtoTLV.printTLV();
            } else {
                System.err.println(JSONtoTLV.ERROR);
            }
        }

        if (line.hasOption("t2j")) {
            comTLVtoJSON = new TLVtoJSON(line.getOptionValues("t2j"));
            comTLVtoJSON.printJSON(comSpecification.getTlvDisassemble());
        }

        if (line.hasOption("td")) {
            comTLVDescription = new TLVDescription(line.getOptionValues("td"));
            comTLVDescription.printTLVDescription(comSpecification.getConfigurationFileType());
        }

        if (line.hasOption("tr")) {
            comTranslate = new Translate(line.getOptionValues("tr"));
            comTranslate.translate();
        }
    } catch (ParseException exp) {
        System.err.println("Parsing failed. Reason: " + exp.getMessage());
    }
}