Skip to content

Instantly share code, notes, and snippets.

@quigybo
Created October 27, 2010 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quigybo/649359 to your computer and use it in GitHub Desktop.
Save quigybo/649359 to your computer and use it in GitHub Desktop.
From 7be6e34e0293b7d619c2678403ebcdaae901bb1b Mon Sep 17 00:00:00 2001
Message-Id: <7be6e34e0293b7d619c2678403ebcdaae901bb1b.1288195960.git.quigybo@hotmail.com>
From: Chris van Dijk <quigybo@hotmail.com>
Date: Thu, 28 Oct 2010 01:31:00 +1030
Subject: [PATCH] Add `never' option to --color=[WHEN]
---
README.pod | 4 ++--
cower.c | 4 +++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/README.pod b/README.pod
index 28fa353..1cdd8f6 100644
--- a/README.pod
+++ b/README.pod
@@ -42,8 +42,8 @@ if any, at the same time.
=item B<-c, --color[=WHEN]>
-Use colored output. WHEN is `always' or `auto'. Color will be disabled in a pipe unless WHEN
-is set to always.
+Use colored output. WHEN is `never', `always' or `auto'. Color will be disabled in a pipe
+unless WHEN is set to always.
=item B<-f, --force>
diff --git a/cower.c b/cower.c
index 152db61..e313741 100644
--- a/cower.c
+++ b/cower.c
@@ -104,7 +104,7 @@ Usage: cower [options] <operation> PACKAGE [PACKAGE2..]\n\
--download flag is passed as well,\n\
fetch each available update.\n\n", VERSION);
printf(" General options:\n\
- -c, --color[=WHEN] Use colored output. WHEN is `always' or `auto'.\n\
+ -c, --color[=WHEN] Use colored output. WHEN is `never', `always' or `auto'.\n\
-f, --force Overwrite existing files when downloading.\n\
--ignore <pkg> Ignore a package upgrade (can be used more than once)\n\
-h, --help Display this help and exit\n\
@@ -169,6 +169,8 @@ static int parseargs(int argc, char **argv) {
config->color = 0;
} else if (STREQ(optarg, "always"))
config->color = 1;
+ else if (STREQ(optarg, "never"))
+ config->color = 0;
break;
case 'f':
config->force = 1;
--
1.7.3.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment