Patchwork [09,of,19,pager] help: enable pager

login
register
mail settings
Submitter Augie Fackler
Date Feb. 19, 2017, 11:13 p.m.
Message ID <f6f080904a6ecac993f1.1487545980@imladris.local>
Download mbox | patch
Permalink /patch/18664/
State Accepted
Headers show

Comments

Augie Fackler - Feb. 19, 2017, 11:13 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1486440561 18000
#      Mon Feb 06 23:09:21 2017 -0500
# Node ID f6f080904a6ecac993f137b92d50bf4991f8d07c
# Parent  6dd615d163eb069405ba71fe968980d3340d4702
help: enable pager
Yuya Nishihara - Feb. 21, 2017, 12:58 p.m.
On Sun, 19 Feb 2017 18:13:00 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1486440561 18000
> #      Mon Feb 06 23:09:21 2017 -0500
> # Node ID f6f080904a6ecac993f137b92d50bf4991f8d07c
> # Parent  6dd615d163eb069405ba71fe968980d3340d4702
> help: enable pager

Good news: now --help can be paged!

Bad news: command error is hidden behind pager. Maybe we'll need to start
a pager before calling ui.warn() + commands.help_() ?
Augie Fackler - Feb. 21, 2017, 3:51 p.m.
> On Feb 21, 2017, at 07:58, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> On Sun, 19 Feb 2017 18:13:00 -0500, Augie Fackler wrote:
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1486440561 18000
>> #      Mon Feb 06 23:09:21 2017 -0500
>> # Node ID f6f080904a6ecac993f137b92d50bf4991f8d07c
>> # Parent  6dd615d163eb069405ba71fe968980d3340d4702
>> help: enable pager
> 
> Good news: now --help can be paged!
> 
> Bad news: command error is hidden behind pager. Maybe we'll need to start
> a pager before calling ui.warn() + commands.help_() ?

Ooh, gross. I think I'd actually rather we change the 'unknown command' output to not include that full list of commands and instead have a hint to run 'hg help -c' for a list of commands - thoughts?
Yuya Nishihara - Feb. 22, 2017, 2:22 p.m.
On Tue, 21 Feb 2017 10:51:32 -0500, Augie Fackler wrote:
> > On Feb 21, 2017, at 07:58, Yuya Nishihara <yuya@tcha.org> wrote:
> > On Sun, 19 Feb 2017 18:13:00 -0500, Augie Fackler wrote:
> >> # HG changeset patch
> >> # User Augie Fackler <augie@google.com>
> >> # Date 1486440561 18000
> >> #      Mon Feb 06 23:09:21 2017 -0500
> >> # Node ID f6f080904a6ecac993f137b92d50bf4991f8d07c
> >> # Parent  6dd615d163eb069405ba71fe968980d3340d4702
> >> help: enable pager
> > 
> > Good news: now --help can be paged!
> > 
> > Bad news: command error is hidden behind pager. Maybe we'll need to start
> > a pager before calling ui.warn() + commands.help_() ?
> 
> Ooh, gross. I think I'd actually rather we change the 'unknown command' output to not include that full list of commands and instead have a hint to run 'hg help -c' for a list of commands - thoughts?

I like it. I tend to skip reading long text, and just look for TL;DR. But
I'm not sure if this kind of minor preference is worth BC.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2721,7 +2721,6 @@  def help_(ui, name=None, **opts):
 
     Returns 0 if successful.
     """
-
     textwidth = ui.configint('ui', 'textwidth', 78)
     termwidth = ui.termwidth() - 2
     if textwidth <= 0 or termwidth < textwidth:
@@ -2772,6 +2771,7 @@  def help_(ui, name=None, **opts):
         keep.append('notomitted')
     formatted, pruned = minirst.format(text, textwidth, keep=keep,
                                        section=section)
+    ui.pager('help')
     ui.write(formatted)