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

Ian Beckwith ianb at erislabs.net
Thu Nov 12 02:34:35 UTC 2009


The following commit has been merged in the master branch:
commit 938a15b039fc58b9aabec8b2a1d68b3dde8cfe78
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Thu Nov 12 02:34:28 2009 +0000

    new elvi: macportspkg

diff --git a/ChangeLog b/ChangeLog
index 2e60272..023becf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
 2009-11-12  Ian Beckwith  <ianb at erislabs.net>
 
-	* New elvi: finkpkg: search Fink packages.
+	* New elvi:
+	  + finkpkg: search Fink packages.
+	  + macportspkg: search macports packages.
 	* surfraw.IN: w3_parse_args: avoid bogus initial space in w3_args
 
 2009-11-11  Ian Beckwith  <ianb at erislabs.net>
diff --git a/README b/README
index b5f63d4..f90062c 100644
--- a/README
+++ b/README
@@ -209,6 +209,7 @@ l1sp            -- Search lisp documentation
 lastfm          -- Search last.fm
 leodict         -- Search Leo's German <-> English dictionary (dict.leo.org)
 lsm             -- Search the Linux Software Map
+macportspkg	-- Search macports packages (macports.org)
 mathworld       -- Search Wolfram MathWorld
 mininova        -- Search the mininova bittorent source.
 musicbrainz     -- Search MusicBrainz (musicbrainz.org)
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index 2a13e21..b28b59c 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -63,6 +63,7 @@ dist_elvi_SCRIPTS	= \
 		  lastfm \
 		  leodict \
 		  lsm \
+		  macportspkg \
 		  mathworld \
 		  mininova \
 		  musicbrainz \
diff --git a/elvi/Makefile.in b/elvi/Makefile.in
index 2a49c1e..8dfdb41 100644
--- a/elvi/Makefile.in
+++ b/elvi/Makefile.in
@@ -51,11 +51,12 @@ am__dist_elvi_SCRIPTS_DIST = W acronym alioth altavista amazon archpkg \
 	foldoc filesearching finkpkg freebsd freedb freshmeat fsfdir \
 	gcache genbugs genpkg genportage gutenberg google happypenguin \
 	imdb ixquick javasun scpan slinuxdoc l1sp lastfm leodict lsm \
-	mathworld mininova musicbrainz netbsd ntrs openbsd piratebay \
-	pgpkeys port pubmed rae rfc rhyme scholar scicom slashdot \
-	sourceforge springer stockquote sunonesearch thesaurus \
-	translate urban w3css w3html w3link w3rdf wayback webster \
-	wetandwild wikipedia woffle yahoo youtube yubnub opensearch
+	macportspkg mathworld mininova musicbrainz netbsd ntrs openbsd \
+	piratebay pgpkeys port pubmed rae rfc rhyme scholar scicom \
+	slashdot sourceforge springer stockquote sunonesearch \
+	thesaurus translate urban w3css w3html w3link w3rdf wayback \
+	webster wetandwild wikipedia woffle yahoo youtube yubnub \
+	opensearch
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -168,12 +169,12 @@ dist_elvi_SCRIPTS = W acronym alioth altavista amazon archpkg arxiv \
 	discogs dmoz ebay etym excite fast foldoc filesearching \
 	finkpkg freebsd freedb freshmeat fsfdir gcache genbugs genpkg \
 	genportage gutenberg google happypenguin imdb ixquick javasun \
-	scpan slinuxdoc l1sp lastfm leodict lsm mathworld mininova \
-	musicbrainz netbsd ntrs openbsd piratebay pgpkeys port pubmed \
-	rae rfc rhyme scholar scicom slashdot sourceforge springer \
-	stockquote sunonesearch thesaurus translate urban w3css w3html \
-	w3link w3rdf wayback webster wetandwild wikipedia woffle yahoo \
-	youtube yubnub $(am__append_1)
+	scpan slinuxdoc l1sp lastfm leodict lsm macportspkg mathworld \
+	mininova musicbrainz netbsd ntrs openbsd piratebay pgpkeys \
+	port pubmed rae rfc rhyme scholar scicom slashdot sourceforge \
+	springer stockquote sunonesearch thesaurus translate urban \
+	w3css w3html w3link w3rdf wayback webster wetandwild wikipedia \
+	woffle yahoo youtube yubnub $(am__append_1)
 all: all-am
 
 .SUFFIXES:
diff --git a/elvi/macportspkg b/elvi/macportspkg
new file mode 100755
index 0000000..982ba72
--- /dev/null
+++ b/elvi/macportspkg
@@ -0,0 +1,48 @@
+#!/bin/sh
+# elvis: macportspkg	-- Search macports packages (macports.org)
+# ianb at erislabs.net 20091112
+
+. surfraw || exit 1
+
+w3_config_hook () {
+def   SURFRAW_macportspkg_by     name
+}
+
+w3_usage_hook () {
+    cat <<EOF
+Usage: $w3_argv0 [options] [search words]...
+Description:
+  Search macports packages (macports.org)
+Local options:
+  -by=TYPE                      Search by TYPE
+      name            |          Software Title (default)
+      category        |          Category
+      maintainer      |          Maintainer
+      variant         |          Variant
+      platform        |          Platform
+EOF
+    w3_global_usage
+}
+
+w3_parse_option_hook () {
+    opt="$1"
+    optarg="$2"
+    case "$opt" in
+	-by*=*)     setopt   SURFRAW_macportspkg_by           $optarg ;;
+	*) return 1 ;;
+    esac
+    return 0
+}
+
+w3_config
+w3_parse_args "$@"
+# w3_args now contains a list of arguments
+escaped_args=$(w3_url_of_arg $w3_args)
+
+url="http://www.macports.org/ports.php"
+if [ -n "$escaped_args" ]
+then
+    url="${url}?by=${SURFRAW_macportspkg_by}&substr=${escaped_args}"
+fi
+
+w3_browse_url "$url"
diff --git a/links.IN b/links.IN
index 58f2192..e1d4d7b 100644
--- a/links.IN
+++ b/links.IN
@@ -57,6 +57,7 @@ elvi.1sr.gz @mandir@/man1/lastfm.1sr.gz
 elvi.1sr.gz @mandir@/man1/leodict.1sr.gz
 elvi.1sr.gz @mandir@/man1/l1sp.1sr.gz
 elvi.1sr.gz @mandir@/man1/lsm.1sr.gz
+elvi.1sr.gz @mandir@/man1/macportspkg.1sr.gz
 elvi.1sr.gz @mandir@/man1/mathworld.1sr.gz
 elvi.1sr.gz @mandir@/man1/mininova.1sr.gz
 elvi.1sr.gz @mandir@/man1/musicbrainz.1sr.gz
diff --git a/test/freshmeat.test b/test/macportspkg.test
similarity index 66%
copy from test/freshmeat.test
copy to test/macportspkg.test
index 04bcfe1..e8f3a16 100644
--- a/test/freshmeat.test
+++ b/test/macportspkg.test
@@ -1,2 +1,3 @@
-freshmeat surfraw
+macportspkg surfraw
 Revolutionary Front Rage Against the Web
+

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



More information about the Surfraw-commits mailing list