You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/01/22 10:47:49 UTC

[GitHub] [maven-shared-utils] elharo commented on a change in pull request #70: [MNG-6915] Add a helper method to get the terminal width

elharo commented on a change in pull request #70:
URL: https://github.com/apache/maven-shared-utils/pull/70#discussion_r562546705



##########
File path: src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java
##########
@@ -201,4 +201,21 @@ public void run()
             Runtime.getRuntime().addShutdownHook( shutdownHook );
         }
     }
+
+    /**
+     * Get the terminal width or 0 if the width can not be determined.

Review comment:
       nit: can not --> cannot

##########
File path: src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java
##########
@@ -201,4 +201,21 @@ public void run()
             Runtime.getRuntime().addShutdownHook( shutdownHook );
         }
     }
+
+    /**
+     * Get the terminal width or 0 if the width can not be determined.
+     *
+     * @return the terminal width
+     */
+    public static int getTerminalWidth()

Review comment:
       This needs a test. 

##########
File path: src/main/java/org/apache/maven/shared/utils/logging/MessageUtils.java
##########
@@ -201,4 +201,21 @@ public void run()
             Runtime.getRuntime().addShutdownHook( shutdownHook );
         }
     }
+
+    /**
+     * Get the terminal width or 0 if the width can not be determined.
+     *
+     * @return the terminal width
+     */
+    public static int getTerminalWidth()
+    {
+        if ( JANSI )
+        {
+            return AnsiConsole.getTerminalWidth();
+        }
+        else
+        {
+            return 0;

Review comment:
       -1 is a more common "I couldn't figure out the correct value" flag in these sorts of methods. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org