celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [12/21] celix git commit: CELIX-210: Added yellow color text instead of red for not available optional dependencies
Date Tue, 03 Nov 2015 11:09:49 GMT
CELIX-210: Added yellow color text instead of red for not available optional dependencies


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/f48fee19
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/f48fee19
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/f48fee19

Branch: refs/heads/develop
Commit: f48fee19af8a0e06c5d74b5ceae0c74f783c5dd0
Parents: 2de2554
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Thu Oct 22 21:37:03 2015 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Thu Oct 22 21:37:03 2015 +0200

----------------------------------------------------------------------
 .../private/src/dm_shell_list_command.c           | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/f48fee19/dependency_manager/private/src/dm_shell_list_command.c
----------------------------------------------------------------------
diff --git a/dependency_manager/private/src/dm_shell_list_command.c b/dependency_manager/private/src/dm_shell_list_command.c
index 1e70513..030d909 100644
--- a/dependency_manager/private/src/dm_shell_list_command.c
+++ b/dependency_manager/private/src/dm_shell_list_command.c
@@ -35,6 +35,11 @@
 #include "shell.h"
 
 
+static const char * const OK_COLOR = "\033[92m";
+static const char * const WARNING_COLOR = "\033[93m";
+static const char * const NOK_COLOR = "\033[91m";
+static const char * const END_COLOR = "\033[m";
+
 char * dmListCommand_getName(command_pt command) {
     return "dm";
 }
@@ -73,8 +78,8 @@ void dmListCommand_execute(command_pt command, char * line, void (*out)(char
*),
             char *startColors = "";
             char *endColors = "";
             if (colors) {
-                startColors = compInfo->active ? "\033[92m" : "\033[91m";
-                endColors = "\033[m";
+                startColors = compInfo->active ? OK_COLOR : NOK_COLOR;
+                endColors = END_COLOR;
             }
             sprintf(outString, "Component: ID=%s, %sActive=%s%s, State=%s\n", compInfo->id,
startColors, compInfo->active ?  "true " : "false", endColors, compInfo->state);
             out(outString);
@@ -98,8 +103,13 @@ void dmListCommand_execute(command_pt command, char * line, void (*out)(char
*),
                 char *startColors = "";
                 char *endColors = "";
                 if (colors) {
-                    startColors = dependency->available ? "\033[92m" : "\033[91m";
-                    endColors = "\033[m";
+                    if (dependency->required) {
+                        startColors = dependency->available ? OK_COLOR : NOK_COLOR;
+                    } else {
+                        startColors = dependency->available ? OK_COLOR : WARNING_COLOR;
+                    }
+
+                    endColors = END_COLOR;
                 }
                 sprintf(outString, "   |- Dependency: %sAvailable = %s%s, Required = %s,
Filter = %s\n",
                         startColors,


Mime
View raw message