[Surfraw-devel] New elvis: github

Jason Ryan jasonwryan at gmail.com
Sat Mar 10 08:21:20 UTC 2012


Github now works in w3m! 

The search is pretty funky, but this elvis manages to
waddle around OK…

/J

-- 

http://jasonwryan.com/  [GnuPG Key: B1BD4E40]


-------------- next part --------------
From 93851dafd50db5829a3a66d62a6e4e835371cc92 Mon Sep 17 00:00:00 2001
From: jasonwryan <jasonwryan at gmail.com>
Date: Thu, 8 Mar 2012 22:20:53 +1300
Subject: [PATCH 1/3] Added github elvis

---
 elvi/github |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100755 elvi/github

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
+
-- 
1.7.9.3


From 9e6df11b14009e26696b2b02288dd7f31800ee8d Mon Sep 17 00:00:00 2001
From: jasonwryan <jasonwryan at gmail.com>
Date: Thu, 8 Mar 2012 22:44:05 +1300
Subject: [PATCH 2/3] Updated files for github elvis

---
 README           |    1 +
 elvi/Makefile.am |    1 +
 links.IN         |    1 +
 3 files changed, 3 insertions(+)

diff --git a/README b/README
index 6750fe1..9fb34dc 100644
--- a/README
+++ b/README
@@ -207,6 +207,7 @@ fsfdir            -- Search the FSF/UNESCO Free Software Directory (directory.fs
 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 (https://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 0843c3c..310215d 100644
--- a/elvi/Makefile.am
+++ b/elvi/Makefile.am
@@ -63,6 +63,7 @@ dist_elvi_SCRIPTS	= \
 		  freshmeat \
 		  fsfdir \
 		  gcache \
+		  github \
 		  genbugs \
 		  genportage \
 		  gutenberg \
diff --git a/links.IN b/links.IN
index 339f6f2..780a71f 100644
--- a/links.IN
+++ b/links.IN
@@ -52,6 +52,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
-- 
1.7.9.3


From bcb1b23f5942b8b6372ac5b70e5b30d16ed0d60e Mon Sep 17 00:00:00 2001
From: jasonwryan <jasonwryan at gmail.com>
Date: Sat, 10 Mar 2012 21:16:04 +1300
Subject: [PATCH 3/3] =?UTF-8?q?Test=20for=20github=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 test/github.test |    6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 test/github.test

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
-- 
1.7.9.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/surfraw-devel/attachments/20120310/28517d3a/attachment.pgp>


More information about the Surfraw-devel mailing list