git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git: add -N as a short option for --no-pager
@ 2018-04-24 16:59 Johannes Sixt
  2018-04-25  0:05 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Johannes Sixt @ 2018-04-24 16:59 UTC (permalink / raw)
  To: Git Mailing List

In modern setups, less, the pager, uses alternate screen to show
the content. When it is closed, it switches back to the original
screen, and all content is gone.

It is not uncommon to request that the output remains visible in
the terminal. For this, the option --no-pager can be used. But
it is a bit cumbersome to type, even when command completion is
available. Provide a short option, -N, to make the option easier
accessible.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 Documentation/git.txt | 3 ++-
 git.c                 | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index 4767860e72..17b50b0dc6 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
     [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
-    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
+    [-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
     [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
     [--super-prefix=<path>]
     <command> [<args>]
@@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
 	configuration options (see the "Configuration Mechanism" section
 	below).
 
+-N::
 --no-pager::
 	Do not pipe Git output into a pager.
 
diff --git a/git.c b/git.c
index ceaa58ef40..9e2d78f442 100644
--- a/git.c
+++ b/git.c
@@ -7,7 +7,7 @@
 const char git_usage_string[] =
 	N_("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n"
 	   "           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
-	   "           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n"
+	   "           [-p | --paginate | -N | --no-pager] [--no-replace-objects] [--bare]\n"
 	   "           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
 	   "           <command> [<args>]");
 
@@ -81,7 +81,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 			exit(0);
 		} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
 			use_pager = 1;
-		} else if (!strcmp(cmd, "--no-pager")) {
+		} else if (!strcmp(cmd, "-N") || !strcmp(cmd, "--no-pager")) {
 			use_pager = 0;
 			if (envchanged)
 				*envchanged = 1;
-- 
2.17.0.69.g0c1d01d9b6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] git: add -N as a short option for --no-pager
  2018-04-24 16:59 [PATCH] git: add -N as a short option for --no-pager Johannes Sixt
@ 2018-04-25  0:05 ` Junio C Hamano
  2018-04-25  5:45   ` Beat Bolli <bbolli@ewanet.ch>
  2018-04-25  6:25   ` Johannes Sixt
  2018-04-25  9:21 ` Phillip Wood
  2018-05-03 17:15 ` [PATCH v2] git: add -P " Johannes Sixt
  2 siblings, 2 replies; 14+ messages in thread
From: Junio C Hamano @ 2018-04-25  0:05 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Git Mailing List

Johannes Sixt <j6t@kdbg.org> writes:

> In modern setups, less, the pager, uses alternate screen to show
> the content. When it is closed, it switches back to the original
> screen, and all content is gone.
>
> It is not uncommon to request that the output remains visible in
> the terminal. For this, the option --no-pager can be used. But
> it is a bit cumbersome to type, even when command completion is
> available. Provide a short option, -N, to make the option easier
> accessible.
>
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---

Heh, I used to append "|cat", which is four keystrokes that is a bit
shorter than " --no-pager", but that is only acceptable when you do
not care about colored output ;-)

I am not absolutely certain about the choice of a single letter. I
already checked we do not use "git -N cmd" for anything else right
now, so I am certain about the availability, but I am not sure if
capital 'N' is the best choice, when the other side is lowercase 'p'
(and more importantly, the other side 'p' has mneomonic value for
'pagination', but 'N' merely stands for 'no' and could be negating
anything, not related to pagination). But I agree that a short-hand
would be welcome.

> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index 4767860e72..17b50b0dc6 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -11,7 +11,7 @@ SYNOPSIS
>  [verse]
>  'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
>      [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
> -    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
> +    [-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
>      [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
>      [--super-prefix=<path>]
>      <command> [<args>]
> @@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
>  	configuration options (see the "Configuration Mechanism" section
>  	below).
>  
> +-N::
>  --no-pager::
>  	Do not pipe Git output into a pager.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git: add -N as a short option for --no-pager
  2018-04-25  0:05 ` Junio C Hamano
@ 2018-04-25  5:45   ` Beat Bolli <bbolli@ewanet.ch>
  2018-04-25  6:25   ` Johannes Sixt
  1 sibling, 0 replies; 14+ messages in thread
From: Beat Bolli <bbolli@ewanet.ch> @ 2018-04-25  5:45 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 2432 bytes --]

