[Surfraw-commits] [surfraw] 01/03: new elvi daringly named S: uses w3_custom_search for searching

Ian Beckwith ianb at alioth.debian.org
Sun Oct 6 04:30:56 UTC 2013


This is an automated email from the git hooks/post-receive script.

ianb pushed a commit to branch 2.2.9_release_candidate
in repository surfraw.

commit 30c89333869a282c35a4e170af7adde44330ef01
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Sun Oct 6 05:09:08 2013 +0100

    new elvi daringly named S: uses w3_custom_search for searching
---
 AUTHORS          |    2 +-
 ChangeLog        |    4 +++-
 NEWS             |    1 +
 elvi/Makefile.am |    1 +
 elvi/S           |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 links.IN         |    1 +
 6 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 71aac91..ccc92d1 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -16,7 +16,7 @@ Ian Beckwith <ianb at erislabs.net>
               finkpkg, rpmsearch, macports, debpkghome, debvcsbrowse,
               scroogle, scirus, scitopia, worldwidescience,
               debcodesearch, jquery, mdn, mysqldoc, pgdoc,
-              phpdoc, oraclesearch
+              phpdoc, oraclesearch, S
         plus various tweaks/bugfixes/features.
 
 Moritz Muehlenhoff <jmm at inutil.org>
diff --git a/ChangeLog b/ChangeLog
index 651843a..49ee78b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,9 @@
 2013-10-05  Ian Beckwith  <ianb at erislabs.net>
 
 	* ask, cisco: fix elvi.
-	* new elvi: oraclesearch. Replaces removed sunonesearch <sigh>.
+	* new elvi:
+	  + oraclesearch - Replaces removed sunonesearch <sigh>.
+	  + S - search using w3_custom_search.
 	* google: -g for groups clashed with -g for graphical browser.
 	  Invoke groups with -G, -gr, -groups or -search=groups.
 	* mdn: site invokes google custom search via gratuitous
diff --git a/NEWS b/NEWS
index cf3732d..b897e6b 100644
--- a/NEWS
+++ b/NEWS
@@ -18,6 +18,7 @@
 Sun Oct  6 02:17:09 BST 2013  - surfraw 2.2.9
 
         * New elvi:
+          + S - search using w3_custom_search (see below)
           + cisco - search Cisco documentation
           + debcodesearch - search Debian codebase
           + github - search github
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index ba0d99e..adae4b5 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -2,6 +2,7 @@
 elvidir=$(ELVIDIR)
 
 dist_elvi_SCRIPTS	= \
+		  S \
 		  W \
 		  acronym \
 		  ads \
diff --git a/elvi/S b/elvi/S
new file mode 100755
index 0000000..dd2f62b
--- /dev/null
+++ b/elvi/S
@@ -0,0 +1,46 @@
+#!/bin/sh
+# ianb at erislabs.net 20131006
+# elvis: S		-- Search using custom search provider
+. surfraw || exit 1
+
+w3_config_hook () {
+    def   SURFRAW_S_site ""
+    def   SURFRAW_S_inurl ""
+}
+
+
+
+w3_usage_hook () {
+    cat <<EOF
+Usage: $w3_argv0 [options] [search words]...
+Description:
+  Surfraw search using a custom search provider
+Local options:
+  -s=SITE                       Limit search to SITE
+  -u=INURL                      Limit search to URLs containing INURL
+EOF
+    w3_custom_search_usage
+    w3_global_usage
+}
+
+w3_parse_option_hook () {
+    opt="$1"
+    optarg="$2"
+    case "$opt" in
+        -s=*)    SURFRAW_S_site="$SURFRAW_S_site -s=$optarg" ;;
+        -u=*)    SURFRAW_S_inurl="$SURFRAW_S_inurl -u=$optarg" ;;
+    *) return 1 ;;
+    esac
+    return 0
+}
+
+w3_config
+w3_parse_args "$@"
+
+if test -z "$w3_args"
+then
+    w3_custom_search
+else
+    # FIXME: sort out quoting
+    w3_custom_search $SURFRAW_S_site $SURFRAW_S_inurl "$w3_shquoted_args"
+fi
diff --git a/links.IN b/links.IN
index e0afe63..ea1df67 100644
--- a/links.IN
+++ b/links.IN
@@ -1,4 +1,5 @@
 elvi.1sr.gz @mandir@/man1/W.1.gz
+elvi.1sr.gz @mandir@/man1/S.1sr.gz
 elvi.1sr.gz @mandir@/man1/acronym.1sr.gz
 elvi.1sr.gz @mandir@/man1/ads.1sr.gz
 elvi.1sr.gz @mandir@/man1/alioth.1sr.gz

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/surfraw/surfraw.git



More information about the Surfraw-commits mailing list