@matheusbsbs / matheus-bagliano / commits / 89a56bfbd3
Fork 0

add --html-path to get the location of installed HTML docs

This can be used in GUIs to open installed HTML documentation in the browser. Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Markus Heidelberg committed Apr 5, 2009 at 04:15 UTC 89a56bfbd3fd855cb0c2a381520e6255de41a55e
5 files changed +22 -3
Documentation/git.txt
+5 -1
@@ -9,7 +9,7 @@ git - the stupid content tracker
9 SYNOPSIS
10 --------
11 [verse]
12 -'git' [--version] [--exec-path[=GIT_EXEC_PATH]]
12 +'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
13 [-p|--paginate|--no-pager]
14 [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
15 [--help] COMMAND [ARGS]
@@ -178,6 +178,10 @@ help ...`.
178 environment variable. If no path is given, 'git' will print
179 the current setting and then exit.
180
181 +--html-path::
182 + Print the path to wherever your git HTML documentation is installed
183 + and exit.
184 +
185 -p::
186 --paginate::
187 Pipe all output into 'less' (or if set, $PAGER).
Makefile
+1
@@ -1191,6 +1191,7 @@ strip: $(PROGRAMS) git$X
1191
1192 git.o: git.c common-cmds.h GIT-CFLAGS
1193 $(QUIET_CC)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
1194 + '-DGIT_HTML_PATH="$(htmldir_SQ)"' \
1195 $(ALL_CFLAGS) -c $(filter %.c,$^)
1196
1197 git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)
contrib/completion/git-completion.bash
+1
@@ -1870,6 +1870,7 @@ _git ()
1870 --bare
1871 --version
1872 --exec-path
1873 + --html-path
1874 --work-tree=
1875 --help
1876 "
git.c
+4 -1
@@ -5,7 +5,7 @@
5 #include "run-command.h"
6
7 const char git_usage_string[] =
8 - "git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
8 + "git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
9
10 const char git_more_info_string[] =
11 "See 'git help COMMAND' for more information on a specific command.";
@@ -75,6 +75,9 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
75 puts(git_exec_path());
76 exit(0);
77 }
78 + } else if (!strcmp(cmd, "--html-path")) {
79 + puts(system_path(GIT_HTML_PATH));
80 + exit(0);
81 } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
82 use_pager = 1;
83 } else if (!strcmp(cmd, "--no-pager")) {
perl/Git.pm
+11 -1
@@ -56,7 +56,7 @@ require Exporter;
56 @EXPORT_OK = qw(command command_oneline command_noisy
57 command_output_pipe command_input_pipe command_close_pipe
58 command_bidi_pipe command_close_bidi_pipe
59 - version exec_path hash_object git_cmd_try
59 + version exec_path html_path hash_object git_cmd_try
60 remote_refs
61 temp_acquire temp_release temp_reset temp_path);
62
@@ -492,6 +492,16 @@ C<git --exec-path>). Useful mostly only internally.
492 sub exec_path { command_oneline('--exec-path') }
493
494
495 +=item html_path ()
496 +
497 +Return path to the Git html documentation (the same as
498 +C<git --html-path>). Useful mostly only internally.
499 +
500 +=cut
501 +
502 +sub html_path { command_oneline('--html-path') }
503 +
504 +
505 =item repo_path ()
506
507 Return path to the git repository. Must be called on a repository instance.