[Surfraw-commits] [SCM] surfraw - a fast unix command line interface to WWW branch, master, updated. surfraw_2-2-5_1-244-gff6adcd
Kyle Isom
coder at kyleisom.net
Wed Oct 17 04:05:30 UTC 2012
The following commit has been merged in the master branch:
commit ff6adcd1aadd449dff3a38ef10ff3f2939ebf04c
Author: Kyle Isom <coder at kyleisom.net>
Date: Tue Oct 16 22:03:56 2012 -0600
Correct an issue/bug on the new searchable/multiple bookmarks.
Via Thomas Zervogiannis <tzervo at gmail.com>
diff --git a/elvi/google b/elvi/google
index 12eb4a5..a10f917 100755
--- a/elvi/google
+++ b/elvi/google
@@ -25,6 +25,7 @@ Local options:
images | Images
videos | Videos
maps | Maps
+ groups | groups
news | News
bsd | BSD
linux | Linux
@@ -38,7 +39,8 @@ Local options:
-i, -images Image Search (same as -search=images)
-v, -videos Video Search (same as -search=videos)
-m, -maps Map Search (same as -search=maps)
- -n, -news News Search (same as -search-news)
+ -n, -news News Search (same as -search=news)
+ -g, -groups Groups Search (same as -search=groups)
-safe= Safe Search level
default | Default: $SURFRAW_google_safe
off | Environment: SURFRAW_google_safe
@@ -61,6 +63,7 @@ w3_parse_option_hook () {
-v*) setopt SURFRAW_google_search videos ;;
-m*) setopt SURFRAW_google_search maps ;;
-n|-news) setopt SURFRAW_google_search news ;;
+ -g|-groups) setopt SURFRAW_google_search groups ;;
*) return 1 ;;
esac
return 0
@@ -95,6 +98,7 @@ if test -z "$w3_args" ; then
case "$SURFRAW_google_search" in
i*) url="${url}images" ;;
m*) url="${url}maps" ;;
+ g*) url="${url}groups" ;;
n*) url="${url}news" ;;
v*) url="${url}video" ;;
*) url="${url}www" ;;
@@ -106,6 +110,7 @@ else
v*) url="${url}www"; search="search"; extra="&tbo=p&tbm=vid";;
i*) url="${url}images" ; search="images";;
m*) url="${url}maps" ; search=maps ;;
+ g*) url="${url}groups" ; search=groups ;;
n*) url="${url}news" ; search=news ;;
*) url="${url}www" ;;
esac
diff --git a/surfraw.IN b/surfraw.IN
index e360605..048030f 100755
--- a/surfraw.IN
+++ b/surfraw.IN
@@ -507,10 +507,16 @@ EOF
parse_bookmark()
{
if [ -z "$w3_args" ]; then
- # Keep only the domain address, the rest could be garbage.
- # This bookmark was probably meant to be used like that anyway.
- echo "$bookmark" | grep -q '%s' && \
- bookmark=$(echo $bookmark | @AWK@ -F '/' '{print $1 "//" $3}')
+ case "$bookmark" in
+ *"%s"*)
+ # Keep only the domain address, the rest contains %s which should be filtered.
+ bookmark=$(echo $bookmark | @AWK@ -F '/' '{print $1 "//" $3}')
+ ;;
+ *)
+ # Keep the first URL (if multiple-URL bookmark) as-is, no %s here...
+ bookmark=$(echo $bookmark | cut -f 1 -d ' ')
+ ;;
+ esac
else
escaped_args=$(w3_url_of_arg $w3_args)
@@ -522,8 +528,8 @@ parse_bookmark()
[ -z $SURFRAW_bookmark_search_elvis ] && SURFRAW_bookmark_search_elvis=google
bookmark=$(echo $bookmark | sed -e 's|^|site:|' \
-e 's|\ |\ OR\ site:|g' \
- -e "s|^|$SURFRAW_bookmark_search_elvis |" \
- -e "s|$| $w3_args|")
+ -e "s|^|$w3_args |" \
+ -e "s|^|$SURFRAW_bookmark_search_elvis |")
;;
esac
fi
--
surfraw - a fast unix command line interface to WWW
More information about the Surfraw-commits
mailing list