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

James Rowe jnrowe at gmail.com
Sun Aug 22 20:42:04 UTC 2010


The following commit has been merged in the master branch:
commit bbbf11f770d252b613f1ca6f56b5c1d470278ebb
Author: Jameson Rollins <jrollins at finestructure.net>
Date:   Sat Aug 21 23:41:54 2010 -0400

    Improve printing of elvi list
    
    This patch adds a new function, list_elvi, that improves the printing
    of the elvi descriptions in two ways:
    
    - Ignore scripts that end with '~'.  This is useful for users who
      maintain their own elvi, by ignoring editor turds.  This could
      probably be expanded to ignore other turd-like files as well.
    
    - Improve listing of scripts that are actually just symbolic links to
      other scripts.  Scripts that are links are now displayed as such,
      disambiguating them from the script they link to.  This makes it
      much nicer to maintain elvi shortcuts (such as wiki --> wikipedia).

diff --git a/AUTHORS b/AUTHORS
index 6385e69..efeb79c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -107,6 +107,7 @@ Uspenskiy Andrey <duspen at yandex.ua>
 
 Jameson Rollins <jrollins at finestructure.net>
         elvi: ads
+        plus tweaks.
 
 THANKS TO
 
diff --git a/ChangeLog b/ChangeLog
index 9f86b18..0ae4e1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-08-22  Jameson Rollins <jrollins at finestructure.net>
+
+	* surfraw.IN: Improve listing of elvi.
+
 2010-08-20  James Rowe  <jnrowe at gmail.com>
 
 	* new elvi: ads.  Thanks to Jameson Rollins.
diff --git a/surfraw.IN b/surfraw.IN
old mode 100644
new mode 100755
index 3c7a730..9cf5864
--- a/surfraw.IN
+++ b/surfraw.IN
@@ -310,6 +310,14 @@ w3_parse_option_hook () {
     return 1
 }
 
+list_elvi() {
+    local dir="$1"
+    sed -n 's/^.*elvis: \(.*\)$/\1/p' $(find "$dir" ! -type d ! -type l ! -name '*~' | sort)
+    for script in $(find "$dir" ! -type d -type l | sort) ; do
+	printf '%-16s--> %s\n' $(basename "$script") $(basename $(readlink "${script}"))
+    done
+}
+
 w3_parse_option () {
     opt="$1"
     case "$opt" in
@@ -319,11 +327,11 @@ w3_parse_option () {
     case "$opt" in
 	-browser=*)	    setopt   SURFRAW_browser		$optarg	;;
 	-elvi)		    echo " GLOBAL ELVI:"
-			    sed -n 's/^.*elvis: \(.*\)$/\1/p' $elvidir/*
+			    list_elvi "$elvidir"
 			    localelvidir=$(get_local_elvi_dir)
 			    if [ -d "$localelvidir" ] && [ -n "$(ls "$localelvidir")" ]; then
 				echo " LOCAL ELVI:"
-				sed -n 's/^.*elvis: \(.*\)$/\1/p' "$localelvidir/"*
+				list_elvi "$localelvidir"
 			    fi
 			    exit 0 ;;
 	-escape-url-args=*) setoptyn SURFRAW_escape_url_args	$optarg ;;

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



More information about the Surfraw-commits mailing list