On Wed, Apr 25, 2018 at 09:05:56AM +0900, Junio C Hamano wrote:
> Johannes Sixt <j6t@kdbg.org> writes:
> 
> > In modern setups, less, the pager, uses alternate screen to show
> > the content. When it is closed, it switches back to the original
> > screen, and all content is gone.
> >
> > It is not uncommon to request that the output remains visible in
> > the terminal. For this, the option --no-pager can be used. But
> > it is a bit cumbersome to type, even when command completion is
> > available. Provide a short option, -N, to make the option easier
> > accessible.
> >
> > Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> > ---
> 
> Heh, I used to append "|cat", which is four keystrokes that is a bit
> shorter than " --no-pager", but that is only acceptable when you do
> not care about colored output ;-)
> 
> I am not absolutely certain about the choice of a single letter. I
> already checked we do not use "git -N cmd" for anything else right
> now, so I am certain about the availability, but I am not sure if
> capital 'N' is the best choice, when the other side is lowercase 'p'
> (and more importantly, the other side 'p' has mneomonic value for
> 'pagination', but 'N' merely stands for 'no' and could be negating
> anything, not related to pagination). But I agree that a short-hand
> would be welcome.
> 

I'm quite fond of the notation "-p-", but that would set a precedent for
all other "--no-" options.

Maybe the option parser could be enhanced to allow for both?

Thanks,
Beat

