You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2019/04/13 10:24:49 UTC

[maven-help-plugin] branch master updated: [MPH-161] add color to goal or plugin description

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 66ff895  [MPH-161] add color to goal or plugin description
66ff895 is described below

commit 66ff8957e4650bc99d79fa55bba2aa13ca8d9723
Author: Gabriel Belingueres <be...@gmail.com>
AuthorDate: Fri Feb 22 22:13:09 2019 -0300

    [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
---
 .../java/org/apache/maven/plugins/help/DescribeMojo.java  | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

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.project.ProjectBuildingRequest;
 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 @@ public class DescribeMojo
                 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 @@ public class DescribeMojo
     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 @@ public class DescribeMojo
 
         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 @@ public class DescribeMojo
 
             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 @@ public class DescribeMojo
 
             if ( StringUtils.isNotEmpty( deprecation ) )
             {
-                append( buffer, "Deprecated. " + deprecation, 3 );
+                append( buffer, MessageUtils.buffer().warning( "Deprecated. " + deprecation ).toString(), 3 );
             }
         }
     }