[Surfraw-commits] [SCM] surfraw - a fast unix command line interface to WWW branch, master, updated. surfraw_2-2-5_1-229-g7c5c682

Ivy Foster joyfulgirl at archlinux.us
Thu Jun 28 18:30:10 UTC 2012


The following commit has been merged in the master branch:
commit 206a502354b94c6c384679901ece493898844bdf
Author: Ivy Foster <joyfulgirl at archlinux.us>
Date:   Thu Jun 28 13:36:41 2012 -0400

    Further simplified searchable bookmarks

diff --git a/surfraw.IN b/surfraw.IN
index 285b34f..e360605 100755
--- a/surfraw.IN
+++ b/surfraw.IN
@@ -509,36 +509,27 @@ 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.
-        bookmark=$(get_domain_from_bookmark)
+        echo "$bookmark" | grep -q '%s' && \
+            bookmark=$(echo $bookmark | @AWK@ -F '/' '{print $1 "//" $3}')
     else
         escaped_args=$(w3_url_of_arg $w3_args)
 
         case "$bookmark" in
             *"%s"*)
-                bookmark="$(printf '%s\n' "$bookmark" | sed "s|\%s|$escaped_args|")"
+                bookmark="$(echo $bookmark | sed "s|\%s|$escaped_args|")"
                 ;;
             *)
-                bookmark=$(echo $bookmark | sed -e 's|^|site:|' -e 's|\ |\ OR\ site:|g')
-                bookmark="$w3_args $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|")
                 ;;
         esac
     fi
     echo $bookmark
 }
 
-get_domain_from_bookmark ()
-{
-    case "$bookmark" in
-        https://*)
-            bookmark=https://$(echo $bookmark | @AWK@ -F '/' '{print $3}')/
-            ;;
-        *)
-            bookmark=http://$(echo $bookmark | @AWK@ -F '/' '{print $3}')/
-            ;;
-    esac
-    echo $bookmark
-}
-
 if [ "$w3_argv0" = "surfraw" -o "$w3_argv0" = "sr" ]
 then
 	w3_config

-- 
surfraw -  a fast unix command line interface to WWW



More information about the Surfraw-commits mailing list