git: add -P as a short option for --no-pager
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 more easily accessible. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt committed
May 3, 2018 at 19:15 UTC
7213c288187bd9ef1e32e4f86c20c55436f1ae90
2 files changed
+4
-3
Documentation/git.txt
+2
-1
@@ -11,7 +11,7 @@ SYNOPSIS
11
[verse]
12
'git' [--version] [--help] [-C <path>] [-c <name>=<value>]
13
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
14
- [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
14
+ [-p|--paginate|-P|--no-pager] [--no-replace-objects] [--bare]
15
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
16
[--super-prefix=<path>]
17
<command> [<args>]
@@ -103,6 +103,7 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
103
configuration options (see the "Configuration Mechanism" section
104
below).
105
106
+-P::
107
--no-pager::
108
Do not pipe Git output into a pager.
109
git.c
+2
-2
@@ -7,7 +7,7 @@
7
const char git_usage_string[] =
8
N_("git [--version] [--help] [-C <path>] [-c <name>=<value>]\n"
9
" [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
10
- " [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n"
10
+ " [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]\n"
11
" [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
12
" <command> [<args>]");
13
@@ -81,7 +81,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
81
exit(0);
82
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
83
use_pager = 1;
84
- } else if (!strcmp(cmd, "--no-pager")) {
84
+ } else if (!strcmp(cmd, "-P") || !strcmp(cmd, "--no-pager")) {
85
use_pager = 0;
86
if (envchanged)
87
*envchanged = 1;