> > diff --git a/Documentation/git.txt b/Documentation/git.txt
> > index 4767860e72..17b50b0dc6 100644
> > --- a/Documentation/git.txt
> > +++ b/Documentation/git.txt
> > @@ -11,7 +11,7 @@ SYNOPSIS
> >  [verse]
> >  'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
> >      [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
> > -    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
> > +    [-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
> >      [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
> >      [--super-prefix=<path>]
> >      <command> [<args>]
> > @@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
> >  	configuration options (see the "Configuration Mechanism" section
> >  	below).
> >  
> > +-N::
> >  --no-pager::
> >  	Do not pipe Git output into a pager.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git: add -N as a short option for --no-pager
  2018-04-25  0:05 ` Junio C Hamano
  2018-04-25  5:45   ` Beat Bolli <bbolli@ewanet.ch>
@ 2018-04-25  6:25   ` Johannes Sixt
  2018-04-25  7:41     ` Johannes Schindelin
  2018-05-01 11:41     ` Kaartic Sivaraam
  1 sibling, 2 replies; 14+ messages in thread
From: Johannes Sixt @ 2018-04-25  6:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Am 25.04.2018 um 02:05 schrieb Junio C Hamano:
> Johannes Sixt <j6t@kdbg.org> writes:
>> It is not uncommon to request that the output remains visible in
>> the terminal. For this, the option --no-pager can be used. But
>> it is a bit cumbersome to type, even when command completion is
>> available. Provide a short option, -N, to make the option easier
>> accessible.
>>
>> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
>> ---
> 
> Heh, I used to append "|cat", which is four keystrokes that is a bit
> shorter than " --no-pager", but that is only acceptable when you do
> not care about colored output ;-)
> 
> I am not absolutely certain about the choice of a single letter. I
> already checked we do not use "git -N cmd" for anything else right
> now, so I am certain about the availability, but I am not sure if
> capital 'N' is the best choice, when the other side is lowercase 'p'
> (and more importantly, the other side 'p' has mneomonic value for
> 'pagination', but 'N' merely stands for 'no' and could be negating
> anything, not related to pagination). But I agree that a short-hand
> would be welcome.

I considered -P, but thought that it would better be reserved for 
something related to "paths". We have --{html,man,info}-path, which 
would be served better with -[HMI]. That leaves --exec-path, which we 
would probably abbreviate as -x or -X. So, -P is perhaps not that bad 
after all.

We could also choose +p, for which there is some precedent in other 
POSIX tools to mean negated -p, but not in git, I think. 
Implementationwise, it is not that trivial, either, because the section 
handling options is guarded by a check that the word begins with a dash.

Perhaps --no-pager means also "unpaginated" (-u, -U), "linear" (-l, -L), 
"streamed" (-s, -S). Other ideas, anyone?

> 
>> diff --git a/Documentation/git.txt b/Documentation/git.txt
>> index 4767860e72..17b50b0dc6 100644
>> --- a/Documentation/git.txt
>> +++ b/Documentation/git.txt
>> @@ -11,7 +11,7 @@ SYNOPSIS
>>   [verse]
>>   'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
>>       [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
>> -    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
>> +    [-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
>>       [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
>>       [--super-prefix=<path>]
>>       <command> [<args>]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git: add -N as a short option for --no-pager
  2018-04-25  6:25   ` Johannes Sixt
@ 2018-04-25  7:41     ` Johannes Schindelin
  2018-04-25 19:30       ` Johannes Sixt
  2018-05-01 11:41     ` Kaartic Sivaraam
  1 sibling, 1 reply; 14+ messages in thread
From: Johannes Schindelin @ 2018-04-25  7:41 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, Git Mailing List

Hi Hannes,

On Wed, 25 Apr 2018, Johannes Sixt wrote:

> Am 25.04.2018 um 02:05 schrieb Junio C Hamano:
> > Johannes Sixt <j6t@kdbg.org> writes:
> > > It is not uncommon to request that the output remains visible in
> > > the terminal.

I ran `git log` and then hit `q`, and the latest screen contents were
still visible in all of these scenarios:

- in a Linux VM via SSH client

- in Git Bash on Windows

- in Git CMD on Windows

Granted, this is only the latest screen, but that is usually good enough
here.

Is anything different happening in your setups?

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git: add -N as a short option for --no-pager
  2018-04-24 16:59 [PATCH] git: add -N as a short option for --no-pager Johannes Sixt
  2018-04-25  0:05 ` Junio C Hamano
@ 2018-04-25  9:21 ` Phillip Wood
  2018-04-25 19:31   ` Johannes Sixt
  2018-05-03 17:15 ` [PATCH v2] git: add -P " Johannes Sixt
  2 siblings, 1 reply; 14+ messages in thread
From: Phillip Wood @ 2018-04-25  9:21 UTC (permalink / raw)
  To: Johannes Sixt, Git Mailing List

On 24/04/18 17:59, Johannes Sixt wrote:
> 
> In modern setups, less, the pager, uses alternate screen to show
> the content. When it is closed, it switches back to the original
> screen, and all content is gone.

Are you setting LESS explicitly in the environment?

 From the git config man page:
When the LESS environment variable is unset, Git sets it to FRX (if LESS 
environment variable is set, Git does not change it at all).

 From the less man page the X option:
Disables  sending the termcap initialization and deinitialization 
strings to the terminal.  This is sometimes desirable if the 
deinitialization string does something unnecessary, like clearing the 
screen.

So with the default setup the output should remain on the screen.

Best Wishes

Phillip


> It is not uncommon to request that the output remains visible in
> the terminal. For this, the option --no-pager can be used. But
> it is a bit cumbersome to type, even when command completion is
> available. Provide a short option, -N, to make the option easier
> accessible.
> 
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
>   Documentation/git.txt | 3 ++-
>   git.c                 | 4 ++--
>   2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index 4767860e72..17b50b0dc6 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -11,7 +11,7 @@ SYNOPSIS
>   [verse]
>   'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
>       [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
> -    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
> +    [-p|--paginate|-N|--no-pager] [--no-replace-objects] [--bare]
>       [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
>       [--super-prefix=<path>]
>       <command> [<args>]
> @@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
>   	configuration options (see the "Configuration Mechanism" section
>   	below).
>   
> +-N::
>   --no-pager::
>   	Do not pipe Git output into a pager.
>   
> diff --git a/git.c b/git.c
> index ceaa58ef40..9e2d78f442 100644
> --- a/git.c
> +++ b/git.c
> @@ -7,7 +7,7 @@
>   const char git_usage_string[] =
>   	N_("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n"
>   	   "           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
> -	   "           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n"
> +	   "           [-p | --paginate | -N | --no-pager] [--no-replace-objects] [--bare]\n"
>   	   "           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
>   	   "           <command> [<args>]");
>   
> @@ -81,7 +81,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
>   			exit(0);
>   		} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
>   			use_pager = 1;
> -		} else if (!strcmp(cmd, "--no-pager")) {
> +		} else if (!strcmp(cmd, "-N") || !strcmp(cmd, "--no-pager")) {
>   			use_pager = 0;
>   			if (envchanged)
>   				*envchanged = 1;
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git: add -N as a short option for --no-pager
  2018-04-25  7:41     ` Johannes Schindelin
@ 2018-04-25 19:30       ` Johannes Sixt
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Sixt @ 2018-04-25 19:30 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Junio C Hamano, Git Mailing List

Am 25.04.2018 um 09:41 schrieb Johannes Schindelin:
> Hi Hannes,
> 
> On Wed, 25 Apr 2018, Johannes Sixt wrote:
> 
>> Am 25.04.2018 um 02:05 schrieb Junio C Hamano:
>>> Johannes Sixt <j6t@kdbg.org> writes:
>>>> It is not uncommon to request that the output remains visible in
>>>> the terminal.
> 
> I ran `git log` and then hit `q`, and the latest screen contents were
> still visible in all of these scenarios:
> 
> - in a Linux VM via SSH client
> 
> - in Git Bash on Windows
> 
> - in Git CMD on Windows
> 
> Granted, this is only the latest screen, but that is usually good enough
> here.
> 
> Is anything different happening in your setups?

I have LESS=RS in my environment, because I do want that the alternate 
screen is used by the pager. Nevertheless, occasionally I want git's 
output to remain visible.

-- Hannes

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git: add -N as a short option for --no-pager
  2018-04-25  9:21 ` Phillip Wood
@ 2018-04-25 19:31   ` Johannes Sixt
  2018-05-01 11:25     ` Kaartic Sivaraam
  0 siblings, 1 reply; 14+ messages in thread
From: Johannes Sixt @ 2018-04-25 19:31 UTC (permalink / raw)
  To: phillip.wood, Git Mailing List

Am 25.04.2018 um 11:21 schrieb Phillip Wood:
> On 24/04/18 17:59, Johannes Sixt wrote:
>>
>> In modern setups, less, the pager, uses alternate screen to show
>> the content. When it is closed, it switches back to the original
>> screen, and all content is gone.
> 
> Are you setting LESS explicitly in the environment?
> 
>  From the git config man page:
> When the LESS environment variable is unset, Git sets it to FRX (if LESS 
> environment variable is set, Git does not change it at all).
> 
>  From the less man page the X option:
> Disables  sending the termcap initialization and deinitialization 
> strings to the terminal.  This is sometimes desirable if the 
> deinitialization string does something unnecessary, like clearing the 
> screen.
> 
> So with the default setup the output should remain on the screen.

Right. But I have LESS=RS because I do *not* want it to remain on screen 
by default.

-- Hannes

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git: add -N as a short option for --no-pager
  2018-04-25 19:31   ` Johannes Sixt
@ 2018-05-01 11:25     ` Kaartic Sivaraam
  0 siblings, 0 replies; 14+ messages in thread
From: Kaartic Sivaraam @ 2018-05-01 11:25 UTC (permalink / raw)
  To: Johannes Sixt, phillip.wood, Git Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 1032 bytes --]

On Thursday 26 April 2018 01:01 AM, Johannes Sixt wrote:
> 
> Right. But I have LESS=RS because I do *not* want it to remain on screen
> by default.
> 

In that case how about updating the commit message to be more clear
about it. How about,

	It is possible to configure 'less', the pager, to use an
	alternate screen to show the content. When it is closed in this
	case, it switches back to the original screen, and all content
	is gone.

-- 
Sivaraam

QUOTE:

“The most valuable person on any team is the person who makes everyone
else on the team more valuable, not the person who knows the most.”

      - Joel Spolsky

KIND NOTE TO THE NATIVE ENGLISH SPEAKER:

As I'm not a native English speaker myself, there might be mistaeks in
my usage of English. I apologise for any mistakes that I make.

It would be "helpful" if you take the time to point out the mistakes.

It would be "super helpful" if you could provide suggestions about how
to correct those mistakes.

Thanks in advance!


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] git: add -N as a short option for --no-pager
  2018-04-25  6:25   ` Johannes Sixt
  2018-04-25  7:41     ` Johannes Schindelin
@ 2018-05-01 11:41     ` Kaartic Sivaraam
  1 sibling, 0 replies; 14+ messages in thread
From: Kaartic Sivaraam @ 2018-05-01 11:41 UTC (permalink / raw)
  To: Johannes Sixt, Junio C Hamano; +Cc: Git Mailing List


[-- Attachment #1.1: Type: text/plain, Size: 1692 bytes --]

On Wednesday 25 April 2018 11:55 AM, Johannes Sixt wrote:
> 
> I considered -P, but thought that it would better be reserved for
> something related to "paths". We have --{html,man,info}-path, which
> would be served better with -[HMI]. That leaves --exec-path, which we
> would probably abbreviate as -x or -X. So, -P is perhaps not that bad
> after all.
> 

It might be a good choice but I don't think it's not the best choice
anyway because '-P' doesn't seem to communicate 'no pager' well.


> Perhaps --no-pager means also "unpaginated" (-u, -U), "linear" (-l, -L),
> "streamed" (-s, -S). Other ideas, anyone?
>

Considering the other alternatives you suggested (as I couldn't come up
with a better "single letter" option ;-) ), I think '-s' might be a nice
choice but would possibly need some explanation in the documentation to
the wondering users.

In the end, lacking a better one letter option, I think '-P' would be a
better choice after all. It would, possibly, be easily understood as a
negation of pagination (-p). So, I guess it would be better to go with
'-P' than '-N'.

-- 
Sivaraam

QUOTE:

“The most valuable person on any team is the person who makes everyone
else on the team more valuable, not the person who knows the most.”

      - Joel Spolsky

KIND NOTE TO THE NATIVE ENGLISH SPEAKER:

As I'm not a native English speaker myself, there might be mistaeks in
my usage of English. I apologise for any mistakes that I make.

It would be "helpful" if you take the time to point out the mistakes.

It would be "super helpful" if you could provide suggestions about how
to correct those mistakes.

Thanks in advance!


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2] git: add -P as a short option for --no-pager
  2018-04-24 16:59 [PATCH] git: add -N as a short option for --no-pager Johannes Sixt
  2018-04-25  0:05 ` Junio C Hamano
  2018-04-25  9:21 ` Phillip Wood
@ 2018-05-03 17:15 ` Johannes Sixt
  2018-05-03 20:06   ` Eric Sunshine
  2018-12-21 12:04   ` Johannes Schindelin
  2 siblings, 2 replies; 14+ messages in thread
From: Johannes Sixt @ 2018-05-03 17:15 UTC (permalink / raw)
  To: Git Mailing List
  Cc: Junio C Hamano, Eric Sunshine, Kaartic Sivaraam,
	Johannes Schindelin

It is possible to configure 'less', the pager, to use an alternate
screen to show the content, for example, by setting LESS=RS in the
environment. When it is closed in this configuration, it switches
back to the original screen, and all content is gone.

It is not uncommon to request that the output remains visible in
the terminal. For this, the option --no-pager can be used. But
it is a bit cumbersome to type, even when command completion is
available. Provide a short option, -P, to make the option easier
accessible.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 Given the positive feedback, I resurrect the patch.

 Changes since v1:
 - Use -P instead of -N
 - Commit message changed as proposed by Kaartic

 Documentation/git.txt | 3 ++-
 git.c                 | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index 4767860e72..c662f41c1d 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
     [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
-    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
+    [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
     [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
     [--super-prefix=<path>]
     <command> [<args>]
@@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
 	configuration options (see the "Configuration Mechanism" section
 	below).
 
+-P::
 --no-pager::
 	Do not pipe Git output into a pager.
 
diff --git a/git.c b/git.c
index ceaa58ef40..71d013424e 100644
--- a/git.c
+++ b/git.c
@@ -7,7 +7,7 @@
 const char git_usage_string[] =
 	N_("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n"
 	   "           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
-	   "           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n"
+	   "           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n"
 	   "           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
 	   "           <command> [<args>]");
 
@@ -81,7 +81,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
 			exit(0);
 		} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
 			use_pager = 1;
-		} else if (!strcmp(cmd, "--no-pager")) {
+		} else if (!strcmp(cmd, "-P") || !strcmp(cmd, "--no-pager")) {
 			use_pager = 0;
 			if (envchanged)
 				*envchanged = 1;
-- 
2.17.0.69.g0c1d01d9b6

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] git: add -P as a short option for --no-pager
  2018-05-03 17:15 ` [PATCH v2] git: add -P " Johannes Sixt
@ 2018-05-03 20:06   ` Eric Sunshine
  2018-05-04  5:43     ` Junio C Hamano
  2018-12-21 12:04   ` Johannes Schindelin
  1 sibling, 1 reply; 14+ messages in thread
From: Eric Sunshine @ 2018-05-03 20:06 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Git Mailing List, Junio C Hamano, Kaartic Sivaraam,
	Johannes Schindelin

On Thu, May 3, 2018 at 1:15 PM, Johannes Sixt <j6t@kdbg.org> wrote:
> It is possible to configure 'less', the pager, to use an alternate
> screen to show the content, for example, by setting LESS=RS in the
> environment. When it is closed in this configuration, it switches
> back to the original screen, and all content is gone.
>
> It is not uncommon to request that the output remains visible in
> the terminal. For this, the option --no-pager can be used. But
> it is a bit cumbersome to type, even when command completion is
> available. Provide a short option, -P, to make the option easier
> accessible.

s/easier accessible/easier to access/
--- or ---
s/easier accessible/more easily accessible/
--- or ---
s/easier accessible/more accessible/

The patch itself looks fine.

> Signed-off-by: Johannes Sixt <j6t@kdbg.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] git: add -P as a short option for --no-pager
  2018-05-03 20:06   ` Eric Sunshine
@ 2018-05-04  5:43     ` Junio C Hamano
  0 siblings, 0 replies; 14+ messages in thread
From: Junio C Hamano @ 2018-05-04  5:43 UTC (permalink / raw)
  To: Eric Sunshine
  Cc: Johannes Sixt, Git Mailing List, Kaartic Sivaraam,
	Johannes Schindelin

Eric Sunshine <sunshine@sunshineco.com> writes:

>> available. Provide a short option, -P, to make the option easier
>> accessible.
>
> s/easier accessible/easier to access/
> --- or ---
> s/easier accessible/more easily accessible/
> --- or ---
> s/easier accessible/more accessible/
>
> The patch itself looks fine.

Thanks.  More easily accessible, it is.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] git: add -P as a short option for --no-pager
  2018-05-03 17:15 ` [PATCH v2] git: add -P " Johannes Sixt
  2018-05-03 20:06   ` Eric Sunshine
