Hello,

I wanted mu to be able to print colored output at all times, so I have 
removed the "nocolor" option and added the "--color=(auto|never|always)" 
command-line option.
The patch in the attachment has my commit.

I can create a pull-request on github instead, if that's preferred. I have 
yet to install the missing dependencies to compile the latest version of 
mutt, so I can test my changes.

Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"mu-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
diff --git a/mu/mu-config.c b/mu/mu-config.c
index 5af1ccb..9b91aa3 100644
--- a/mu/mu-config.c
+++ b/mu/mu-config.c
@@ -79,10 +79,14 @@ set_group_mu_defaults (void)
 
 	/* check for the MU_NOCOLOR env var; but in any case don't
 	 * use colors unless we're writing to a tty */
-	if (g_getenv (MU_NOCOLOR) != NULL)
-		MU_CONFIG.nocolor = TRUE;
 
-	if (!isatty(fileno(stdout)) || !isatty(fileno(stderr)))
+	if( MU_CONFIG.color == MuColorOpt_always)
+		MU_CONFIG.nocolor= TRUE;
+	else if( MU_CONFIG.color == MuColorOpt_never)
+		MU_CONFIG.nocolor = FALSE;
+	else if (!isatty(fileno(stdout)) || !isatty(fileno(stderr)))
+		MU_CONFIG.nocolor = TRUE;
+	else if (g_getenv (MU_NOCOLOR) != NULL)
 		MU_CONFIG.nocolor = TRUE;
 }
 
@@ -101,8 +105,8 @@ config_options_group_mu (void)
 		 "specify an alternative mu directory", "<dir>"},
 		{"log-stderr", 0, 0, G_OPTION_ARG_NONE, &MU_CONFIG.log_stderr,
 		 "log to standard error (false)", NULL},
-		{"nocolor", 0, 0, G_OPTION_ARG_NONE, &MU_CONFIG.nocolor,
-		 "don't use ANSI-colors in output (false)", NULL},
+		{"color", 0, 0, G_OPTION_ARG_STRING, &MU_CONFIG.colorString,
+		 "colorize output (never|auto|always)", NULL},
 		{"verbose", 'v', 0, G_OPTION_ARG_NONE, &MU_CONFIG.verbose,
 		 "verbose output (false)", NULL},
 
diff --git a/mu/mu-config.h b/mu/mu-config.h
index a45072a..24fadcf 100644
--- a/mu/mu-config.h
+++ b/mu/mu-config.h
@@ -102,8 +102,8 @@ struct _MuConfig {
 	gboolean	 version;	/* request mu version */
 	gboolean	 log_stderr;	/* log to stderr (not logfile) */
 	gchar**		 params;	/* parameters (for querying) */
-	gboolean	 nocolor;        /* don't use use ansi-colors
-					 * in some output */
+	gchar		*colorString;	/* colorize output (string)*/
+	gboolean	nocolor;		/* colorize output (boolean)*/
 	gboolean	 verbose;	/* verbose output */
 
 	/* options for indexing */

Reply via email to