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

Ian Beckwith ianb at erislabs.net
Fri Jun 10 20:23:39 UTC 2011


The following commit has been merged in the master branch:
commit 2f7e4eb3de6086d1321a7a383fe3ed9267849147
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Fri Jun 10 21:21:10 2011 +0100

    fixed ctan

diff --git a/ChangeLog b/ChangeLog
index 23cc53a..d4793b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-06-10  Ian Beckwith  <ianb at erislabs.net>
+
+	* Fixed ctan.
+	  Option -doc has been replaced by -id.
+	  Options are no longer mutually exclusive,
+	  you can now do (eg) ctan -d -i -n exlive.
+
 2011-06-09  Ian Beckwith  <ianb at erislabs.net>
 
 	* fixed tests: debwiki, ntrs, wayback.
diff --git a/elvi/ctan b/elvi/ctan
index e5ee4c1..79712ff 100755
--- a/elvi/ctan
+++ b/elvi/ctan
@@ -6,7 +6,7 @@
 w3_config_hook () {
 defyn SURFRAW_ctan_name  0
 defyn SURFRAW_ctan_desc  0
-defyn SURFRAW_ctan_doc   0
+defyn SURFRAW_ctan_id    0
 }
 
 w3_usage_hook () {
@@ -17,7 +17,8 @@ Description:
 Local options:
   -name                         Search by filename
   -desc                         Search descriptions (default)
-  -doc                          Search documentation
+  -id                           Search package identifiers
+Options can be combined to search multiple types at once.
 EOF
     w3_global_usage
 }
@@ -26,9 +27,9 @@ w3_parse_option_hook () {
     opt="$1"
     optarg="$2"
     case "$opt" in
-    -n*)        setoptyn SURFRAW_ctan_name   1       ;;
-    -de*)       setoptyn SURFRAW_ctan_desc   1       ;;
-    -do*)       setoptyn SURFRAW_ctan_doc    1       ;;
+    -n*)    setoptyn SURFRAW_ctan_name   1       ;;
+    -d*)    setoptyn SURFRAW_ctan_desc   1       ;;
+    -i*)    setoptyn SURFRAW_ctan_id     1       ;;
 	*) return 1 ;;
     esac
     return 0
@@ -43,20 +44,23 @@ else
     escaped_args=`w3_url_of_arg $w3_args`
 	if ifno SURFRAW_ctan_name &&
 	   ifno SURFRAW_ctan_desc  &&
-	   ifno SURFRAW_ctan_doc
+	   ifno SURFRAW_ctan_id
 	then
 		SURFRAW_ctan_desc=1
 	fi
 
-	url="http://www.ctan.org/cgi-bin/"
+	url="http://www.ctan.org/search/?search=${escaped_args}"
 	if ifyes SURFRAW_ctan_name
 	then
-		url="${url}filenameSearch.py?filename=${escaped_args}"
-	elif ifyes SURFRAW_ctan_desc
+		url="${url}&search_type=filename"
+	fi
+	if ifyes SURFRAW_ctan_desc
+	then
+		url="${url}&search_type=description"
+	fi
+	if ifyes SURFRAW_ctan_id
 	then
-		url="${url}search.py?metadataSearch=${escaped_args}"
-	else # must be SURFRAW_ctan_doc
-		url="${url}searchFullText.py?fullTextSearch=${escaped_args}"
+		url="${url}&search_type=id"
 	fi
 
 	w3_browse_url "$url"
diff --git a/test/ctan.test b/test/ctan.test
index 610b9fa..95b4865 100644
--- a/test/ctan.test
+++ b/test/ctan.test
@@ -1,2 +1,2 @@
-ctan exlive
+ctan -d -i -n exlive
 texlive

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



More information about the Surfraw-commits mailing list