https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112020-04-03T14:11:05ZRuby Issue Tracking SystemRuby master - Feature #16754: Pager for `--help`https://redmine.ruby-lang.org/issues/16754?journal_id=848942020-04-03T14:11:05Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>File</strong> deleted (<del><i>screenshot-help.gif</i></del>)</li></ul> Ruby master - Feature #16754: Pager for `--help`https://redmine.ruby-lang.org/issues/16754?journal_id=848952020-04-03T14:11:24Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>File</strong> <i>screenshot-help.gif</i> added</li></ul> Ruby master - Feature #16754: Pager for `--help`https://redmine.ruby-lang.org/issues/16754?journal_id=848962020-04-03T14:19:22Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>File</strong> deleted (<del><i>screenshot-help.gif</i></del>)</li></ul> Ruby master - Feature #16754: Pager for `--help`https://redmine.ruby-lang.org/issues/16754?journal_id=848972020-04-03T14:19:40Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>File</strong> <a href="/attachments/8372">screenshot-help.gif</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/8372/screenshot-help.gif">screenshot-help.gif</a> added</li></ul> Ruby master - Feature #16754: Pager for `--help`https://redmine.ruby-lang.org/issues/16754?journal_id=848982020-04-03T14:26:01Zshevegen (Robert A. Heiler)shevegen@gmail.com
<ul></ul><p>I think the basic idea for the suggestion is fine.</p>
<p>There may be cases where the ruby user may prefer to not use (or depend) on a page<br>
and may be fine with a long message output from --help. This may also depend on<br>
the terminal and shell in use.</p>
<p>For example, I typically use bash + KDE konsole, and I rarely use any pagers at<br>
all (very rarely I pipe towards "more" but I actually try to work in a way so<br>
that I don't need any pager; I am more inclined to write some ruby script that<br>
does re-format any output I may see).</p>
<p>On the other hand, when I use e. g. xterm, and say, perhaps the fish shell,<br>
I may need to use a pager more often, simply because configuring (and using)<br>
xterm is ... not so convenient.</p>
<p>So I think the gist of what I am trying to say is that it may be best to allow<br>
the user to toggle the behaviour, possibly simplest just via a configure<br>
option, and if anyone else needs more then a separate issue could be created.<br>
So perhaps a --no-pager option, if the pager display becomes the default; or<br>
vice versa if it is not the default. (Or perhaps an ENV variable, but this<br>
is probably not really needed; just giving a few suggestions for that<br>
possible case.)</p> Ruby master - Feature #16754: Pager for `--help`https://redmine.ruby-lang.org/issues/16754?journal_id=848992020-04-03T14:27:13Zshevegen (Robert A. Heiler)shevegen@gmail.com
<ul></ul><p>Oh... I just noticed in the code, I think that is the environment variable?</p>
<p>My C knowledge is so bad, but I guess <code>getenv()</code> indicates that. :D</p>
<pre><code class="c syntaxhl" data-language="c"> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">pager_env</span> <span class="o">=</span> <span class="n">getenv</span><span class="p">(</span><span class="s">"RUBY_PAGER"</span><span class="p">);</span>
</code></pre> Ruby master - Feature #16754: Pager for `--help`https://redmine.ruby-lang.org/issues/16754?journal_id=849102020-04-04T02:37:00Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Yes, this uses <code>RUBY_PAGER</code> if it is defined, or <code>PAGER</code> if defined.<br>
The pager is used if stdin and stdout are tty both, redirecting stdin stops it.</p>
<pre><code class="shell syntaxhl" data-language="shell">ruby <span class="nt">--help</span> <&-
</code></pre>
<pre><code class="shell syntaxhl" data-language="shell">ruby <span class="nt">--help</span> </dev/null
</code></pre>
<p>And now empty <code>PAGER</code> value is ignored.</p>
<pre><code class="shell syntaxhl" data-language="shell"><span class="nv">RUBY_PAGER</span><span class="o">=</span> ruby <span class="nt">--help</span>
</code></pre> Ruby master - Feature #16754: Pager for `--help`https://redmine.ruby-lang.org/issues/16754?journal_id=850032020-04-10T08:55:01Zmatz (Yukihiro Matsumoto)matz@ruby.or.jp
<ul></ul><p>I have no objection to the feature. Go ahead.</p>
<p>Matz.</p> Ruby master - Feature #16754: Pager for `--help`https://redmine.ruby-lang.org/issues/16754?journal_id=850702020-04-12T05:58:32Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="View the help message with PAGER [Feature #16754] View the help message wth pager designed by RU..." href="https://redmine.ruby-lang.org/projects/ruby-master/repository/git/revisions/f22c4ff359498ab342e4b6d6feb21af6004ee270">git|f22c4ff359498ab342e4b6d6feb21af6004ee270</a>.</p>
<hr>
<p>View the help message with PAGER [Feature <a class="issue tracker-2 status-5 priority-4 priority-default closed" title="Feature: Pager for `--help` (Closed)" href="https://redmine.ruby-lang.org/issues/16754">#16754</a>]</p>
<p>View the help message wth pager designed by RUBY_PAGER or PAGER<br>
environment variable, unless that value is empty.</p>