o Refactored to reduce method size
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@654838 13f79535-47bb-0310-9956-ffa450edef68master
parent
790e6439bb
commit
fe9715f38d
|
|
@ -325,6 +325,26 @@ public class PluginHelpGenerator
|
|||
{
|
||||
MojoDescriptor descriptor = (MojoDescriptor) it.next();
|
||||
|
||||
writeGoal( writer, descriptor );
|
||||
}
|
||||
|
||||
// TODO Should be discovered
|
||||
writer.write( " sb.append( \"" + getFullHelpGoalName( pluginDescriptor ) + "\" ).append( \"\\n\" );"
|
||||
+ LS );
|
||||
writer.write( " appendDescription( sb, \"" + getHelpDescription( pluginDescriptor ) + "\", DEFAULT_INDENT );" + LS );
|
||||
|
||||
writer.write( LS );
|
||||
|
||||
writer.write( " if ( getLog().isInfoEnabled() )" + LS );
|
||||
writer.write( " {" + LS );
|
||||
writer.write( " getLog().info( sb.toString() );" + LS );
|
||||
writer.write( " }" + LS );
|
||||
writer.write( " }" + LS );
|
||||
}
|
||||
|
||||
private static void writeGoal( Writer writer, MojoDescriptor descriptor )
|
||||
throws IOException
|
||||
{
|
||||
String goal = descriptor.getFullGoalName();
|
||||
String description = StringUtils.isNotEmpty( descriptor.getDescription() ) ?
|
||||
StringUtils.escape( toText( descriptor.getDescription() ) ) : "No description available.";
|
||||
|
|
@ -346,11 +366,26 @@ public class PluginHelpGenerator
|
|||
writer.write( " sb.append( \"\\n\" );" + LS );
|
||||
writer.write( LS );
|
||||
|
||||
for ( Iterator it2 = descriptor.getParameters().iterator(); it2.hasNext(); )
|
||||
for ( Iterator it = descriptor.getParameters().iterator(); it.hasNext(); )
|
||||
{
|
||||
Parameter parameter = (Parameter) it2.next();
|
||||
Parameter parameter = (Parameter) it.next();
|
||||
|
||||
if ( parameter.isEditable() )
|
||||
{
|
||||
writeParameter( writer, parameter );
|
||||
}
|
||||
}
|
||||
|
||||
writer.write( " }" + LS );
|
||||
}
|
||||
|
||||
writer.write( LS );
|
||||
writer.write( " sb.append( \"\\n\" );" + LS );
|
||||
writer.write( LS );
|
||||
}
|
||||
|
||||
private static void writeParameter( Writer writer, Parameter parameter )
|
||||
throws IOException
|
||||
{
|
||||
String expression = parameter.getExpression();
|
||||
|
||||
|
|
@ -367,29 +402,6 @@ public class PluginHelpGenerator
|
|||
writer.write( " appendDescription( sb, \"" + parameterDescription + "\", 6 );" + LS );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
writer.write( " }" + LS );
|
||||
}
|
||||
|
||||
writer.write( LS );
|
||||
writer.write( " sb.append( \"\\n\" );" + LS );
|
||||
writer.write( LS );
|
||||
}
|
||||
|
||||
// TODO Should be discovered
|
||||
writer.write( " sb.append( \"" + getFullHelpGoalName( pluginDescriptor ) + "\" ).append( \"\\n\" );"
|
||||
+ LS );
|
||||
writer.write( " appendDescription( sb, \"" + getHelpDescription( pluginDescriptor ) + "\", DEFAULT_INDENT );" + LS );
|
||||
|
||||
writer.write( LS );
|
||||
|
||||
writer.write( " if ( getLog().isInfoEnabled() )" + LS );
|
||||
writer.write( " {" + LS );
|
||||
writer.write( " getLog().info( sb.toString() );" + LS );
|
||||
writer.write( " }" + LS );
|
||||
writer.write( " }" + LS );
|
||||
}
|
||||
|
||||
private static void writeUtilities( Writer writer )
|
||||
throws IOException
|
||||
|
|
|
|||
Loading…
Reference in New Issue