diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-12 15:28:24 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-11-12 15:28:24 +0000 |
commit | e6282df1155e8d9b08b2e518a452c1997973f1ce (patch) | |
tree | b0c8ed7e8512cc4397ae7df6d138ea66147565b3 /Completion/Base/_command_names | |
parent | 167b0ae3b98938f75287dcf2e112d41a03532c5f (diff) | |
download | zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar.gz zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar.xz zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.zip |
manual/8630
Diffstat (limited to 'Completion/Base/_command_names')
-rw-r--r-- | Completion/Base/_command_names | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/Completion/Base/_command_names b/Completion/Base/_command_names index 889b330bd..8d8f5630f 100644 --- a/Completion/Base/_command_names +++ b/Completion/Base/_command_names @@ -4,38 +4,27 @@ # 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 ext +local args defs + +defs=( + 'commands:external command:compadd - ${(@k)commands}' + 'executables:executable file or directory:_path_files -/g \*\(\*\)' +) if [[ "$1" = -e ]]; then - ext=yes - shift -elif [[ "$1" = - ]]; then shift -fi +else + [[ "$1" = - ]] && shift -# Complete jobs in implicit fg and bg -if [[ -z "$ext" && "$PREFIX[1]" = "%" ]]; then - _jobs - [[ nm -ne compstate[nmatches] ]] && return + defs=( "$defs[@]" + 'jobs:: _jobs' + 'builtins:builtin command:compadd - ${(@k)builtins}' + 'functions:shell function:compadd - ${(@k)functions}' + 'aliases:alias:compadd - ${(@k)aliases}' + 'reserved-words:reserved word:compadd - ${(@k)reswords}' + ) fi -_description expl 'external command' -compadd "$expl[@]" "$@" - "${(k@)commands}" && ret=0 +args=( "$@" ) -if [[ -z "$ext" ]]; then - _description expl 'builtin command' - compadd "$expl[@]" "$@" - "${(k@)builtins}" && ret=0 - _description expl 'shell function' - compadd "$expl[@]" "$@" - "${(k@)functions}" && ret=0 - _description expl 'alias' - compadd "$expl[@]" "$@" - "${(k@)aliases}" && ret=0 - _description expl 'reserved word' - compadd "$expl[@]" "$@" - "${(k@)reswords}" && ret=0 -fi - -if [[ nm -eq compstate[nmatches] ]]; then - _description expl 'executable file or directory' - _path_files "$expl[@]" "$@" -/g "*(*)" -else - return ret -fi +_alternative -O args any "$defs[@]" |