summary refs log tree commit diff
path: root/Completion/Base/Utility
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Base/Utility')
-rw-r--r--Completion/Base/Utility/_pick_variant8
1 files changed, 7 insertions, 1 deletions
diff --git a/Completion/Base/Utility/_pick_variant b/Completion/Base/Utility/_pick_variant
index 01fa2b98f..9099e3599 100644
--- a/Completion/Base/Utility/_pick_variant
+++ b/Completion/Base/Utility/_pick_variant
@@ -6,7 +6,7 @@ local -A opts
 
 (( $+_cmd_variant )) || typeset -gA _cmd_variant
 
-zparseopts -D -A opts c: r:
+zparseopts -D -A opts b: c: r:
 : ${opts[-c]:=$words[1]}
 
 while [[ $1 = *=* ]]; do
@@ -19,6 +19,12 @@ if (( $+_cmd_variant[$opts[-c]] )); then
   return 0
 fi
 
+if [[ $+opts[-b] -eq 1 && -n $builtins[$opts[-c]] ]]; then
+  _cmd_variant[$opts[-c]]=$opts[-b]
+  (( $+opts[-r] )) && eval "${opts[-r]}=${_cmd_variant[$opts[-c]]}"
+  return 0
+fi
+
 output="$(_call_program variant $opts[-c] "${@[2,-1]}" </dev/null 2>&1)"
 
 for cmd pat in "$var[@]"; do