Package org.apache.commons.cli2

Examples of org.apache.commons.cli2.HelpLine


   
    Option helpOpt = obuilder.withLongName("help")
    .withDescription("Print out help")
    .withShortName("h").create();
   
    Group group = gbuilder.withName("Options")
    .withOption(inputOpt)
    .withOption(modelOpt)
    .withOption(helpOpt)
    .create();
   
View Full Code Here


    Option solrBatchOpt = obuilder.withLongName("batch").withRequired(false).withArgument(
            abuilder.withName("batch").withMinimum(1).withMaximum(1).create()).
            withDescription("The number of docs to include in each indexing batch").withShortName("b").create();

    Group group = gbuilder.withName("Options").withOption(wikipediaFileOpt).withOption(numDocsOpt).withOption(solrURLOpt).withOption(solrBatchOpt).create();

    Parser parser = new Parser();
    parser.setGroup(group);
    CommandLine cmdLine = parser.parse(args);
View Full Code Here

   
    Option typeOpt = obuilder.withLongName("classifierType").withRequired(false).withArgument(
      abuilder.withName("classifierType").withMinimum(1).withMaximum(1).create()).withDescription(
      "Type of classifier: knn|tfidf. Default: bayes").withShortName("type").create();
   
    Group group = gbuilder.withName("Options").withOption(gramSizeOpt).withOption(helpOpt).withOption(
        inputDirOpt).withOption(modelOpt).withOption(typeOpt).withOption(contentFieldOpt)
        .withOption(categoryFieldOpt).withOption(maxResultsOpt)
        .create();
   
    try {
View Full Code Here

   
    Option helpOpt = obuilder.withLongName("help")
      .withDescription("Print out help")
      .withShortName("h").create();
   
    Group group = gbuilder.withName("Options")
      .withOption(inputOpt)
      .withOption(outputOpt)
      .withOption(maxOpt)
      .withOption(fieldOpt)
      .create();
View Full Code Here

   
    Option charsetOpt = obuilder.withLongName("charset").withRequired(true).withArgument(
        abuilder.withName("charset").withMinimum(1).withMaximum(1).create()).withDescription(
        "The name of the character encoding of the input files").withShortName("c").create();
   
    Group group = gbuilder.withName("Options").withOption(inputDirOpt).withOption(trainingOutputDirOpt)
         .withOption(testOutputDirOpt).withOption(testSplitSizeOpt).withOption(testSplitPctOpt)
         .withOption(splitLocationOpt).withOption(randomSelectionSizeOpt).withOption(randomSelectionPctOpt)
         .withOption(charsetOpt).create();
   
    try {
View Full Code Here

       
        // calculate the maximum width of the usage strings
        int usageWidth = 0;

        for (final Iterator i = helpLines.iterator(); i.hasNext();) {
            final HelpLine helpLine = (HelpLine) i.next();
            final String usage = helpLine.usage(getLineUsageSettings(), getComparator());
            usageWidth = Math.max(usageWidth, usage.length());
        }

        // build a blank string to pad wrapped descriptions
        final StringBuffer blankBuffer = new StringBuffer();

        for (int i = 0; i < usageWidth; i++) {
            blankBuffer.append(' ');
        }

        // print a blank line
        out.println();
       
        // determine the width available for descriptions
        final int descriptionWidth = Math.max(1, getPageWidth() - getGutterCenter().length() - usageWidth);

        // display each HelpLine
        for (final Iterator i = helpLines.iterator(); i.hasNext();) {
            // grab the HelpLine
            final HelpLine helpLine = (HelpLine) i.next();

            // wrap the description
            final List descList = wrap(helpLine.getDescription(), descriptionWidth);
            final Iterator descriptionIterator = descList.iterator();

            // display usage + first line of description
            printGutterLeft();
            pad(helpLine.usage(getLineUsageSettings(), getComparator()), usageWidth, out);
            out.print(getGutterCenter());
            pad((String) descriptionIterator.next(), descriptionWidth, out);
            printGutterRight();
            out.println();
View Full Code Here

    public List helpLines(final int depth,
                          final Set helpSettings,
                          final Comparator comp) {
        if (helpSettings.contains(DisplaySetting.DISPLAY_PROPERTY_OPTION)) {
            final HelpLine helpLine = new HelpLineImpl(this, depth);

            return Collections.singletonList(helpLine);
        } else {
            return Collections.EMPTY_LIST;
        }
View Full Code Here

    }

    public List helpLines(final int depth,
                          final Set helpSettings,
                          final Comparator comp) {
        final HelpLine helpLine = new HelpLineImpl(this, depth);

        return Collections.singletonList(helpLine);
    }
View Full Code Here

                          final Set helpSettings,
                          final Comparator comp) {
        final List helpLines = new ArrayList();

        if (helpSettings.contains(DisplaySetting.DISPLAY_GROUP_NAME)) {
            final HelpLine helpLine = new HelpLineImpl(this, depth);
            helpLines.add(helpLine);
        }

        if (helpSettings.contains(DisplaySetting.DISPLAY_GROUP_EXPANDED)) {
            // grab a list of the group's options.
View Full Code Here

        // calculate the maximum width of the usage strings
        int usageWidth = 0;

        for (final Iterator i = helpLines.iterator(); i.hasNext();) {
            final HelpLine helpLine = (HelpLine) i.next();
            final String usage = helpLine.usage(lineUsageSettings, comparator);
            usageWidth = Math.max(usageWidth, usage.length());
        }

        // build a blank string to pad wrapped descriptions
        final StringBuffer blankBuffer = new StringBuffer();

        for (int i = 0; i < usageWidth; i++) {
            blankBuffer.append(' ');
        }

        // determine the width available for descriptions
        final int descriptionWidth = Math.max(1, pageWidth - gutterCenter.length() - usageWidth);

        // display each HelpLine
        for (final Iterator i = helpLines.iterator(); i.hasNext();) {
            // grab the HelpLine
            final HelpLine helpLine = (HelpLine) i.next();

            // wrap the description
            final List descList = wrap(helpLine.getDescription(), descriptionWidth);
            final Iterator descriptionIterator = descList.iterator();

            // display usage + first line of description
            printGutterLeft();
            pad(helpLine.usage(lineUsageSettings, comparator), usageWidth, out);
            out.print(gutterCenter);
            pad((String) descriptionIterator.next(), descriptionWidth, out);
            printGutterRight();
            out.println();
View Full Code Here

TOP

Related Classes of org.apache.commons.cli2.HelpLine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.