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

jasonwryan jasonwryan at gmail.com
Fri Jun 1 03:46:05 UTC 2012


The following commit has been merged in the master branch:
commit 9b144804c2108516a37a9c37fae450a61f542b62
Author: jasonwryan <jasonwryan at gmail.com>
Date:   Fri Jun 1 15:32:52 2012 +1200

    New elvi: github
    
    Search code on github.com

diff --git a/AUTHORS b/AUTHORS
index 02b33d9..4de85f3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -117,8 +117,8 @@ Kyle Isom <coder at kyleisom.net>
         elvi: cablesearch, duckduckgo, openports, wolfram
 	plus fixes.
 
-Jason Ryan <jasonwryan at gmail.com>
-        elvi: archwiki, deli, stack, pin
+Jason Ryan <jasonwryan at surfraw.org>
+        elvi: archwiki, deli, github, stack, pin
 
 Sara Fauzia <sara at archlinux.us>
         archpkg fix.
diff --git a/ChangeLog b/ChangeLog
index 994c3ee..e46f2d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-01  Jason Ryan <jasonwryan at surfraw.org>
+
+	* New elvi: github (search github.com)
+
 2011-10-10  Ian Beckwith  <ianb at erislabs.net>
 
 	* surfraw.IN: test_elvi(): tweak sed regex
diff --git a/README b/README
index 00a4d5c..3208bde 100644
--- a/README
+++ b/README
@@ -209,6 +209,7 @@ fsfdir          -- Search the FSF/UNESCO Free Software Directory (directory.fsf.
 gcache          -- Search the web using Google cache (www.google.com)
 genbugs         -- Search the Gentoo bug tracker (bugs.gentoo.org)
 genportage      -- Search gentoo-portage.com for packages
+github          -- Search github for code (www.github.com)
 google          -- Search the web using Google (www.google.com)
 gutenberg       -- Search for books on Project Gutenberg (gutenberg.org)
 happypenguin    -- Search the Linux Game Tome (www.happypenguin.org)
diff --git a/elvi/Makefile.am b/elvi/Makefile.am
index aa53291..4e26d23 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -57,6 +57,7 @@ dist_elvi_SCRIPTS	= \
 		  gcache \
 		  genbugs \
 		  genportage \
+		  github \
 		  gutenberg \
 		  google \
 		  happypenguin \
diff --git a/elvi/github b/elvi/github
new file mode 100755
index 0000000..c45a1bf
--- /dev/null
+++ b/elvi/github
@@ -0,0 +1,67 @@
+#!/bin/sh
+# elvis: github		-- Search GitHub (https://github.com)
+# Author: jason ryan • https://jasonwryan.com
+
+. surfraw || exit 1
+
+w3_config_hook () {
+def   SURFRAW_git_type        "$SURFRAW_type"
+def   SURFRAW_git_lang         any 
+}
+
+w3_usage_hook () {
+    cat <<EOF
+
+Usage: $w3_argv0 [options] [search-string]
+Description: 
+	Search Github (https://github.com)
+
+	Local options:
+	-l=LANGUAGE   |  -lang=LANGUAGE
+	Languages are case sensitive, eg., C, Shell, Python etc.	 
+	Languages with spaces must be conjoined with a "+", eg, Common+Lisp
+	Default: Any
+
+	-type=SEARCH  | -t=SEARCH
+	every  |   Everything 
+	repo   |   Repositories
+	user   |   Users
+	code   |   Code
+	           Default: Everything
+
+EOF
+    w3_global_usage
+}
+
+w3_parse_option_hook () {
+    opt="$1"
+    optarg="$2"
+    case "$opt" in
+	-t*=*)       setopt   SURFRAW_git_type   $optarg ;;
+	-l*=*)       setopt   SURFRAW_git_lang   $optarg ;;
+	*) return 1 ;;
+    esac
+    return 0
+}
+w3_config
+w3_parse_args "$@"
+# w3_args now contains list of arguments
+
+# type of search selected
+case "$SURFRAW_git_type" in
+	every)  type="Everything"    	;;
+	repo)   type="Repositories"  	;;
+	user)   type="Users"         	;;
+	code)   type="Code"          	;;
+	*)      type="Everything"    	;;
+esac
+
+# No arguments parsed
+if [ -z "$w3_args" ]; then
+	w3_browse_url "https://github.com"
+else
+	# Language and/or search type selected
+	escaped_args=$(w3_url_of_arg $w3_args)
+	w3_browse_url "https://github.com/search?q=${escaped_args}&repo=&langOverride=&start_value=1&type=${type}&language=${SURFRAW_git_lang}"
+fi
+
diff --git a/links.IN b/links.IN
index 4da7ab2..38c002b 100644
--- a/links.IN
+++ b/links.IN
@@ -51,6 +51,7 @@ elvi.1sr.gz @mandir@/man1/fsfdir.1sr.gz
 elvi.1sr.gz @mandir@/man1/gcache.1sr.gz
 elvi.1sr.gz @mandir@/man1/genbugs.1sr.gz
 elvi.1sr.gz @mandir@/man1/genportage.1sr.gz
+elvi.1sr.gz @mandir@/man1/github.1sr.gz
 elvi.1sr.gz @mandir@/man1/google.1sr.gz
 elvi.1sr.gz @mandir@/man1/gutenberg.1sr.gz
 elvi.1sr.gz @mandir@/man1/happypenguin.1sr.gz
diff --git a/test/github.test b/test/github.test
new file mode 100644
index 0000000..5664188
--- /dev/null
+++ b/test/github.test
@@ -0,0 +1,6 @@
+github browser
+impress.js
+github window-manager
+wmfs
+github surfraw
+surfraw

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



More information about the Surfraw-commits mailing list