From: Dan Holmsand <holmsand@gmail.com>
To: git@vger.kernel.org
Cc: Petr Baudis <pasky@ucw.cz>
Subject: [PATCH 4/6] Only invoke pager if there's any output
Date: Thu, 09 Jun 2005 13:21:26 +0200 [thread overview]
Message-ID: <42A82636.1060505@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 144 bytes --]
This avoids annoying empty "less" window if there's no output
from cg-diff, for example.
Signed-off-by: Dan Holmsand <holmsand@gmail.com>
---
[-- Attachment #2: 4-pager.patch.txt --]
[-- Type: text/plain, Size: 382 bytes --]
cg-Xlib | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/cg-Xlib b/cg-Xlib
--- a/cg-Xlib
+++ b/cg-Xlib
@@ -22,7 +22,11 @@ usage() {
}
pager () {
- LESS="R$LESS" ${PAGER:-less} $PAGER_FLAGS
+ # Invoke $PAGER if there is any output
+ local line
+ if read -r line; then
+ ( echo "$line"; cat ) | LESS="-R $LESS" ${PAGER:-less}
+ fi
}
mktemp () {
reply other threads:[~2005-06-09 12:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42A82636.1060505@gmail.com \
--to=holmsand@gmail.com \
--cc=git@vger.kernel.org \
--cc=pasky@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).