@ 2018-12-21 12:04   ` Johannes Schindelin
  1 sibling, 0 replies; 14+ messages in thread
From: Johannes Schindelin @ 2018-12-21 12:04 UTC (permalink / raw)
  To: Johannes Sixt
  Cc: Git Mailing List, Junio C Hamano, Eric Sunshine, Kaartic Sivaraam

Hi Hannes,

On Thu, 3 May 2018, Johannes Sixt wrote:

> It is possible to configure 'less', the pager, to use an alternate
> screen to show the content, for example, by setting LESS=RS in the
> environment. When it is closed in this configuration, it switches
> back to the original screen, and all content is gone.
> 
> It is not uncommon to request that the output remains visible in
> the terminal. For this, the option --no-pager can be used. But
> it is a bit cumbersome to type, even when command completion is
> available. Provide a short option, -P, to make the option easier
> accessible.
> 
> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
>  Given the positive feedback, I resurrect the patch.
> 
>  Changes since v1:
>  - Use -P instead of -N
>  - Commit message changed as proposed by Kaartic

Just a quick note, as mine was a vocal voice against this patch: I find
myself using this more and more. So I was wrong to object, and I
apologize.

Thank you,
Dscho

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-12-21 12:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 16:59 [PATCH] git: add -N as a short option for --no-pager Johannes Sixt
2018-04-25  0:05 ` Junio C Hamano
2018-04-25  5:45   ` Beat Bolli <bbolli@ewanet.ch>
2018-04-25  6:25   ` Johannes Sixt
2018-04-25  7:41     ` Johannes Schindelin
2018-04-25 19:30       ` Johannes Sixt
2018-05-01 11:41     ` Kaartic Sivaraam
2018-04-25  9:21 ` Phillip Wood
2018-04-25 19:31   ` Johannes Sixt
2018-05-01 11:25     ` Kaartic Sivaraam
2018-05-03 17:15 ` [PATCH v2] git: add -P " Johannes Sixt
2018-05-03 20:06   ` Eric Sunshine
2018-05-04  5:43     ` Junio C Hamano
2018-12-21 12:04   ` Johannes Schindelin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).