diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-08-24 09:17:41 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-08-24 09:17:41 +0000 |
commit | 6fd5c631d6293763c3c8be1068387828201095da (patch) | |
tree | 91b977ab08c52a4184d30307c8f3c5d9967b51a7 /Completion/Base | |
parent | 9e879a8a68c52a4a0319fcc0eb8a6c2ab565a4e4 (diff) | |
download | zsh-6fd5c631d6293763c3c8be1068387828201095da.tar.gz zsh-6fd5c631d6293763c3c8be1068387828201095da.tar.xz zsh-6fd5c631d6293763c3c8be1068387828201095da.zip |
zsh-workers/7469
Diffstat (limited to 'Completion/Base')
-rw-r--r-- | Completion/Base/_arguments | 2 | ||||
-rw-r--r-- | Completion/Base/_command_names | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments index d51e6d0af..6343bc477 100644 --- a/Completion/Base/_arguments +++ b/Completion/Base/_arguments @@ -188,6 +188,8 @@ while [[ cur -gt 0 ]]; do # associative array so that we don't offer them again. def="$opts[$ws[1]]" + optbeg="$beg" + argbeg="$beg" [[ -n "$oneshot[$ws[1]]" ]] && unset "opts[$ws[1]]" else uns='' diff --git a/Completion/Base/_command_names b/Completion/Base/_command_names index a0ec90262..2218aac21 100644 --- a/Completion/Base/_command_names +++ b/Completion/Base/_command_names @@ -1,21 +1,31 @@ #compdef -command- -local nm=$compstate[nmatches] ret=1 expl +# The option `-e' if given as the first argument says that we should +# complete only external commands and executable files. This and a +# `-' as the first argument is then removed from the arguments. +local nm=$compstate[nmatches] ret=1 expl type=-c + +if [[ "$1" = -e ]]; then + type=-m + shift +elif [[ "$1" = - ]]; then + shift +fi # Complete jobs in implicit fg and bg -if [[ "$PREFIX[1]" = "%" ]]; then +if [[ $type = -c && "$PREFIX[1]" = "%" ]]; then _description expl job - compgen "$expl[@]" -j -P '%' + compgen "$expl[@]" "$@" -j -P '%' [[ nm -ne compstate[nmatches] ]] && return fi _description expl command -compgen "$expl[@]" -c && ret=0 +compgen "$expl[@]" "$@" $type && ret=0 if [[ nm -eq compstate[nmatches] ]]; then _description expl 'executable file or directory' - _path_files "$expl[@]" -/g "*(*)" + _path_files "$expl[@]" "$@" -/g "*(*)" else return ret fi |