about summary refs log tree commit diff
path: root/Completion/Core/_wanted
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core/_wanted')
-rw-r--r--Completion/Core/_wanted22
1 files changed, 17 insertions, 5 deletions
diff --git a/Completion/Core/_wanted b/Completion/Core/_wanted
index 7baa3e724..32875ec57 100644
--- a/Completion/Core/_wanted
+++ b/Completion/Core/_wanted
@@ -1,6 +1,6 @@
 #autoload
 
-local targs
+local targs gopt=-J
 
 if [[ "$1" = -C?* ]]; then
   targs=( -C "${1[3,-1]}" )
@@ -12,10 +12,22 @@ else
   targs=()
 fi
 
-[[ "$1" = -(|-) ]] && shift
+if [[ "$1" = -([12]|)[VJ] ]]; then
+  gopt="$1"
+  shift
+fi
+
+if [[ $# -gt 3 ]]; then
+  if _tags "$targs[@]" "$1"; then
+    _comp_tags="$_comp_tags $1"
 
-if [[ $# -gt 1 ]]; then
-  _tags "$targs[@]" "$1" && _description "${(@)argv[2,-1]}"
+    _all_labels -t "$gopt" "$@"
+  else
+    return 1
+  fi
+elif [[ $# -gt 1 ]]; then
+  _tags -- "$targs[@]" "$1" && _comp_tags="$_comp_tags $1" &&
+    _description "$gopt" "$@"
 else
-  _tags "$targs[@]" "$1"
+  _tags -- "$targs[@]" "$1" && _comp_tags="$_comp_tags $1"
 fi