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

Ian Beckwith ianb at erislabs.net
Fri Oct 29 19:11:00 UTC 2010


The following commit has been merged in the master branch:
commit 565dbe4bd3a78d1300c8a9bb5614d9d2282c7deb
Author: Ian Beckwith <ianb at erislabs.net>
Date:   Fri Oct 29 00:59:09 2010 +0100

    * Support -local-help, --local-help or -lh to get elvi-specific
      help without displaying the global options. This works for
      all elvi and the main surfraw script.
    * google, duckduckgo, opensearch, wayback: tweak overbroad
      option parsing so it doesn't interfere with -lh.
    * Support -h as a synonym for -help.

diff --git a/ChangeLog b/ChangeLog
index 1dc2b2d..3be0b56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-28  Ian Beckwith  <ianb at erislabs.net>
+
+	* Support -local-help, --local-help or -lh to get elvi-specific
+	  help without displaying the global options. This works for
+	  all elvi and the main surfraw script.
+	* google, duckduckgo, opensearch, wayback: tweak overbroad
+	  option parsing so it doesn't interfere with -lh.
+	* Support -h as a synonym for -help.
+
 2010-10-25  Ian Beckwith  <ianb at erislabs.net>
 
 	* new elvi: scirus, scitopia, worldwidescience.
diff --git a/README b/README
index 486a38d..28a1600 100644
--- a/README
+++ b/README
@@ -298,6 +298,7 @@ Global options:
                                 Default: yes
                                 Environment: SURFRAW_graphical
   -help                         What you're reading now, dude
+  -lh | -local-help             Just show elvi-specific help, not the global options
   -p | -print                   Just print search URL, don't pass to browser
   -o | -o=FILE                  Fetch URL and dump to stdout or FILE.
   -new[=yes|no]                 Start in a new window
@@ -316,6 +317,9 @@ Copyright:
   Copyright (c) 2001 Australian Institute for Collaborative Research
   Copyright (c) 2000 Melbourne Institute for Advanced Study
 
+  If you just want to see the elvi-specific help, use
+  elvi -lh or -local-help.
+
   The system wide configuration file can usually be found in
   /etc/xdg/surfraw/conf (but see 'Config files' above). This can be
   overridden by setting the environment variable SURFRAW_global_conf.
diff --git a/elvi.1sr.IN b/elvi.1sr.IN
index 47c3c67..850e7c6 100644
--- a/elvi.1sr.IN
+++ b/elvi.1sr.IN
@@ -57,7 +57,7 @@ using the "I'm feeling lucky" option:
 
 To find out about options specific to this elvis, do:
 
- sr elvisname \-help
+ sr elvisname \-local\-help
 
 To find out about surfraw, see the man page for surfraw(1).
 To see the full list of elvi, do:
@@ -74,7 +74,7 @@ directory (\%@ELVIDIR@) to your path, either manually or using
 
 .SH OPTIONS
 
-Use	\fB\%sr elviname \-help\fP for elvi\(hyspecific options.
+Use	\fB\%sr elviname \-local-help\fP for elvi\(hyspecific options.
 
 The following options work with all elvi.
 
@@ -83,6 +83,10 @@ The following options work with all elvi.
 Show summary of options (including elvi\(hyspecific options).
 
 .TP
+.B \-local-help
+Show elvi\(hyspecific options.
+
+.TP
 .B \-version
 Show version of program.
 
diff --git a/elvi/duckduckgo b/elvi/duckduckgo
index 85e41a1..7eb8d59 100755
--- a/elvi/duckduckgo
+++ b/elvi/duckduckgo
@@ -29,8 +29,8 @@ w3_parse_option_hook () {
     opt="$1"
     optarg="$2"
     case "$opt" in
-    -search=*)  setopt   SURFRAW_duckduckgo_search  "$optarg" ;;
-    -[ld]*)     setoptyn SURFRAW_duckduckgo_lucky   1         ;;
+    -search=*)       setopt   SURFRAW_duckduckgo_search  "$optarg" ;;
+    -d|-du*|-l|-lu*) setoptyn SURFRAW_duckduckgo_lucky   1         ;;
     *) return 1 ;;
     esac
     return 0
diff --git a/elvi/google b/elvi/google
index 16d9e3f..d01c784 100755
--- a/elvi/google
+++ b/elvi/google
@@ -41,7 +41,7 @@ w3_parse_option_hook () {
     case "$opt" in
     -results=*) setopt   SURFRAW_google_results "$optarg" ;;
     -search=*)  setopt   SURFRAW_google_search  "$optarg" ;;
-    -l*)        setoptyn SURFRAW_google_lucky   1         ;;
+    -l|-lu*)    setoptyn SURFRAW_google_lucky   1         ;;
     -country=*) setopt	 SURFRAW_google_country "$optarg" ;;
     *) return 1 ;;
     esac
diff --git a/elvi/opensearch b/elvi/opensearch
index c711d09..61ba89e 100755
--- a/elvi/opensearch
+++ b/elvi/opensearch
@@ -56,7 +56,7 @@ w3_parse_option_hook () {
     -la*=*) setopt   SURFRAW_opensearch_language       "$optarg" ;;
     -in*=*) setopt   SURFRAW_opensearch_inputencoding  "$optarg" ;;
     -o*=*)  setopt   SURFRAW_opensearch_outputencoding "$optarg" ;;
