On Fri, 2012-11-23 at 12:46 +0800, Paul Wise wrote:

> For mr summary (#693021), I would like to have an option to make mr not
> print anything unless the command produces some output. Preferably any
> colour normally printed by the command to the terminal should be
> preserved.

Here is a naive patch, it doesn't preserve colour though. 

-- 
bye,
pabs

http://wiki.debian.org/PaulWise
From fd93018031bbfed7857c1cb7d02fc787fdff74f7 Mon Sep 17 00:00:00 2001
From: Paul Wise <p...@debian.org>
Date: Sat, 2 Feb 2013 11:00:00 +0800
Subject: [PATCH 1/2] Make quiet mode show output if there is some. Closes:
 #694031

---
 debian/changelog | 4 ++++
 mr               | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 1c93976..80e813a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,13 @@
 mr (1.14) UNRELEASED; urgency=low
 
+  [ Joey Hess ]
   * Added a fetch command. Closes: #480580
   * status: Now includes information about unpushed changes,
     for git, git-svn, hg, and bzr. Closes: #693021
 
+  [ Paul Wise ]
+  * Make quiet mode show output if there is some. Closes: #694031
+
  -- Joey Hess <jo...@debian.org>  Sun, 11 Nov 2012 11:33:05 -0400
 
 mr (1.13) unstable; urgency=low
diff --git a/mr b/mr
index 7cce39f..46f6a1e 100755
--- a/mr
+++ b/mr
@@ -799,6 +799,10 @@ sub action {
 					if ($ret != 0) {
 						print "$actionmsg\n";
 						print STDERR $output;
+					} elsif ($output) {
+						print "$actionmsg\n";
+						print $output;
+						print "\n";
 					}
 					return $ret;
 				}
@@ -869,6 +873,8 @@ sub hook {
 				my $ret = $?;
 				if ($ret != 0) {
 					print STDERR $output;
+				} elsif ($output) {
+					print $output;
 				}
 				return $ret;
 			}
-- 
1.8.1.1

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to