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

Ian Beckwith ianb at erislabs.net
Thu Nov 12 01:59:09 UTC 2009


The following commit has been merged in the master branch:
commit 27ccd0a888819b5ee77f86532dd06b6996dec386
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Thu Nov 12 01:55:06 2009 +0000

    new elvi: finkpkg

diff --git a/ChangeLog b/ChangeLog
index decbacc..6e5cf29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-12  Ian Beckwith  <ianb at erislabs.net>
+
+	* New elvi: finkpkg: search Fink packages.
+
 2009-11-11  Ian Beckwith  <ianb at erislabs.net>
 
 	* New elvi: debpkghome: view home page of a debian package.
diff --git a/README b/README
index c691f9f..b5f63d4 100644
--- a/README
+++ b/README
@@ -189,6 +189,7 @@ etym            -- Look up word origins at www.etymonline.com
 excite          -- Search on Excite (www.excite.com)
 fast            -- Search the web using FAST Search (www.alltheweb.com)
 filesearching   -- Search files on filesearching (www.filesearching.com)
+finkpkg         -- Search Fink packages (pdb.finkproject.org)
 foldoc          -- The Free On-Line Dictionary Of Computing (foldoc.org)
 freebsd         -- Search FreeBSD related information (www.freebsd.org)
 freedb          -- Search for cd track listings in FreeDB (www.freedb.org)
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index 4c072b4..2a13e21 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -42,6 +42,7 @@ dist_elvi_SCRIPTS	= \
 		  fast \
 		  foldoc \
 		  filesearching \
+		  finkpkg \
 		  freebsd \
 		  freedb \
 		  freshmeat \
diff --git a/elvi/Makefile.in b/elvi/Makefile.in
index 86da46b..2a49c1e 100644
--- a/elvi/Makefile.in
+++ b/elvi/Makefile.in
@@ -48,9 +48,9 @@ am__dist_elvi_SCRIPTS_DIST = W acronym alioth altavista amazon archpkg \
 	codesearch comlaw ctan currency cve debbugs debcontents \
 	deblists deblogs debpackages debpkghome debpts debsec \
 	debvcsbrowse debwiki deja discogs dmoz ebay etym excite fast \
-	foldoc filesearching freebsd freedb freshmeat fsfdir gcache \
-	genbugs genpkg genportage gutenberg google happypenguin imdb \
-	ixquick javasun scpan slinuxdoc l1sp lastfm leodict lsm \
+	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 \
@@ -166,7 +166,7 @@ dist_elvi_SCRIPTS = W acronym alioth altavista amazon archpkg arxiv \
 	comlaw ctan currency cve debbugs debcontents deblists deblogs \
 	debpackages debpkghome debpts debsec debvcsbrowse debwiki deja \
 	discogs dmoz ebay etym excite fast foldoc filesearching \
