about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Base/_arguments13
2 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f6530b8a..95ba5c2a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-08-02  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 12475: Completion/Base/_arguments: prefer user-defined specs
+ 	over ones derived from --help output
+	
 2000-08-01  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* Jan Fedak: 12463: Completion/User/_slrn: new completion function
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index 2d55800a4..5a8da45ab 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -70,7 +70,18 @@ if (( long )); then
     lopts=("--${(@)^${(@)${(@)${(@M)${(@ps:\n:j:\n:)${(@)${(@M)${(@f)$(_call options ${~words[1]} --help 2>&1)//\[--/
 --}:#[ 	]#-*}//,/
 }}:#[ 	]#--*}#*--}%%[]	 ]*}:#}")
-    lopts=( "${(@)lopts:#--}" )
+
+    # Remove options also described by user-defined specs.
+
+    tmp=()
+    for opt in "${(@)lopts:#--}"; do
+
+      # Using (( ... )) gives a parse error.
+
+      let "$tmpargv[(I)(|\([^\)]#\))${opt}(|[-+=])(|\[*\])(|:*)]" ||
+          tmp=( "$tmp[@]" "$opt" )
+    done
+    lopts=( "$tmp[@]" )
 
     # Now remove all ignored options ...