-    -l*)    setoptyn SURFRAW_opensearch_list            1        ;;
+    -l)     setoptyn SURFRAW_opensearch_list            1        ;;
 	*) return 1 ;;
     esac
     return 0
diff --git a/elvi/wayback b/elvi/wayback
index 5510578..7b5e4ec 100755
--- a/elvi/wayback
+++ b/elvi/wayback
@@ -65,13 +65,13 @@ w3_parse_option_hook () {
     -sm*=*)  setopt   SURFRAW_wayback_smonth     "`monthtonum "$optarg"`" ;;
     -em*=*)  setopt   SURFRAW_wayback_emonth     "`monthtonum "$optarg"`" ;;
     -ali*=*) setopt   SURFRAW_wayback_aliases    $optarg ;;
-    -re*=*)   setopt   SURFRAW_wayback_redirects  $optarg ;;
-    -ty*=*)   setopt   SURFRAW_wayback_filetype   $optarg ;;
-    -l*)     setoptyn SURFRAW_wayback_list       1       ;;
+    -re*=*)  setopt   SURFRAW_wayback_redirects  $optarg ;;
+    -ty*=*)  setopt   SURFRAW_wayback_filetype   $optarg ;;
+    -l|-li*) setoptyn SURFRAW_wayback_list       1       ;;
     -d*)     setoptyn SURFRAW_wayback_dups       1       ;;
     -c*)     setoptyn SURFRAW_wayback_comp       1       ;;
     -pd*)    setoptyn SURFRAW_wayback_pdf        1       ;;
-	*)       return 1 ;;
+	*)   return 1 ;;
     esac
     return 0
 }
diff --git a/surfraw.1.IN b/surfraw.1.IN
index f93d59f..fcca0dd 100644
--- a/surfraw.1.IN
+++ b/surfraw.1.IN
@@ -87,7 +87,7 @@ There are some example bookmarks in \%@sysconfdir@/xdg/surfraw/bookmarks
 
 .SH OPTIONS
 
-Use	\fB\%sr elviname \-help\fP for elvi\(hyspecific options.
+Use	\fB\%sr elviname \-local\-help\fP for elvi\(hyspecific options.
 
 The following options work with all elvi.
 
@@ -96,6 +96,10 @@ The following options work with all elvi.
 Show summary of options (including elvi\(hyspecific options).
 
 .TP
+.B \-local-help
+Show elvi\(hyspecific options.
+
+.TP
 .B \-version
 Show version of program.
 
diff --git a/surfraw.IN b/surfraw.IN
index 9cf5864..4a1427d 100755
--- a/surfraw.IN
+++ b/surfraw.IN
@@ -260,6 +260,10 @@ false () {
 }
 
 w3_global_usage () {
+    defyn SURFRAW_local_help no
+    if ifyes SURFRAW_local_help; then
+	return;
+    fi
 # style: keep sorted
 #-------------------------------------79 cols----------------------------------
     cat <<EOF
@@ -273,7 +277,8 @@ Global options:
   -g | -graphical		Get some windowed sin
   				Default: $SURFRAW_graphical
 				Environment: SURFRAW_graphical
-  -help				What you're reading now, dude
+  -h  | -help			What you're reading now, dude
+  -lh | -local-help		Just show elvi-specific help, not the global options
   -p | -print			Just print search URL, don't pass to browser
   -o | -o=FILE			Fetch URL and dump to stdout or FILE.
   -new[=yes|no]			Start in a new window
@@ -336,7 +341,9 @@ w3_parse_option () {
 			    exit 0 ;;
 	-escape-url-args=*) setoptyn SURFRAW_escape_url_args	$optarg ;;
 	-g | -graphical)    setoptyn SURFRAW_graphical		yes	;;
-	-help | --help)     do_help=1					;;
+	-help | --help |-h) do_help=1					;;
+	-local-help | \
+	--local-help |-lh ) do_help=1 ;setoptyn SURFRAW_local_help yes  ;;
 	-q | -quote)	    setoptyn SURFRAW_quote_args	    	yes	;;
 	-new)		    setoptyn SURFRAW_new_window		yes	;;
 	-new=*)		    setoptyn SURFRAW_new_window		$optarg ;;
@@ -495,6 +502,7 @@ then
 	unquoted_opts=""
 	elvi=""
 	searchterms=""
+	do_help=0
 	for arg in "$@"
 	do
 	  # if it is an option
@@ -504,11 +512,18 @@ then
 		  if [ -z "$elvi" ]
 		  then
 			  case "$arg" in
-				  -help*) surfraw_usage;         exit 0 ;;
-				  -\?)    surfraw_usage;         exit 0 ;;
-				  -elvi*)  w3_parse_option -elvi; exit 0 ;;
+			      -help | --help |-h) do_help=1 ;;
+			      -local-help  | \
+			      --local-help | \
+			      -lh | -\? ) do_help=1 ; setoptyn SURFRAW_local_help yes ;;
+			      -elvi*)  w3_parse_option -elvi; exit 0 ;;
 			  esac
 		  fi
+		  if ok do_help
+		  then
+		      surfraw_usage
+		      exit 0
+		  fi
 		  if  [ -z "$opts" ]
 		  then
 			  opts="`quote "$arg"`"

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



More information about the Surfraw-commits mailing list