-	freebsd freedb freshmeat fsfdir gcache genbugs genpkg \
+	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 \
diff --git a/elvi/finkpkg b/elvi/finkpkg
new file mode 100755
index 0000000..e07ac34
--- /dev/null
+++ b/elvi/finkpkg
@@ -0,0 +1,152 @@
+#!/bin/sh
+# elvis: finkpkg		-- Search Fink packages (pdb.finkproject.org)
+# ianb at erislabs.net 20091111
+
+. surfraw || exit 1
+
+w3_config_hook () {
+def   SURFRAW_fink_pkgname     ""
+def   SURFRAW_fink_maintainer  ""
+def   SURFRAW_fink_distro      default
+def   SURFRAW_fink_arch        any
+def   SURFRAW_fink_tree        any
+def   SURFRAW_fink_section     any
+defyn SURFRAW_fink_exact       no
+defyn SURFRAW_fink_nomaint     no
+defyn SURFRAW_fink_nochildren  no
+defyn SURFRAW_fink_noshlibsdev no
+}
+
+w3_usage_hook () {
+    cat <<EOF
+Usage: $w3_argv0 [options] [search words]...
+Description:
+  Search Fink packages (pdb.finkproject.org)
+Local options:
+  -pkg=NAME                     Search by packagename for NAME
+  -maintainer=NAME              Search by maintainer for NAME
+  -dist=DIST                    Specify distribution DIST
+	default         |        Supported [10.5 & 10.6] (default)
+        any             |        Any
+        10.4            |        10.4
+        10.5            |        10.5
+        10.6            |        10.6
+  -arch=ARCH                    Search in arch ARCH
+        any             |        Any (default)
+	i386            |        i386
+	x86_64          |        X86_64 (aka AMD64)
+	powerpc         |        powerpc
+  -tree=TREE                    Search in tree TREE
+        any             |        Any (default)
+	unstable        |        Unstable
+	stable          |        Stable
+	bindist         |        Binary Distribution
+	testing         |        Packages that need testing
+  -section=SEC                  Search in section SEC
+        any             |        Any (default)
+        base            |        Core packages
+        crypto          |        Cryptographic software (subject to national regulations)
+        database        |        SQL and other database software
+        devel           |        Software for software development
+        editors         |        Text editors
+        games           |        Games and other fun stuff
+        gnome           |        The GNOME desktop environment (version 2.26)
+        graphics        |        Graphics applications and libraries
+        kde             |        K Desktop Environment (version 3.5.10 and 4.2.4)
+        languages       |        Programming languages (compilers, interpreters)
+        libs            |        General purpose libraries
+        libs/perlmods   |        Perl libraries
+        libs/pythonmods |        Python libraries
+        libs/rubymods   |        Ruby libraries
+        net             |        Network-related applications and libraries
+        sci             |        Scientific applications
+        shells          |        Shells (command line interpreters)
+        sound           |        Audio software
+        text            |        Text-processing software
+        utils           |        Utilities that do not fit elsewhere
+        web             |        Web-related software
+        x11             |        General X11 packages - toolkits and utilities
+        x11-system      |        X Window System core packages
+        x11-wm          |        Window managers for the X Window System
+  -exact                        Exact package matches only
+  -nomaint                      Find packages with no maintainer
+  -nochildren                   Exclude packages with parent
+                                 (includes most "-dev", "-shlibs", ... splitoffs)
+  -noshlibsdev                  Exclude -shlibs, -dev, -bin, -common, -doc packages
+EOF
+    w3_global_usage
+}
+
+w3_parse_option_hook () {
+    opt="$1"
+    optarg="$2"
+    case "$opt" in
+	-pkg*=*)    setopt   SURFRAW_fink_pkgname      $optarg ;;
+	-maint*=*)  setopt   SURFRAW_fink_maintainer   $optarg ;;
+	-dist*=*)   setopt   SURFRAW_fink_distro       $optarg ;;
+	-arch=*)    setopt   SURFRAW_fink_arch         $optarg ;;
+	-tree*=*)   setopt   SURFRAW_fink_tree         $optarg ;;
+	-sec*=*)    setopt   SURFRAW_fink_section      $optarg ;;
+	-ex*)       setoptyn SURFRAW_fink_exact        yes     ;;
+	-nomaint*)  setoptyn SURFRAW_fink_nomaint      yes     ;;
+	-noch*)     setoptyn SURFRAW_fink_nochildren   yes     ;;
+	-noshlib*)  setoptyn SURFRAW_fink_noshlibsdev  yes     ;;
+	*) 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://pdb.finkproject.org/pdb/browse.php"
+
+if [ -z "$escaped_args" ] && [ -z "$SURFRAW_fink_pkgname" ] && [ -z "$SURFRAW_fink_maintainer" ]
+then
+    w3_browse_url "$url"
+else
+    if [ "$SURFRAW_fink_arch" = any ]
+    then
+	SURFRAW_fink_arch=""
+    fi
+    if [ "$SURFRAW_fink_section" = any ]
+    then
+	SURFRAW_fink_section=""
+    fi
+    url="${url}?dist_name=${SURFRAW_fink_distro}"
+    url="${url}&architecture=${SURFRAW_fink_arch}"
+    url="${url}&tree=${SURFRAW_fink_tree}"
+    url="${url}&sec=${SURFRAW_fink_section}"
+    if [ -n "$escaped_args" ]
+    then
+	url="${url}&summary=${escaped_args}"
+    fi
+    if [ -n "$SURFRAW_fink_pkgname" ]
+    then
+	url="${url}&name=${SURFRAW_fink_pkgname}"
+    fi
+    if [ -n "$SURFRAW_fink_maintainer" ]
+    then
+	url="${url}&maintainer=${SURFRAW_fink_maintainer}"
+    fi
+    if ifyes SURFRAW_fink_exact
+    then
+	url="${url}&name_exact=on"
+    fi
+    if ifyes SURFRAW_fink_nomaint
+    then
+	url="$url&nomaintainer=on"
+    fi
+    if ifyes SURFRAW_fink_nochildren
+    then
+	url="$url&nochildren=on"
+    fi
+    if ifyes SURFRAW_fink_noshlibsdev
+    then
+	url="$url&noshlibsdev=on"
+    fi
+
+    w3_browse_url "$url"
+fi
diff --git a/links.IN b/links.IN
index 5ed03e2..58f2192 100644
--- a/links.IN
+++ b/links.IN
@@ -37,6 +37,7 @@ elvi.1sr.gz @mandir@/man1/etym.1sr.gz
 elvi.1sr.gz @mandir@/man1/excite.1sr.gz
 elvi.1sr.gz @mandir@/man1/fast.1sr.gz
 elvi.1sr.gz @mandir@/man1/filesearching.1sr.gz
+elvi.1sr.gz @mandir@/man1/finkpkg.1sr.gz
 elvi.1sr.gz @mandir@/man1/foldoc.1sr.gz
 elvi.1sr.gz @mandir@/man1/freebsd.1sr.gz
 elvi.1sr.gz @mandir@/man1/freedb.1sr.gz
diff --git a/test/finkpkg.test b/test/finkpkg.test
new file mode 100644
index 0000000..60ace05
--- /dev/null
+++ b/test/finkpkg.test
@@ -0,0 +1,4 @@
+finkpkg surfraw
+Revolutionary Front Rage Against the Web
+finkpkg -pkg=surfraw
+Revolutionary Front Rage Against the Web

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



More information about the Surfraw-commits mailing list