summaryrefslogtreecommitdiff
path: root/Completion/bashcompinit
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/bashcompinit')
-rw-r--r--Completion/bashcompinit21
1 files changed, 14 insertions, 7 deletions
diff --git a/Completion/bashcompinit b/Completion/bashcompinit
index cba436a55..2ccc94de9 100644
--- a/Completion/bashcompinit
+++ b/Completion/bashcompinit
@@ -12,14 +12,14 @@ _bash_complete() {
(( COMP_CWORD = CURRENT - 1))
COMP_WORDS=( $words )
BASH_VERSINFO=( 2 05b 0 1 release )
-
+
savejobstates=( ${(kv)jobstates} )
savejobtexts=( ${(kv)jobtexts} )
-
+
[[ ${argv[${argv[(I)nospace]:-0}-1]} = -o ]] && suf=( -S '' )
-
+
matches=( ${(f)"$(compgen $@)"} )
-
+
if [[ -n $matches ]]; then
if [[ ${argv[${argv[(I)filenames]:-0}-1]} = -o ]]; then
compset -P '*/' && matches=( ${matches##*/} )
@@ -41,11 +41,18 @@ _bash_complete() {
return ret
}
+_compgen_opt_words() {
+ typeset -a words
+ words=( ${~=1} )
+ local find="$2"
+ results=(${(M)words[@]:#$find*})
+}
+
compgen() {
- local opts prefix suffix job OPTARG OPTIND ret=1
+ local opts prefix suffix job OPTARG OPTIND ret=1
local -a name res results jids
local -A shortopts
-
+
emulate -L sh
setopt kshglob noshglob braceexpand nokshautoload
@@ -128,7 +135,7 @@ compgen() {
results+=( ${~OPTARG} )
unsetopt nullglob
;;
- W) eval "results+=( $OPTARG )" ;;
+ W) _compgen_opt_words "$OPTARG" "${@[-1]}" ;;
C) results+=( $(eval $OPTARG) ) ;;
P) prefix="$OPTARG" ;;
S) suffix="$OPTARG" ;;