From patchwork Mon Mar 2 15:18:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 445314 X-Patchwork-Delegate: stephen.finucane@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2B8AC14010F for ; Tue, 3 Mar 2015 02:18:58 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=MIQa+o0D; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 0643F1A020A for ; Tue, 3 Mar 2015 02:18:58 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=MIQa+o0D; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from mail-wi0-x22d.google.com (mail-wi0-x22d.google.com [IPv6:2a00:1450:400c:c05::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 22EFC1A0198 for ; Tue, 3 Mar 2015 02:18:44 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass reason="2048-bit key; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=MIQa+o0D; dkim-adsp=pass; dkim-atps=neutral Received: by widex7 with SMTP id ex7so14860636wid.1 for ; Mon, 02 Mar 2015 07:18:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yJnKzRQMXIoLT1LLeOTSp2SrbqjwKI9WcxXcl/5ZOlI=; b=MIQa+o0DA/lkzMY4MkZEzPpO0scPxTtUyCE98IVDzviibas95OAqBotrvbUrhm4tBD mJI7z2Ju1VASoDvz38G6WkdRGspNmQ9srzlIf/ycLImNvUqazv7ZE8LCdtfiv6f1SvgB OvP996Iio4PtwuNg2Vub/X0241arx2Jqlet16Dej87MU4a64/XcP5rF35BTQ/iKp3La0 vuhpdcA/GbXB2dLJKYkxrgG6jlNiylbK/7WZ09Yt7FIrqNAVJ5opscCCk3HBwj7pDvdN BRaaNzmzQq0jru/3HiMb9RtcppCjSIoJOHk5xRHagjdWj8UVjGQ2wXu6ZmoeX4EUIVOy xnGw== X-Received: by 10.194.58.209 with SMTP id t17mr59765932wjq.156.1425309520471; Mon, 02 Mar 2015 07:18:40 -0800 (PST) Received: from s42.loc (91-119-229-249.dynamic.xdsl-line.inode.at. [91.119.229.249]) by mx.google.com with ESMTPSA id b4sm16474679wic.2.2015.03.02.07.18.39 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 02 Mar 2015 07:18:39 -0800 (PST) Received: from cow by s42.loc with local (Exim 4.80) (envelope-from ) id 1YSS7C-0007rS-9D; Mon, 02 Mar 2015 16:18:38 +0100 From: Bernhard Reutner-Fischer To: jk@ozlabs.org Subject: [PATCH] pwclient: honor PAGER for view Date: Mon, 2 Mar 2015 16:18:34 +0100 Message-Id: <1425309514-30184-2-git-send-email-rep.dot.nop@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1425309514-30184-1-git-send-email-rep.dot.nop@gmail.com> References: <1425309514-30184-1-git-send-email-rep.dot.nop@gmail.com> Cc: patchwork@lists.ozlabs.org X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Use the PAGER of the environment to view patches Signed-off-by: Bernhard Reutner-Fischer --- apps/patchwork/bin/pwclient | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient index 2a80981..e6ee3c5 100755 --- a/apps/patchwork/bin/pwclient +++ b/apps/patchwork/bin/pwclient @@ -665,10 +665,25 @@ def main(): action_states(rpc) elif action == 'view': - for patch_id in non_empty(h, patch_ids): - s = rpc.patch_get_mbox(patch_id) - if len(s) > 0: - print unicode(s).encode("utf-8") + pager = os.environ.get('PAGER') + if pager: + pager = subprocess.Popen( + pager.split(), stdin=subprocess.PIPE + ) + if pager: + i = list() + for patch_id in non_empty(h, patch_ids): + s = rpc.patch_get_mbox(patch_id) + if len(s) > 0: + i.append(unicode(s).encode("utf-8")) + if len(i) > 0: + pager.communicate(input="\n".join(i)) + pager.stdin.close() + else: + for patch_id in non_empty(h, patch_ids): + s = rpc.patch_get_mbox(patch_id) + if len(s) > 0: + print unicode(s).encode("utf-8") elif action == 'info': for patch_id in non_empty(h, patch_ids):