[spring-extensions] branch main updated: Add ANSI color codes to command line base class.

Scott Cantor cantor.2 at osu.edu
Tue Sep 8 17:20:51 UTC 2020


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository spring-extensions.

View the commit online:
http://git.shibboleth.net/view/?p=spring-extensions.git;a=commit;h=29d0acf94e250aedc8428ee2dca1dc2f271130cd

The following commit(s) were added to refs/heads/main by this push:
       new  29d0acf   Add ANSI color codes to command line base class.
29d0acf is described below

commit 29d0acf94e250aedc8428ee2dca1dc2f271130cd
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Sep 8 13:20:44 2020 -0400

    Add ANSI color codes to command line base class.
---
 .../ext/spring/cli/AbstractCommandLine.java        | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLine.java b/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLine.java
index 3646de1..3112d3f 100644
--- a/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLine.java
+++ b/src/main/java/net/shibboleth/ext/spring/cli/AbstractCommandLine.java
@@ -75,6 +75,54 @@ public abstract class AbstractCommandLine<T extends CommandLineArguments> {
     /** Return code indicating an unknown error occurred, {@value} . */
     public static final int RC_UNKNOWN = -1;
 
+    /** ANSI color codes. */
+    public enum ANSIColors {
+        
+        /** ANSI reset. */
+        ANSI_RESET("\u001B[0m"),
+
+        /** ANSI black. */
+        ANSI_BLACK("\u001B[30m"),
+        
+        /** ANSI red. */
+        ANSI_RED("\u001B[31m"),
+        
+        /** ANSI red. */
+        ANSI_GREEN("\u001B[32m"),
+        
+        /** ANSI red. */
+        ANSI_YELLOW("\u001B[33m"),
+        
+        /** ANSI red. */
+        ANSI_BLUE("\u001B[34m"),
+        
+        /** ANSI red. */
+        ANSI_PURPLE("\u001B[35m"),
+        
+        /** ANSI red. */
+        ANSI_CYAN("\u001B[36m"),
+        
+        /** ANSI red. */
+        ANSI_WHITE("\u001B[37m");
+        
+        /** Code string. */
+        @Nonnull @NotEmpty private final String codestring;
+        
+        /**
+         * Constructor.
+         *
+         * @param s code string
+         */
+        ANSIColors(@Nonnull @NotEmpty final String s) {
+            codestring = s;
+        }
+        
+        /** {@inheritDoc} */
+        public String toString() {
+            return codestring;
+        }
+    };
+    
     /** Spring context. */
     @Nullable private GenericApplicationContext applicationContext;
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list