[MPH-161] add color to goal or plugin description
Added colors for:
- Highlight plugin name and prefix
- Highlight each goal name (with warning color if deprecated).
- Highlight each parameter name and default value (with warning color if
deprecated).
Reworked from Gabriel initial proposal
diff --git a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
index 1645e6e..da65624 100644
--- a/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
@@ -57,6 +57,7 @@
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.reporting.exec.MavenPluginManagerHelper;
import org.apache.maven.shared.transfer.artifact.ArtifactCoordinate;
+import org.apache.maven.shared.utils.logging.MessageUtils;
import org.apache.maven.tools.plugin.generator.GeneratorUtils;
import org.apache.maven.tools.plugin.util.PluginUtils;
import org.codehaus.plexus.util.StringUtils;
@@ -447,12 +448,12 @@
name = pd.getId();
}
}
- append( buffer, "Name", name, 0 );
+ append( buffer, "Name", MessageUtils.buffer().strong( name ).toString(), 0 );
appendAsParagraph( buffer, "Description", toDescription( pd.getDescription() ), 0 );
append( buffer, "Group Id", pd.getGroupId(), 0 );
append( buffer, "Artifact Id", pd.getArtifactId(), 0 );
append( buffer, "Version", pd.getVersion(), 0 );
- append( buffer, "Goal Prefix", pd.getGoalPrefix(), 0 );
+ append( buffer, "Goal Prefix", MessageUtils.buffer().strong( pd.getGoalPrefix() ).toString(), 0 );
buffer.append( LS );
List<MojoDescriptor> mojos = pd.getMojos();
@@ -521,7 +522,7 @@
private void describeMojoGuts( MojoDescriptor md, StringBuilder buffer, boolean fullDescription )
throws MojoFailureException, MojoExecutionException
{
- append( buffer, md.getFullGoalName(), 0 );
+ append( buffer, MessageUtils.buffer().strong( md.getFullGoalName() ).toString(), 0 );
// indent 1
appendAsParagraph( buffer, "Description", toDescription( md.getDescription() ), 1 );
@@ -534,7 +535,7 @@
if ( StringUtils.isNotEmpty( deprecation ) )
{
- append( buffer, "Deprecated. " + deprecation, 1 );
+ append( buffer, MessageUtils.buffer().warning( "Deprecated. " + deprecation ).toString(), 1 );
}
if ( isReportGoal( md ) )
@@ -632,13 +633,13 @@
if ( StringUtils.isNotEmpty( defaultVal ) )
{
- defaultVal = " (Default: " + defaultVal + ")";
+ defaultVal = " (Default: " + MessageUtils.buffer().strong( defaultVal ) + ")";
}
else
{
defaultVal = "";
}
- append( buffer, parameter.getName() + defaultVal, 2 );
+ append( buffer, MessageUtils.buffer().strong( parameter.getName() ) + defaultVal, 2 );
String alias = parameter.getAlias();
if ( !StringUtils.isEmpty( alias ) )
@@ -681,7 +682,7 @@
if ( StringUtils.isNotEmpty( deprecation ) )
{
- append( buffer, "Deprecated. " + deprecation, 3 );
+ append( buffer, MessageUtils.buffer().warning( "Deprecated. " + deprecation ).toString(), 3 );
}
}
}