* [PATCH 2/4] help--browse: add '--config' option to check a config option for a browser.
@ 2008-02-02 6:32 Christian Couder
0 siblings, 0 replies; only message in thread
From: Christian Couder @ 2008-02-02 6:32 UTC (permalink / raw)
To: Junio Hamano, Eric Wong; +Cc: git
The value of this new command line option will be used as a key to
check the configuration for an help browser.
This should remove the last bit in 'git-help--browse' that was
specific to 'git-help', so that other git command can use
'git-help--browse'.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
git-help--browse.sh | 23 ++++++++++++++++++-----
help.c | 2 +-
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/git-help--browse.sh b/git-help--browse.sh
index 8189c08..9953e16 100755
--- a/git-help--browse.sh
+++ b/git-help--browse.sh
@@ -16,7 +16,7 @@
# git maintainer.
#
-USAGE='[--browser=browser|--tool=browser] url/file ...'
+USAGE='[--browser=browser|--tool=browser] [--config=conf.var] url/file ...'
# This must be capable of running outside of git directory, so
# the vanilla git-sh-setup should not be used.
@@ -53,6 +53,18 @@ do
shift ;;
esac
;;
+ -c|--config*)
+ case "$#,$1" in
+ *,*=*)
+ conf=`expr "z$1" : 'z-[^=]*=\(.*\)'`
+ ;;
+ 1,*)
+ usage ;;
+ *)
+ conf="$2"
+ shift ;;
+ esac
+ ;;
--)
break
;;
@@ -70,15 +82,16 @@ test $# = 0 && usage
if test -z "$browser"
then
- for opt in "help.browser" "web.browser"
+ for opt in "$conf" "web.browser"
do
+ test -z "$opt" && continue
browser="`git config $opt`"
test -z "$browser" || break
done
if test -n "$browser" && ! valid_tool "$browser"; then
- echo >&2 "git config option $opt set to unknown browser: $browser"
- echo >&2 "Resetting to default..."
- unset browser
+ echo >&2 "git config option $opt set to unknown browser: $browser"
+ echo >&2 "Resetting to default..."
+ unset browser
fi
fi
diff --git a/help.c b/help.c
index b929899..058a397 100644
--- a/help.c
+++ b/help.c
@@ -347,7 +347,7 @@ static void show_html_page(const char *git_cmd)
get_html_page_path(&page_path, page);
- execl_git_cmd("help--browse", page_path.buf, NULL);
+ execl_git_cmd("help--browse", "-c", "help.browser", page_path.buf, NULL);
}
void help_unknown_cmd(const char *cmd)
--
1.5.4.rc5.25.g7a831-dirty
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2008-02-02 6:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-02 6:32 [PATCH 2/4] help--browse: add '--config' option to check a config option for a browser Christian Couder
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 NNTP newsgroup(s).