Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 2 new patches for _surfraw



hello,

> This mostly looks all good so there's not much I can say.

yet: i want to read carefully and learn about the completion primitives
before submitting a new version so let's focus on the second patch
for the moment (easier and actually fixing a bug).

i propose 2 versions of the patch. the second one also

* remove the other tailing spaces
* remove some tabs in the indentation
* declare the correct indentation in a vim mode

regards
marc
From 6367f7dae6bfe27d6580d68ecc87eece8caa845b Mon Sep 17 00:00:00 2001
From: Marc Chantreux <eiro@xxxxxxxxx>
Date: Sat, 10 Apr 2021 10:25:02 +0200
Subject: [PATCH] fix ebay completion bug due to tailing space

also
* remove the other tailing spaces
* remove some tabs in the indentation
* declare the correct indentation in a vim mode
---
 Completion/Unix/Command/_surfraw | 61 ++++++++++++++++----------------
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw
index f945f1ca9..b480e3c28 100644
--- a/Completion/Unix/Command/_surfraw
+++ b/Completion/Unix/Command/_surfraw
@@ -1,4 +1,5 @@
 #compdef surfraw sr
+# vim: et ts=2
 
 local curcontext="$curcontext" expl state line args ret=1
 
@@ -64,10 +65,10 @@ case $state in
           '*:search string' && ret=0
       ;;
       ctan)
-	_arguments $args \
-	'-name[search by filename]' \
-	'-desc[search descriptions (default)]'\
-	'-doc[search documentation]'
+    _arguments $args \
+    '-name[search by filename]' \
+    '-desc[search descriptions (default)]'\
+    '-doc[search documentation]'
       ;;
       currency)
         _arguments \
@@ -165,7 +166,7 @@ case $state in
       ;;
       debsec)
         _message -e string 'package name, bug number or CVE ID'
-      ;; 
+      ;;
       deja)
         _arguments $args \
           '-results=-:[number of results to return]' \
@@ -183,7 +184,7 @@ case $state in
       ;;
       ebay)
         _arguments $args \
-          '-country=-:country:(com de uk fr)' \ 
+          '-country=-:country:(com de uk fr)' \
           '-results=-:[number of results to return]:number' && ret=0
       ;;
       etym)
@@ -220,7 +221,7 @@ case $state in
         _deb_packages avail && ret=0
       ;;
       fsfdir)
-	_arguments $args
+    _arguments $args
       ;;
       google)
         _arguments $args \
@@ -229,19 +230,19 @@ case $state in
           '-search=-:topic:(bsd linux mac unclesam)' && ret=0
       ;;
       gutenberg)
-	_arguments $args \
-	  '-title[search titles (default)]'
-	  '-author[search authors]'
-	  '-num[search etext numbers]'
-      ;;       
+    _arguments $args \
+      '-title[search titles (default)]'
+      '-author[search authors]'
+      '-num[search etext numbers]'
+      ;;
       imdb)
         _arguments $args \
           '-category=-:category:(All Titles MyMovies People Characters Quotes Bios Plots)' && ret=0
       ;;
       ixquick)
-	_arguments $args \
-	  '-search=-:search type:(web pics)' \
-	  '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)'
+    _arguments $args \
+      '-search=-:search type:(web pics)' \
+      '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)'
       ;;
       jake)
         _arguments $args \
@@ -386,20 +387,20 @@ case $state in
           :URL:_urls && ret=0
       ;;
       wayback)
-	_arguments $args \
-	  '-syear=-[start search from this year]:year' \
-	  '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
-	  '-sday=-[start search from this day]:number' \
-	  '-eyear=-[end search in this year]:year' \
-	  '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
-	  '-eday=-[end search in this day]:number' \
-	  '-list[list all pages that match search criteria]' \
-	  '-dups[show dups]' \
-	  '-compare[compare pages]' \
-	  '-pdf[show as PDF]' \
-	  '-alias=-[how to handle site aliases]:alias:(merge show hide)' \
-	  '-redir=-[how to handle redirections]:redir:(hide flag show)' \
-	  '-type=-[file type to search for]:type:(image audio video binary text pdf)'
+    _arguments $args \
+      '-syear=-[start search from this year]:year' \
+      '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
+      '-sday=-[start search from this day]:number' \
+      '-eyear=-[end search in this year]:year' \
+      '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \
+      '-eday=-[end search in this day]:number' \
+      '-list[list all pages that match search criteria]' \
+      '-dups[show dups]' \
+      '-compare[compare pages]' \
+      '-pdf[show as PDF]' \
+      '-alias=-[how to handle site aliases]:alias:(merge show hide)' \
+      '-redir=-[how to handle redirections]:redir:(hide flag show)' \
+      '-type=-[file type to search for]:type:(image audio video binary text pdf)'
       ;;
       wetandwild)
         _arguments \
@@ -430,6 +431,6 @@ case $state in
     _wanted elvi expl elvi compadd \
       ${${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0
   ;;
-esac  
+esac
 
 return ret
-- 
2.30.2

From dc4484bac85609faf5cc8057fc5d2b991f9b1c91 Mon Sep 17 00:00:00 2001
From: Marc Chantreux <eiro@xxxxxxxxx>
Date: Sat, 10 Apr 2021 10:25:02 +0200
Subject: [PATCH] fix ebay completion bug due to tailing space

also remove the other tailing spaces
---
 Completion/Unix/Command/_surfraw | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw
index f945f1ca9..b8a3033c0 100644
--- a/Completion/Unix/Command/_surfraw
+++ b/Completion/Unix/Command/_surfraw
@@ -165,7 +165,7 @@ case $state in
       ;;
       debsec)
         _message -e string 'package name, bug number or CVE ID'
-      ;; 
+      ;;
       deja)
         _arguments $args \
           '-results=-:[number of results to return]' \
@@ -183,7 +183,7 @@ case $state in
       ;;
       ebay)
         _arguments $args \
-          '-country=-:country:(com de uk fr)' \ 
+          '-country=-:country:(com de uk fr)' \
           '-results=-:[number of results to return]:number' && ret=0
       ;;
       etym)
@@ -233,7 +233,7 @@ case $state in
 	  '-title[search titles (default)]'
 	  '-author[search authors]'
 	  '-num[search etext numbers]'
-      ;;       
+      ;;
       imdb)
         _arguments $args \
           '-category=-:category:(All Titles MyMovies People Characters Quotes Bios Plots)' && ret=0
@@ -430,6 +430,6 @@ case $state in
     _wanted elvi expl elvi compadd \
       ${${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0
   ;;
-esac  
+esac
 
 return ret
-- 
2.30.2



Messages sorted by: Reverse Date, Date, Thread, Author