builtin-help: fallback to GIT_MAN_VIEWER before man
In some situations it is useful to be able to switch viewers via the environment, e.g. in Emacs shell buffers. So check the GIT_MAN_VIEWER environment variable and try it before falling back to "man". Signed-off-by: Romain Francoise <romain@orebokech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
445cac18c0
commit
5059a42780
@ -112,7 +112,9 @@ For example, this configuration:
|
|||||||
will try to use konqueror first. But this may fail (for example if
|
will try to use konqueror first. But this may fail (for example if
|
||||||
DISPLAY is not set) and in that case emacs' woman mode will be tried.
|
DISPLAY is not set) and in that case emacs' woman mode will be tried.
|
||||||
|
|
||||||
If everything fails the 'man' program will be tried anyway.
|
If everything fails, or if no viewer is configured, the viewer specified
|
||||||
|
in the GIT_MAN_VIEWER environment variable will be tried. If that
|
||||||
|
fails too, the 'man' program will be tried anyway.
|
||||||
|
|
||||||
man.<tool>.path
|
man.<tool>.path
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
|
@ -361,12 +361,15 @@ static void show_man_page(const char *git_cmd)
|
|||||||
{
|
{
|
||||||
struct man_viewer_list *viewer;
|
struct man_viewer_list *viewer;
|
||||||
const char *page = cmd_to_page(git_cmd);
|
const char *page = cmd_to_page(git_cmd);
|
||||||
|
const char *fallback = getenv("GIT_MAN_VIEWER");
|
||||||
|
|
||||||
setup_man_path();
|
setup_man_path();
|
||||||
for (viewer = man_viewer_list; viewer; viewer = viewer->next)
|
for (viewer = man_viewer_list; viewer; viewer = viewer->next)
|
||||||
{
|
{
|
||||||
exec_viewer(viewer->name, page); /* will return when unable */
|
exec_viewer(viewer->name, page); /* will return when unable */
|
||||||
}
|
}
|
||||||
|
if (fallback)
|
||||||
|
exec_viewer(fallback, page);
|
||||||
exec_viewer("man", page);
|
exec_viewer("man", page);
|
||||||
die("no man viewer handled the request");
|
die("no man viewer handled the request");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user