From a4054ed26295617a5c4914daa1b76f9d4781be12 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Tue, 16 Nov 1999 09:19:32 +0000 Subject: zsh-workers/8647 --- Completion/Builtins/_hash | 2 +- Completion/Builtins/_sched | 2 +- Completion/Builtins/_stat | 4 +-- Completion/Core/compinit | 57 ++++++++++++++++++++++++++----------------- Completion/User/_cvs | 2 +- Completion/User/_urls | 8 +++--- Completion/User/_user_at_host | 4 +-- Completion/User/_whois | 4 +-- Completion/X/_xutils | 2 +- 9 files changed, 49 insertions(+), 36 deletions(-) diff --git a/Completion/Builtins/_hash b/Completion/Builtins/_hash index e5f182528..3cb364d12 100644 --- a/Completion/Builtins/_hash +++ b/Completion/Builtins/_hash @@ -10,7 +10,7 @@ if [[ "$words[2]" = -*d* ]]; then compadd "$expl[@]" -q -S '=' - "${(@k)nameddirs}" fi elif compset -P 1 '*\='; then - _wanted -C value values executables expl 'executable file' && + _wanted -C value values expl 'executable file' && _files "$expl[@]" -g '*(*)' else _wanted -C name commands expl command && diff --git a/Completion/Builtins/_sched b/Completion/Builtins/_sched index 6a327e891..164cd06e4 100644 --- a/Completion/Builtins/_sched +++ b/Completion/Builtins/_sched @@ -4,7 +4,7 @@ local expl lines disp if [[ CURRENT -eq 2 ]]; then if compset -P -; then - _wanted -C - entries expl 'scheduled jobs' || return 1 + _wanted -C - jobs expl 'scheduled jobs' || return 1 lines=(${(f)"$(sched)"}) if _style entries description; then diff --git a/Completion/Builtins/_stat b/Completion/Builtins/_stat index 75370f991..0d72cce0b 100644 --- a/Completion/Builtins/_stat +++ b/Completion/Builtins/_stat @@ -5,10 +5,10 @@ local expl if [[ "$words[CURRENT-1]" = -[AH] ]]; then _arrays else - _tags elements files || return 1 + _tags options files || return 1 while _tags; do - _requested elements expl 'inode element' && + _requested options expl 'inode element' && { ! _style elements prefix-needed || [[ "$PREFIX[1]" = + ]] } && compadd "$expl[@]" - +device +inode +mode +nlink +uid +gid +rdev \ +size +atime +mtime +ctime +blksize +block +link diff --git a/Completion/Core/compinit b/Completion/Core/compinit index 6f2f39fcb..a16d43533 100644 --- a/Completion/Core/compinit +++ b/Completion/Core/compinit @@ -343,28 +343,28 @@ Have fun case "$name" in urls_path) - tmp="'*:urls' path '$val'" + tmp="'*:urls' path ${(qq)val}" ;; urls_localhttp) - tmp="'*:urls' local '${val//:/ }'" + tmp="'*:urls' local ${${(qqs.:.)val}}" ;; describe_options) - tmp="'*:options' description '$val'" + tmp="'*:options' description ${(qq)val}" ;; describe_values) - tmp="'*:values' description '$val'" + tmp="'*:values' description ${(qq)val}" ;; autodescribe_options) - tmp="'*:options' auto-description '$val'" + tmp="'*:options' auto-description ${(qq)val}" ;; description_format) - tmp="'*:descriptions' format '$val'" + tmp="'*:descriptions' format ${(qq)val}" ;; message_format) - tmp="'*:messages' format '$val'" + tmp="'*:messages' format ${(qq)val}" ;; warning_format) - tmp="'*:warnings' format '$val'" + tmp="'*:warnings' format ${(qq)val}" ;; option_prefix) tmp="'*:options' prefix-needed yes" @@ -376,43 +376,43 @@ compstyle '*:options' prefix-hidden yes" tmp="'*:matches' group 'yes'" ;; colors_path) - tmp="'*:colors' path '$val'" + tmp="'*:colors' path ${(qq)val}" ;; path_expand) - tmp="'*:paths' expand '$val'" + tmp="'*:paths' expand ${(qq)val}" ;; path_cursor) - tmp="'*:paths' cursor '$val'" + tmp="'*:paths' cursor ${(qq)val}" ;; (approximate|incremental|predict|list|oldlist|match)_*) - tmp="':${name%%_*}' ${${name#*_}//_/-} '$val'" + tmp="':${name%%_*}' ${${name#*_}//_/-} ${(qq)val}" ;; correct_*) cmt="# This one is a bit ugly. You may want to use only \`*:correct' # if you also have the \`correctword_*' or \`approximate_*' keys. " - tmp="':(correct(|-word)|approximate)' ${name#*_} '$val'" + tmp="':(correct(|-word)|approximate)' ${name#*_} ${(qq)val}" ;; correctword_*) - tmp="':correct-word' ${name#correctword_} '$val'" + tmp="':correct-word' ${name#correctword_} ${(qq)val}" ;; expand_*) cmt="# This one is a bit ugly. You may want to use only \`*:expand' # if you also have the \`expandword_*' keys. " - tmp="':expand(|expand-word)' ${name#*_} '$val'" + tmp="':expand(|expand-word)' ${name#*_} ${(qq)val}" ;; expandword_*) - tmp="':expand-word' ${name#expandword_} '$val'" + tmp="':expand-word' ${name#expandword_} ${(qq)val}" ;; history_*) - tmp="'*:history-entries' ${name#history_} '$val'" + tmp="'*:history-entries' ${name#history_} ${(qq)val}" ;; completer) - tmp="'*' completer ${val//:/ }" + tmp="'*' completer ${${(qqs.:.)val}}" ;; last_prompt) - tmp="'*' last-prompt '$val'" + tmp="'*' last-prompt ${(qq)val}" ;; esac [[ -n "$tmp" ]] && style="${style}${cmt}compstyle ${tmp} @@ -433,17 +433,30 @@ compstyle '*:options' prefix-hidden yes" # This will be improved if needed. Promised. compstyle() { + local long + + if [[ "$1" = -L ]]; then + long=yes + shift + fi + if (( ! $# )); then - local pats styles vals pat style + local pats styles vals pat style pre eq compstyles -G pats for pat in "$pats[@]"; do - print "$pat" + if [[ -n "$long" ]]; then + pre="compstyle ${(qq)pat} " + else + print "$pat" + pre=' ' + eq=' =' + fi compstyles -G styles "$pat" for style in "$styles[@]"; do compstyles -G vals "$pat" "$style" - print " $style = $vals" + print "${pre}${style}${eq}" "${(@qq)vals}" done done diff --git a/Completion/User/_cvs b/Completion/User/_cvs index cac9132b7..8bc57b403 100644 --- a/Completion/User/_cvs +++ b/Completion/User/_cvs @@ -575,7 +575,7 @@ _cvs_files_removed () { local omit omit=(${pref}*(D:t)) eval 'entries=(${entries:#('${(j:|:)${(@)omit:q}}')})' - _tags direcories && compadd "$@" -P "$qpref" - ${entries:q} || + _tags directories && compadd "$@" -P "$qpref" - ${entries:q} || _cvs_directories "$@" else _files "$@" diff --git a/Completion/User/_urls b/Completion/User/_urls index 787f3c0ca..265fadae8 100644 --- a/Completion/User/_urls +++ b/Completion/User/_urls @@ -54,7 +54,7 @@ fi ipre="$IPREFIX" if ! compset -P '(#b)([-+.a-z0-9]#):' && - _wanted argument prefixes expl 'URL prefix'; then + _wanted -C argument prefixes expl 'URL prefix'; then [[ -d $urls_path/bookmark ]] && compadd "$@" "$expl[@]" -S '' bookmark: && ret=0 compadd "$@" "$expl[@]" -S '' file: ftp:// gopher:// http:// && ret=0 @@ -65,7 +65,7 @@ scheme="$match[1]" case "$scheme" in http|ftp|gopher) if ! compset -P //; then - _wanted -C "$scheme" slashes expl 'end of prefix' && + _wanted -C "$scheme" prefixes expl 'end of prefix' && compadd "$expl[@]" "$@" -S '' // return fi @@ -86,11 +86,11 @@ case "$scheme" in bookmark) if [[ -f "$urls_path/$scheme/$PREFIX$SUFFIX" && -s "$urls_path/$scheme/$PREFIX$SUFFIX" ]]; then - _wanted -C bookmark caches expl biikmarks && + _wanted -C bookmark bookmarks expl bookmarks && compadd "$expl[@]" "$@" -QU - \ "$ipre$(<"$urls_path/$scheme/$PREFIX$SUFFIX")" && ret=0 else - if _wanted -C bookmark files 'bookmark'; then + if _wanted -C bookmark files expl 'bookmark'; then _path_files -W "$urls_path/$scheme" "$expl[@]" -S '' -g '*(^/)' && ret=0 _path_files -W "$urls_path/$scheme" -S/ -r '/' -/ && ret=0 diff --git a/Completion/User/_user_at_host b/Completion/User/_user_at_host index 1f93daacc..78e5a12aa 100644 --- a/Completion/User/_user_at_host +++ b/Completion/User/_user_at_host @@ -5,9 +5,9 @@ if [[ -prefix 1 *@ ]]; then compset -P 1 '*@' - _wanted -C user-at hosts expl "hostnames for $user" && + _wanted -C user-at hosts expl "host for $user" && _combination accounts_users_hosts users="$user" hosts "$expl[@]" "$@" else - _wanted users expl "usernames" && + _wanted users expl "user" && _combination accounts_users_hosts users -S@ -q "$expl[@]" "$@" fi diff --git a/Completion/User/_whois b/Completion/User/_whois index 97306871e..0d2675d47 100644 --- a/Completion/User/_whois +++ b/Completion/User/_whois @@ -204,7 +204,7 @@ _whois:whois.internic.net () { if (( CURRENT == 1 )); then local expl - _wanted string expl string && compadd "$expl[@]" HELP DOMAIN HOST + _wanted strings expl string && compadd "$expl[@]" HELP DOMAIN HOST else _message 'string' fi @@ -215,7 +215,7 @@ _whois:whois.nic.ad.jp () { if (( CURRENT == 1 )); then local expl - _wanted string expl string && compadd HELP DOM NET HOST PERSON CONN COM + _wanted strings expl string && compadd HELP DOM NET HOST PERSON CONN COM else _message 'string' fi diff --git a/Completion/X/_xutils b/Completion/X/_xutils index ed208dfe5..505701676 100644 --- a/Completion/X/_xutils +++ b/Completion/X/_xutils @@ -67,7 +67,7 @@ xhost) esac else _alternative \ - 'families:name family:compadd -S: - inet dnet nis krb' \ + 'types:name family:compadd -S: - inet dnet nis krb' \ 'hosts:: _hosts' && ret=0 fi return ret -- cgit 1.4.1