* [PATCH 1/2] web--browse: use custom commands defined at config time
@ 2008-03-14 4:56 Christian Couder
2008-03-15 13:00 ` Xavier Maillard
0 siblings, 1 reply; 4+ messages in thread
From: Christian Couder @ 2008-03-14 4:56 UTC (permalink / raw)
To: Junio Hamano, Eric Wong; +Cc: git, Jay Soffian, Xavier Maillard
This a steal from 964473a0429f625d019c69ab55644540174acf85 by
Charles Bailey.
Currently "git web--browse" is restricted to a set of commands defined
in the script. You can subvert the "browser.<tool>.path" to force "git
web--browse" to use a different command, but if you have a command
whose invocation syntax does not match one of the current tools then
you would have to write a wrapper script for it.
This patch adds a git config variable "browser.<tool>.cmd" which
allows a more flexible browser choice.
If you run "git web--browse" with -t/--tool, -b/--browser or the
"web.browser" config variable set to an unrecognized tool then "git
web--browse" will query the "browser.<tool>.cmd" config variable. If
this variable exists, then "git web--browse" will treat the specified
tool as a custom command and will use a shell eval to run the command
with the URLs added as extra parameters.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
git-web--browse.sh | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/git-web--browse.sh b/git-web--browse.sh
index 1023b90..384148a 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -23,12 +23,18 @@ USAGE='[--browser=browser|--tool=browser] [--config=conf.var] url/file ...'
NONGIT_OK=Yes
. git-sh-setup
+valid_custom_tool()
+{
+ browser_cmd="$(git config "browser.$1.cmd")"
+ test -n "$browser_cmd"
+}
+
valid_tool() {
case "$1" in
firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open)
;; # happy
*)
- return 1
+ valid_custom_tool "$1" || return 1
;;
esac
}
@@ -122,7 +128,7 @@ else
init_browser_path "$browser"
- if ! type "$browser_path" > /dev/null 2>&1; then
+ if test -z "$browser_cmd" && ! type "$browser_path" > /dev/null 2>&1; then
die "The browser $browser is not available as '$browser_path'."
fi
fi
@@ -157,4 +163,9 @@ case "$browser" in
dillo)
"$browser_path" "$@" &
;;
+ *)
+ if test -n "$browser_cmd"; then
+ ( eval $browser_cmd "$@" )
+ fi
+ ;;
esac
--
1.5.4.4.598.gcdb00b
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] web--browse: use custom commands defined at config time
2008-03-14 4:56 [PATCH 1/2] web--browse: use custom commands defined at config time Christian Couder
@ 2008-03-15 13:00 ` Xavier Maillard
2008-03-18 4:56 ` Christian Couder
0 siblings, 1 reply; 4+ messages in thread
From: Xavier Maillard @ 2008-03-15 13:00 UTC (permalink / raw)
To: Christian Couder; +Cc: junkio, normalperson, git, jaysoffian
This patch adds a git config variable "browser.<tool>.cmd" which
allows a more flexible browser choice.
Well done ! Now we need it in help.c too :)
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Tested-by: Xavier Maillard <xma@gnu.org>
---
git-web--browse.sh | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
Please update the header file as well (copyright header, it is
year 2008 here :)).
Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] web--browse: use custom commands defined at config time
2008-03-15 13:00 ` Xavier Maillard
@ 2008-03-18 4:56 ` Christian Couder
2008-03-19 1:00 ` Xavier Maillard
0 siblings, 1 reply; 4+ messages in thread
From: Christian Couder @ 2008-03-18 4:56 UTC (permalink / raw)
To: Xavier Maillard; +Cc: junkio, normalperson, git, jaysoffian
Le samedi 15 mars 2008, Xavier Maillard a écrit :
> This patch adds a git config variable "browser.<tool>.cmd" which
> allows a more flexible browser choice.
>
> Well done ! Now we need it in help.c too :)
I started by "man.<tool>.path" (patches should follow soon), and I will work
on "man.<tool>.cmd" really soon now.
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
>
> Tested-by: Xavier Maillard <xma@gnu.org>
Thanks again for your tests. They are very much appreciated.
> Please update the header file as well (copyright header, it is
> year 2008 here :)).
Is it so important ? Some files like "help.c" don't even have copyright
notice. Isn't it ok as long as they come with the license file (COPYING) ?
Thanks,
Christian.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] web--browse: use custom commands defined at config time
2008-03-18 4:56 ` Christian Couder
@ 2008-03-19 1:00 ` Xavier Maillard
0 siblings, 0 replies; 4+ messages in thread
From: Xavier Maillard @ 2008-03-19 1:00 UTC (permalink / raw)
To: Christian Couder; +Cc: junkio, normalperson, git, jaysoffian
> Please update the header file as well (copyright header, it is
> year 2008 here :)).
Is it so important ? Some files like "help.c" don't even have copyright
notice. Isn't it ok as long as they come with the license file (COPYING) ?
Dunno if it is "important" for the Git project, it is a habit :)
By the way, is there any policy on that topic ?
Xavier
--
http://www.gnu.org
http://www.april.org
http://www.lolica.org
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-19 19:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-14 4:56 [PATCH 1/2] web--browse: use custom commands defined at config time Christian Couder
2008-03-15 13:00 ` Xavier Maillard
2008-03-18 4:56 ` Christian Couder
2008-03-19 1:00 ` Xavier Maillard
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).