Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.duelengine.duel.staticapps.maven;
  
  import java.util.Iterator;
  import java.util.List;
  
Display help information on duel-staticapps-maven-plugin.
Call
  mvn duel:help -Ddetail=true -Dgoal=<goal-name>
to display parameter details.

Author(s):
org.apache.maven.tools.plugin.generator.PluginHelpGenerator (version 2.9)
Version:
generated on Mon Dec 03 15:10:48 PST 2012
Goal:
help
RequiresProject:
false
ThreadSafe:
 
 public class HelpMojo
     extends AbstractMojo
 {
    
If true, display all settable properties for each goal.

Parameter:
expression="${detail}" default-value="false"
 
     private boolean detail;

    
The name of the goal for which to show help. If unspecified, all goals will be displayed.

Parameter:
expression="${goal}"
 
     private java.lang.String goal;

    
The maximum length of a display line, should be positive.

Parameter:
expression="${lineLength}" default-value="80"
 
     private int lineLength;

    
The number of spaces per indentation level, should be positive.

Parameter:
expression="${indentSize}" default-value="2"
 
     private int indentSize;


    
 
     public void execute()
         throws MojoExecutionException
     {
         if (  <= 0 )
         {
             getLog().warn"The parameter 'lineLength' should be positive, using '80' as default." );
              = 80;
         }
         if (  <= 0 )
         {
             getLog().warn"The parameter 'indentSize' should be positive, using '2' as default." );
              = 2;
         }
 
         StringBuffer sb = new StringBuffer();
 
         appendsb"org.duelengine:duel-staticapps-maven-plugin:0.9.2", 0 );
         appendsb"", 0 );
 
         appendsb"DUEL Static Apps Maven Plugin", 0 );
         appendsb"Maven Plugin for DUEL Static Site Generator", 1 );
         appendsb"", 0 );
 
         if (  == null || .length() <= 0 )
         {
             appendsb"This plugin has 2 goals:", 0 );
             appendsb"", 0 );
         }
 
         if (  == null || .length() <= 0 || "generate".equals ) )
         {
             appendsb"duel:generate", 0 );
             appendsb"Generates static app from DUEL-based WAR", 1 );
             appendsb"", 0 );
             if (  )
             {
                 appendsb"Available parameters:", 1 );
                 appendsb"", 0 );
 
                 appendsb"configPath (Default: ${project.basedir}/staticapp.json)", 2 );
                 appendsb"Location of the configuration settings", 3 );
                 appendsb"", 0 );
 
                 appendsb"descriptor (Default: ${descriptor})", 2 );
                 appendsb"The plugin descriptor", 3 );
                 appendsb"", 0 );
             }
         }
        if (  == null || .length() <= 0 || "help".equals ) )
        {
            appendsb"duel:help", 0 );
            appendsb"Display help information on duel-staticapps-maven-plugin.\nCall\n\u00a0\u00a0mvn\u00a0duel:help\u00a0-Ddetail=true\u00a0-Dgoal=<goal-name>\nto display parameter details.", 1 );
            appendsb"", 0 );
            if (  )
            {
                appendsb"Available parameters:", 1 );
                appendsb"", 0 );
                appendsb"detail (Default: false)", 2 );
                appendsb"If true, display all settable properties for each goal.", 3 );
                appendsb"Expression: ${detail}", 3 );
                appendsb"", 0 );
                appendsb"goal", 2 );
                appendsb"The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 );
                appendsb"Expression: ${goal}", 3 );
                appendsb"", 0 );
                appendsb"indentSize (Default: 2)", 2 );
                appendsb"The number of spaces per indentation level, should be positive.", 3 );
                appendsb"Expression: ${indentSize}", 3 );
                appendsb"", 0 );
                appendsb"lineLength (Default: 80)", 2 );
                appendsb"The maximum length of a display line, should be positive.", 3 );
                appendsb"Expression: ${lineLength}", 3 );
                appendsb"", 0 );
            }
        }
        if ( getLog().isInfoEnabled() )
        {
            getLog().infosb.toString() );
        }
    }

    

Repeat a String n times to form a new string.

Parameters:
str String to repeat
repeat number of times to repeat str
Returns:
String with repeated String
Throws:
java.lang.NegativeArraySizeException if repeat < 0
java.lang.NullPointerException if str is null
    private static String repeatString strint repeat )
    {
        StringBuffer buffer = new StringBufferrepeat * str.length() );
        for ( int i = 0; i < repeati++ )
        {
            buffer.appendstr );
        }
        return buffer.toString();
    }

    
Append a description to the buffer by respecting the indentSize and lineLength parameters. Note: The last character is always a new line.

Parameters:
sb The buffer to append the description, not null.
description The description, not null.
indent The base indentation level of each line, must not be negative.
    private void appendStringBuffer sbString descriptionint indent )
    {
        for ( Iterator it = toLinesdescriptionindent ).iterator(); it.hasNext(); )
        {
            sb.appendit.next().toString() ).append'\n' );
        }
    }

    
Splits the specified text into lines of convenient display length.

Parameters:
text The text to split into lines, must not be null.
indent The base indentation level of each line, must not be negative.
indentSize The size of each indentation, must not be negative.
lineLength The length of the line, must not be negative.
Returns:
The sequence of display lines, never null.
Throws:
java.lang.NegativeArraySizeException if indent < 0
    private static List toLinesString textint indentint indentSizeint lineLength )
    {
        List lines = new ArrayList();
        String ind = repeat"\t"indent );
        String[] plainLines = text.split"(\r\n)|(\r)|(\n)" );
        for ( int i = 0; i < plainLines.lengthi++ )
        {
            toLineslinesind + plainLines[i], indentSizelineLength );
        }
        return lines;
    }

    
Adds the specified line to the output sequence, performing line wrapping if necessary.

Parameters:
lines The sequence of display lines, must not be null.
line The line to add, must not be null.
indentSize The size of each indentation, must not be negative.
lineLength The length of the line, must not be negative.
    private static void toLinesList linesString lineint indentSizeint lineLength )
    {
        int lineIndent = getIndentLevelline );
        StringBuffer buf = new StringBuffer( 256 );
        String[] tokens = line.split" +" );
        for ( int i = 0; i < tokens.lengthi++ )
        {
            String token = tokens[i];
            if ( i > 0 )
            {
                if ( buf.length() + token.length() >= lineLength )
                {
                    lines.addbuf.toString() );
                    buf.setLength( 0 );
                    buf.appendrepeat" "lineIndent * indentSize ) );
                }
                else
                {
                    buf.append' ' );
                }
            }
            for ( int j = 0; j < token.length(); j++ )
            {
                char c = token.charAtj );
                if ( c == '\t' )
                {
                    buf.appendrepeat" "indentSize - buf.length() % indentSize ) );
                }
                else if ( c == '\u00A0' )
                {
                    buf.append' ' );
                }
                else
                {
                    buf.appendc );
                }
            }
        }
        lines.addbuf.toString() );
    }

    
Gets the indentation level of the specified line.

Parameters:
line The line whose indentation level should be retrieved, must not be null.
Returns:
The indentation level of the line.
    private static int getIndentLevelString line )
    {
        int level = 0;
        for ( int i = 0; i < line.length() && line.charAti ) == '\t'i++ )
        {
            level++;
        }
        for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ )
        {
            if ( line.charAti ) == '\t' )
            {
                level++;
                break;
            }
        }
        return level;
    }
New to GrepCode? Check out our FAQ X