summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-05 11:28:08 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-05 11:28:08 +0000
commitb8bdb144d2a310632efb3bbd7dd78d4f296bc62f (patch)
tree8c32a29b3e72dce2728535f4a5ead0be9a7f8e89
parentfc426939cc5a8bc7acd809f9e013e6c10ede044f (diff)
downloadzsh-b8bdb144d2a310632efb3bbd7dd78d4f296bc62f.tar.gz
zsh-b8bdb144d2a310632efb3bbd7dd78d4f296bc62f.zip
use basename of commands instead of $words[1]
-rw-r--r--ChangeLog10
-rw-r--r--Completion/Debian/_apt401
-rw-r--r--Completion/Debian/_bug61
-rw-r--r--Completion/Debian/_dpkg2
-rw-r--r--Completion/User/_chown6
-rw-r--r--Completion/User/_dvi96
-rw-r--r--Completion/User/_imagemagick2
-rw-r--r--Completion/User/_ispell2
-rw-r--r--Completion/User/_lp2
-rw-r--r--Completion/User/_mount643
-rw-r--r--Completion/User/_mysql_utils24
-rw-r--r--Completion/User/_pbm448
-rw-r--r--Completion/User/_psutils2
-rw-r--r--Completion/User/_rcs13
-rw-r--r--Completion/User/_rlogin83
-rw-r--r--Completion/User/_ssh364
-rw-r--r--Completion/User/_tiff8
-rw-r--r--Completion/User/_yp50
-rw-r--r--Completion/X/_xutils2
19 files changed, 1510 insertions, 709 deletions
diff --git a/ChangeLog b/ChangeLog
index e23c4607e..2f38b5889 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,16 @@
2000-04-05 Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
+ * 10511: Completion/Debian/_apt, Completion/Debian/_bug,
+ Completion/Debian/_dpkg, Completion/User/_chown,
+ Completion/User/_dvi, Completion/User/_imagemagick,
+ Completion/User/_ispell, Completion/User/_lp,
+ Completion/User/_mount, Completion/User/_mysql_utils,
+ Completion/User/_pbm, Completion/User/_psutils,
+ Completion/User/_rcs, Completion/User/_rlogin,
+ Completion/User/_ssh, Completion/User/_tiff, Completion/User/_yp,:
+ Completion/X/_xutils: use basename of commands instead of $words[1]
+
* 10508: Completion/Builtins/_zstyle, Completion/Core/_path_files,
Doc/Zsh/compsys.yo, Functions/Zle/incremental-complete-word:
renaming some styles
diff --git a/Completion/Debian/_apt b/Completion/Debian/_apt
index fe909bda3..169b5f5f7 100644
--- a/Completion/Debian/_apt
+++ b/Completion/Debian/_apt
@@ -1,7 +1,7 @@
#compdef apt-get apt-cache apt-cdrom apt-config
_apt () {
- case "$words[1]" in
+ case "${words[1]:t}" in
apt-get) _apt-get "$@";;
apt-cache) _apt-cache "$@";;
apt-cdrom) _apt-cdrom "$@";;
@@ -17,7 +17,7 @@ _apt_arguments () {
funcname="$1"
shift
- typeset -A canonicalize options
+ typeset -A canonicalize num_options
local short_hasarg short_bool short_intlevel short_configfile short_arbitem
local long_hasarg long_bool long_intlevel long_configfile long_arbitem
local comp_hasarg=''
@@ -28,11 +28,11 @@ _apt_arguments () {
type="${1#*:}"
case $type in
- bool) options[$opts]=1;;
- intlevel) options[$opts]=-1;;
- configfile) options[$opts]=1;;
- arbitem) options[$opts]=-1;;
- *) options[$opts]=1
+ bool) num_options[$opts]=1;;
+ intlevel) num_options[$opts]=-1;;
+ configfile) num_options[$opts]=1;;
+ arbitem) num_options[$opts]=-1;;
+ *) num_options[$opts]=1
comp_hasarg="${comp_hasarg}$opts) $type;;"$'\n'
type=hasarg;;
esac
@@ -54,7 +54,7 @@ _apt_arguments () {
case \$current_option in
${comp_hasarg}esac"
- local short_seq false true bool __bool_ intlevel word word1 nul
+ local short_seq false true bool bool_prefix intlevel word word1 nul qnul
local comp_bool comp_intlevel comp_configfile comp_arbitem comp_long comp_opt
local regex_short regex_long regex_all
@@ -66,15 +66,16 @@ _apt_arguments () {
true=(yes true with on enable)
bool=($false $true)
- __bool_=(--${^bool}-)
+ bool_prefix=(--${^bool}-)
intlevel='[0-9]##'
word=$'[^\0]#\0'
word1=$'[^\0]##\0'
nul=$'\0'
+ qnul="\$'\\0'"
- comp_bool='compadd "$expl_bool[@]" '"$bool"
+ comp_bool='_wanted values && compadd "$expl_bool[@]" '"$bool"
comp_intlevel= #"_message 'intlevel'"
comp_configfile='_files "$expl_configfile[@]"'
comp_arbitem= #"_message 'Foo::Bar=bar'"
@@ -82,38 +83,30 @@ _apt_arguments () {
comp_short=\
'if [[ $PREFIX = -'"$short_seq"' ]]; then
_apt_consume_short ${PREFIX[2,-1]}
- tmp1=(${${(M)${(s:,:)${(kj:,:)options[(R)*~0]}}:#-?}#-})
- if [[ $PREFIX = - ]]; then
- compadd "$expl_opt[@]" - -${^tmp1}
- else
- tmp2=(-${^tmp1})
- compadd "$expl_opt[@]" -y "($tmp2)" - ${PREFIX}${^tmp1}
- fi
+ tmp1=(${(M)${(s:,:)${(kj:,:)num_options[(R)*~0]}}:#-?})
+ tmp2=(${PREFIX}${^tmp1#-})
+ _describe -o option tmp1 tmp2
elif [[ -z "$PREFIX" ]]; then
- compadd "$expl_opt[@]" - ${(M)${(s:,:)${(kj:,:)options[(R)*~0]}}:#-?}
+ tmp1=(${(M)${(s:,:)${(kj:,:)num_options[(R)*~0]}}:#-?})
+ _describe -o option tmp1
fi'
comp_long=\
-'tmp1="${(j:|:)${(@)${(@M)${(@s:,:)${(@kj:,:)options[(R)*~0]}}:#--*}#--}}"
+'tmp1="${(j:|:)${(@)${(@M)${(@s:,:)${(@kj:,:)num_options[(R)*~0]}}:#--*}#--}}"
tmp2=(--${(M)^long_bool:#$~tmp1} --${(M)^long_intlevel:#$~tmp1})
-compadd "$expl_opt[@]" - $tmp2
-tmp2=(--${(M)^long_hasarg:#$~tmp1} --${(M)^long_configfile:#$~tmp1} --${(M)^long_arbitem:#$~tmp1})
-compadd "$expl_opt[@]" -S= - $tmp2
-compadd "$expl_opt[@]" -S "" - '"$__bool_"
+tmp3=(--${(M)^long_hasarg:#$~tmp1} --${(M)^long_configfile:#$~tmp1} --${(M)^long_arbitem:#$~tmp1})
+_describe -o option tmp2 -- tmp3 -S= -- bool_prefix -S ""'
comp_long_prefix=\
-'tmp1="${(j:|:)${(@)${(@M)${(@s:,:)${(@kj:,:)options[(R)*~0]}}:#--*}#--}}"
+'tmp1="${(j:|:)${(@)${(@M)${(@s:,:)${(@kj:,:)num_options[(R)*~0]}}:#--*}#--}}"
tmp2=($_ra_left${(M)^long_bool:#$~tmp1} $_ra_left${(M)^long_intlevel:#$~tmp1})
-compadd "$expl_opt[@]" - $tmp2
-tmp2=($_ra_left${(M)^long_hasarg:#$~tmp1} $_ra_left${(M)^long_configfile:#$~tmp1} $_ra_left${(M)^long_arbitem:#$~tmp1})
-compadd "$expl_opt[@]" -S= - $tmp2
-tmp1="${(j:|:)${(@)${(@M)${(@s:,:)${(@kj:,:)options[(R)*~0]}}:#-?}#-}}"
-tmp2=($_ra_left${(M)^short_bool:#$~tmp1} $_ra_left${(M)^short_intlevel:#$~tmp1})
-compadd "$expl_opt[@]" - $tmp2
-tmp2=($_ra_left${(M)^short_hasarg:#$~tmp1} $_ra_left${(M)^short_configfile:#$~tmp1} $_ra_left${(M)^short_arbitem:#$~tmp1})
-compadd "$expl_opt[@]" -S= - $tmp2'
+tmp3=($_ra_left${(M)^long_hasarg:#$~tmp1} $_ra_left${(M)^long_configfile:#$~tmp1} $_ra_left${(M)^long_arbitem:#$~tmp1})
+tmp1="${(j:|:)${(@)${(@M)${(@s:,:)${(@kj:,:)num_options[(R)*~0]}}:#-?}#-}}"
+tmp2=("$tmp2[@]" $_ra_left${(M)^short_bool:#$~tmp1} $_ra_left${(M)^short_intlevel:#$~tmp1})
+tmp3=("$tmp3[@]" $_ra_left${(M)^short_hasarg:#$~tmp1} $_ra_left${(M)^short_configfile:#$~tmp1} $_ra_left${(M)^short_arbitem:#$~tmp1})
+_describe -o option tmp2 -- tmp3 -S='
- comp_opt='[[ -prefix - || -z "$compconfig[option_prefix]" ]]'" && { $comp_short; $comp_long }"
+ comp_opt='{ ! zstyle -T ":completion:${curcontext}:options" prefix-needed || [[ "$PREFIX" = -* ]] }'" && { $comp_short; $comp_long }"
regex_short=()
regex_long=()
@@ -121,206 +114,204 @@ compadd "$expl_opt[@]" -S= - $tmp2'
if (( $#short_hasarg )); then
regex_short=("$regex_short[@]"
- /"$short_seq(${(j:|:)short_hasarg})(=|)"
- -'_apt_consume_short ${_ra_match%=}; current_option=${canonicalize[-${${_ra_match%=}[-1]}]}'
- \( /"$word1" !"$comp_hasarg" \| /"$nul" /"$word" !"$comp_hasarg" \) \|
+ /"$short_seq(${(j:|:)short_hasarg})(=|)"/
+ -'_apt_consume_short ${match[1]%=}; current_option=${canonicalize[-${${match[1]%=}[-1]}]}'
+ \( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)short_hasarg})$nul"
- -'_apt_consume_short ${_ra_match[-2]}; current_option=${canonicalize[-${${_ra_match%$nul}[-1]}]}'
- /"$word" !"$comp_hasarg" \|
- /"(${(j:|:)short_hasarg})="
- -'_apt_consume_short ${_ra_match[-2]}; current_option=${canonicalize[-${${_ra_match%=}[-1]}]}'
- \( /"$word1" !"$comp_hasarg" \| /"$nul" /"$word" !"$comp_hasarg" \) \|
+ /"(${(j:|:)short_hasarg})$nul"/
+ -'_apt_consume_short ${match[1][-2]}; current_option=${canonicalize[-${${match[1]%'$qnul'}[-1]}]}'
+ /"$word"/ :"$comp_hasarg" \|
+ /"(${(j:|:)short_hasarg})="/
+ -'_apt_consume_short ${match[1][-2]}; current_option=${canonicalize[-${${match[1]%=}[-1]}]}'
+ \( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
)
fi
if (( $#short_bool )); then
regex_short=("$regex_short[@]"
- /"$short_seq(${(j:|:)short_bool})($nul(${(j:|:)bool})|(${(j:|:)bool})|)$nul"
- -"_apt_consume_short \${_ra_match%%($nul(${(j:|:)bool})|(${(j:|:)bool})|)$nul}" \|
- /"$short_seq(${(j:|:)short_bool})="
- -"_apt_consume_short \${_ra_match%=}"
- \( /"$word1" !"$comp_bool" \| /"$nul" /"$word" !"$comp_bool" \) \|
+ /"$short_seq(${(j:|:)short_bool})($nul(${(j:|:)bool})|(${(j:|:)bool})|)$nul"/
+ -'_apt_consume_short ${match[1]%%('$qnul'('${(j:|:)bool}')|('${(j:|:)bool}')|)'$qnul'}' \|
+ /"$short_seq(${(j:|:)short_bool})="/
+ -'_apt_consume_short ${match[1]%=}'
+ \( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)short_bool})="
- -"_apt_consume_short \${_ra_match[-2]}"
- \( /"$word1" !"$comp_bool" \| /"$nul" /"$word" !"$comp_bool" \) \|
- /"(${(j:|:)short_bool})$nul"
- -"_apt_consume_short \${_ra_match[-2]}"
- /"((${(j:|:)bool})$nul|)" !"$comp_bool" \|
+ /"(${(j:|:)short_bool})="/
+ -'_apt_consume_short ${match[1][-2]}'
+ \( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
+ /"(${(j:|:)short_bool})$nul"/
+ -'_apt_consume_short ${match[1][-2]}'
+ /"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
)
fi
if (( $#short_intlevel )); then
regex_short=("$regex_short[@]"
- /"$short_seq(${(j:|:)short_intlevel})($nul$intlevel|$intlevel|)$nul"
- -"_apt_consume_short \${_ra_match%%($nul$intlevel|$intlevel|)$nul}" \|
- /"$short_seq(${(j:|:)short_intlevel})="
- -"_apt_consume_short \${_ra_match%=}"
- \( /"$word1" !"$comp_intlevel" \| /"$nul" /"$word" !"$comp_intlevel" \) \|
+ /"$short_seq(${(j:|:)short_intlevel})($nul$intlevel|$intlevel|)$nul"/
+ -'_apt_consume_short ${match[1]%%'"($qnul$intlevel|$intlevel|)$qnul"'}' \|
+ /"$short_seq(${(j:|:)short_intlevel})="/
+ -'_apt_consume_short ${match[1]%=}'
+ \( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)short_intlevel})="
- -"_apt_consume_short \${_ra_match[-2]}"
- \( /"$word1" !"$comp_intlevel" \| /"$nul" /"$word" !"$comp_intlevel" \) \|
- /"(${(j:|:)short_intlevel})$nul"
- -"_apt_consume_short \${_ra_match[-2]}"
- /"($intlevel$nul|)" !"$comp_intlevel" \|
+ /"(${(j:|:)short_intlevel})="/
+ -'_apt_consume_short ${match[1][-2]}'
+ \( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
+ /"(${(j:|:)short_intlevel})$nul"/
+ -'_apt_consume_short ${match[1][-2]}'
+ /"($intlevel$nul|)"/ :"$comp_intlevel" \|
)
fi
if (( $#short_configfile )); then
regex_short=("$regex_short[@]"
- /"$short_seq(${(j:|:)short_configfile})(=|)"
- -"_apt_consume_short \${_ra_match%=}"
- \( /"$word1" !"$comp_configfile" \| /"$nul" /"$word" !"$comp_configfile" \) \|
+ /"$short_seq(${(j:|:)short_configfile})(=|)"/
+ -'_apt_consume_short ${match[1]%=}'
+ \( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)short_configfile})$nul"
- -"_apt_consume_short \${_ra_match[-2]}"
- /"$word" !"$comp_configfile" \|
- /"(${(j:|:)short_configfile})="
- -"_apt_consume_short \${_ra_match[-2]}"
- \( /"$word1" !"$comp_configfile" \| /"$nul" /"$word" !"$comp_configfile" \) \|
+ /"(${(j:|:)short_configfile})$nul"/
+ -'_apt_consume_short ${match[1][-2]}'
+ /"$word"/ :"$comp_configfile" \|
+ /"(${(j:|:)short_configfile})="/
+ -'_apt_consume_short ${match[1][-2]}'
+ \( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
)
fi
if (( $#short_arbitem )); then
regex_short=("$regex_short[@]"
- /"$short_seq(${(j:|:)short_arbitem})(=|)"
- -"_apt_consume_short \${_ra_match%=}"
- \( /"$word1" !"$comp_arbitem" \| /"$nul" /"$word" !"$comp_arbitem" \) \|
+ /"$short_seq(${(j:|:)short_arbitem})(=|)"/
+ -'_apt_consume_short ${match[1]%=}'
+ \( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)short_arbitem})$nul"
- -"_apt_consume_short \${_ra_match[-2]}"
- /"$word" !"$comp_arbitem" \|
- /"(${(j:|:)short_arbitem})="
- -"_apt_consume_short \${_ra_match[-2]}"
- \( /"$word1" !"$comp_arbitem" \| /"$nul" /"$word" !"$comp_arbitem" \) \|
+ /"(${(j:|:)short_arbitem})$nul"/
+ -'_apt_consume_short ${match[1][-2]}'
+ /"$word"/ :"$comp_arbitem" \|
+ /"(${(j:|:)short_arbitem})="/
+ -'_apt_consume_short ${match[1][-2]}'
+ \( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
)
fi
if (( $#long_hasarg )); then
regex_long=("$regex_long[@]"
- /"(${(j:|:)long_hasarg})$nul"
- -"_apt_consume_long \${_ra_match%$nul}; current_option=\${canonicalize[--\${_ra_match%$nul}]}"
- /"$word" !"$comp_hasarg" \|
- /"(${(j:|:)long_hasarg})="
- -"_apt_consume_long \${_ra_match%=}; current_option=\${canonicalize[--\${_ra_match%=}]}"
- \( /"$word1" !"$comp_hasarg" \| /"$nul" /"$word" !"$comp_hasarg" \) \|
+ /"(${(j:|:)long_hasarg})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}; current_option=${canonicalize[--${match[1]%'$qnul'}]}'
+ /"$word"/ :"$comp_hasarg" \|
+ /"(${(j:|:)long_hasarg})="/
+ -'_apt_consume_long ${match[1]%=}; current_option=${canonicalize[--${match[1]%=}]}'
+ \( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)long_hasarg})$nul"
- -"_apt_consume_long \${_ra_match%$nul}; current_option=\${canonicalize[--\${_ra_match%$nul}]}"
- /"$word" !"$comp_hasarg" \|
- /"(${(j:|:)long_hasarg})="
- -"_apt_consume_long \${_ra_match%=}; current_option=\${canonicalize[--\${_ra_match%=}]}"
- \( /"$word1" !"$comp_hasarg" \| /"$nul" /"$word" !"$comp_hasarg" \) \|
+ /"(${(j:|:)long_hasarg})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}; current_option=${canonicalize[--${match[1]%'$qnul'}]}'
+ /"$word"/ :"$comp_hasarg" \|
+ /"(${(j:|:)long_hasarg})="/
+ -'_apt_consume_long ${match[1]%=}; current_option=${canonicalize[--${match[1]%=}]}'
+ \( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
)
fi
if (( $#long_bool )); then
regex_long=("$regex_long[@]"
- /"(${(j:|:)long_bool})="
- -"_apt_consume_long \${_ra_match%=}"
- \( /"$word1" !"$comp_bool" \| /"$nul" /"$word" !"$comp_bool" \) \|
- /"(${(j:|:)long_bool})$nul"
- -"_apt_consume_long \${_ra_match%$nul}"
- /"((${(j:|:)bool})$nul|)" !"$comp_bool" \|
+ /"(${(j:|:)long_bool})="/
+ -'_apt_consume_long ${match[1]%=}'
+ \( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
+ /"(${(j:|:)long_bool})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}'
+ /"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)long_bool})="
- -"_apt_consume_long \${_ra_match%=}"
- \( /"$word1" !"$comp_bool" \| /"$nul" /"$word" !"$comp_bool" \) \|
- /"(${(j:|:)long_bool})$nul"
- -"_apt_consume_long \${_ra_match%$nul}"
- /"((${(j:|:)bool})$nul|)" !"$comp_bool" \|
+ /"(${(j:|:)long_bool})="/
+ -'_apt_consume_long ${match[1]%=}'
+ \( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
+ /"(${(j:|:)long_bool})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}'
+ /"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
)
fi
if (( $#long_intlevel )); then
regex_long=("$regex_long[@]"
- /"(${(j:|:)long_intlevel})="
- -"_apt_consume_long \${_ra_match%=}"
- \( /"$word1" !"$comp_intlevel" \| /"$nul" /"$word" !"$comp_intlevel" \) \|
- /"(${(j:|:)long_intlevel})$nul"
- -"_apt_consume_long \${_ra_match%$nul}"
- /"($intlevel$nul|)" !"$comp_intlevel" \|
+ /"(${(j:|:)long_intlevel})="/
+ -'_apt_consume_long ${match[1]%=}'
+ \( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
+ /"(${(j:|:)long_intlevel})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}'
+ /"($intlevel$nul|)"/ :"$comp_intlevel" \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)long_intlevel})$nul"
- -"_apt_consume_long \${_ra_match%$nul}"
- /"$intlevel" !"$comp_intlevel" /"$nul" \|
- /"(${(j:|:)long_intlevel})="
- -"_apt_consume_long \${_ra_match%=}"
- \( /"$word1" !"$comp_intlevel" \| /"$nul" /"$word" !"$comp_intlevel" \) \|
- /"(${(j:|:)long_intlevel})$nul"
- -"_apt_consume_long \${_ra_match%$nul}"
- /"($intlevel$nul|)" !"$comp_intlevel" \|
+ /"(${(j:|:)long_intlevel})="/
+ -'_apt_consume_long ${match[1]%=}'
+ \( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
+ /"(${(j:|:)long_intlevel})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}'
+ /"($intlevel$nul|)"/ :"$comp_intlevel" \|
)
fi
if (( $#long_configfile )); then
regex_long=("$regex_long[@]"
- /"(${(j:|:)long_configfile})$nul"
- -"_apt_consume_long \${_ra_match%$nul}"
- /"$word" !"$comp_configfile" \|
- /"(${(j:|:)long_configfile})="
- -"_apt_consume_long \${_ra_match%=}"
- \( /"$word1" !"$comp_configfile" \| /"$nul" /"$word" !"$comp_configfile" \) \|
+ /"(${(j:|:)long_configfile})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}'
+ /"$word"/ :"$comp_configfile" \|
+ /"(${(j:|:)long_configfile})="/
+ -'_apt_consume_long ${match[1]%=}'
+ \( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)long_configfile})$nul"
- -"_apt_consume_long \${_ra_match%$nul}"
- /"$word" !"$comp_configfile" \|
- /"(${(j:|:)long_configfile})="
- -"_apt_consume_long \${_ra_match%=}"
- \( /"$word1" !"$comp_configfile" \| /"$nul" /"$word" !"$comp_configfile" \) \|
+ /"(${(j:|:)long_configfile})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}'
+ /"$word"/ :"$comp_configfile" \|
+ /"(${(j:|:)long_configfile})="/
+ -'_apt_consume_long ${match[1]%=}'
+ \( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
)
fi
if (( $#long_arbitem )); then
regex_long=("$regex_long[@]"
- /"(${(j:|:)long_arbitem})$nul"
- -"_apt_consume_long \${_ra_match%$nul}"
- /"$word" !"$comp_arbitem" \|
- /"(${(j:|:)long_arbitem})="
- -"_apt_consume_long \${_ra_match%=}"
- \( /"$word1" !"$comp_arbitem" \| /"$nul" /"$word" !"$comp_arbitem" \) \|
+ /"(${(j:|:)long_arbitem})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}'
+ /"$word"/ :"$comp_arbitem" \|
+ /"(${(j:|:)long_arbitem})="/
+ -'_apt_consume_long ${match[1]%=}'
+ \( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
)
regex_long_prefix=("$regex_long_prefix[@]"
- /"(${(j:|:)long_arbitem})$nul"
- -"_apt_consume_long \${_ra_match%$nul}"
- /"$word" !"$comp_arbitem" \|
- /"(${(j:|:)long_arbitem})="
- -"_apt_consume_long \${_ra_match%=}"
- \( /"$word1" !"$comp_arbitem" \| /"$nul" /"$word" !"$comp_arbitem" \) \|
+ /"(${(j:|:)long_arbitem})$nul"/
+ -'_apt_consume_long ${match[1]%'$qnul'}'
+ /"$word"/ :"$comp_arbitem" \|
+ /"(${(j:|:)long_arbitem})="/
+ -'_apt_consume_long ${match[1]%=}'
+ \( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
)
fi
regex_all=(
- /"$word"
- \( %-- \( "$regex_long[@]"
- %"(${(j:|:)bool})-"
- \( "$regex_long_prefix[@]" /"[]" !"$comp_long_prefix" \) \|
- /"[]" !"$comp_long" \) \|
- %- \( "$regex_short[@]" /"[]" !"$comp_short; $comp_long" \) \|
- /"[]" !"$comp_opt" \) \#
+ /"$word"/
+ \( /--/+ \( "$regex_long[@]"
+ /"(${(j:|:)bool})-"/+
+ \( "$regex_long_prefix[@]"
+ /"[]"/ :"$comp_long_prefix" \) \) \|
+ /-/+ \( "$regex_short[@]" /"[]"/ \) \|
+ /"[]"/ :"$comp_opt" \) \#
"$regex_all[@]"
)
_regex_arguments "${funcname}_sm" "$regex_all[@]"
eval "$funcname () {
- typeset -A canonicalize options
+ typeset -A canonicalize num_options
canonicalize=(${(kv)canonicalize})
- options=(${(kv)options})
+ num_options=(${(kv)num_options})
local short_hasarg short_bool short_intlevel short_configfile short_arbitem
local long_hasarg long_bool long_intlevel long_configfile long_arbitem
+ local bool_prefix
short_hasarg=($short_hasarg)
short_bool=($short_bool)
short_intlevel=($short_intlevel)
@@ -331,13 +322,14 @@ compadd "$expl_opt[@]" -S= - $tmp2'
long_intlevel=($long_intlevel)
long_configfile=($long_configfile)
long_arbitem=($long_arbitem)
+ bool_prefix=($bool_prefix)
local expl_opt expl_bool expl_configfile
- _description expl_opt option
- _description expl_bool 'bool value'
- _description expl_configfile 'config file'
+ _description options expl_opt option
+ _description values expl_bool 'boolean value'
+ _description files expl_configfile 'config file'
- local current_option tmp1 tmp2
+ local current_option tmp1 tmp2 tmp3
${funcname}_sm
}"
@@ -347,14 +339,16 @@ _apt_consume_short () {
local short opt
for short in ${(s::)1}; do
opt="$canonicalize[-$short]"
- (( 0 < options[$opt] && options[$opt]-- ))
+ (( 0 < num_options[$opt] && num_options[$opt]-- ))
done
+ return 0
}
_apt_consume_long () {
local long opt
opt="$canonicalize[--$1]"
- (( 0 < options[$opt] && options[$opt]-- ))
+ (( 0 < num_options[$opt] && num_options[$opt]-- ))
+ return 0
}
_apt-get () {
@@ -374,26 +368,28 @@ _apt-get () {
--no-upgrade:bool \
--force-yes:bool \
--print-uris:bool \
+ --purge:bool \
+ --list-cleanup:bool \
-c,--config-file:configfile \
-o,--option:arbitem \
-- \
- /$'update\0' \| \
- /$'upgrade\0' \| \
- /$'install\0' /$'[^\0]#\0' !'_deb_packages uninstalled "$expl_packages[@]" || _deb_packages installed "$expl_packages[@]" ' \# \| \
- /$'remove\0' /$'[^\0]#\0' !'_deb_packages installed "$expl_packages[@]"' \# \| \
- /$'dist-upgrade\0' \| \
- /$'dselect-upgrade\0' \| \
- /$'clean\0' \| \
- /$'autoclean\0' \| \
- /$'check\0' \| \
- /$'source\0' /$'[^\0]#\0' !'_deb_packages avail "$expl_packages[@]"' \# \| \
- /$'help\0' \| \
- /"[]" !'compadd "$expl_action[@]" update upgrade install remove dist-upgrade dselect-upgrade clean autoclean check source help'
+ /$'update\0'/ \| \
+ /$'upgrade\0'/ \| \
+ /$'install\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" uninstalled || _deb_packages "$expl_packages[@]" installed' \# \| \
+ /$'remove\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" installed' \# \| \
+ /$'dist-upgrade\0'/ \| \
+ /$'dselect-upgrade\0'/ \| \
+ /$'clean\0'/ \| \
+ /$'autoclean\0'/ \| \
+ /$'check\0'/ \| \
+ /$'source\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" avail' \# \| \
+ /$'help\0/' \| \
+ /"[]"/ :'_wanted actions expl_action action compadd update upgrade install remove dist-upgrade dselect-upgrade clean autoclean check source help'
_apt-get () {
local expl_action expl_packages
- _description expl_action 'action'
- _description expl_packages 'package'
+ _description actions expl_action 'action'
+ _description packages expl_packages 'package'
_apt-get_sm
}
@@ -414,25 +410,26 @@ _apt-cache () {
-c,--config-file:configfile \
-o,--option:arbitem \
-- \
- /$'help\0' \| \
- /$'add\0' /$'[^\0]#\0' !'_files' \# \| \
- /$'gencaches\0' \| \
- /$'showpkg\0' /$'[^\0]#\0' !'_deb_packages avail "$expl_packages[@]"' \# \| \
- /$'stats\0' \| \
- /$'dump\0' \| \
- /$'dumpavail\0' \| \
- /$'unmet\0' \| \
- /$'check\0' \| \
- /$'search\0' \| \
- /$'show\0' \| \
- /"[]" !'compadd "$expl_action[@]" help add gencaches showpkg stats dump dumpavail unmet check search show'
+ /$'help\0'/ \| \
+ /$'add\0'/ /$'[^\0]#\0'/ :'_files' \# \| \
+ /$'gencaches\0'/ \| \
+ /$'showpkg\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" avail' \# \| \
+ /$'stats\0'=$status[4]/ \| \
+ /$'dump\0'/ \| \
+ /$'dumpavail\0'/ \| \
+ /$'unmet\0'/ \| \
+ /$'check\0'/ \| \
+ /$'search\0'/ /$'[^\0]#\0'/ :'_message "pattern"' \| \
+ /$'show\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" avail' \# \| \
+ /$'depends\0'/ \| \
+ /"[]"/ :'_wanted actions expl_action action compadd help add gencaches showpkg stats dump dumpavail unmet check search show depends'
_apt-cache () {
local expl_action expl_packages expl_pkg_cache expl_src_cache
- _description expl_action 'action'
- _description expl_packages 'package'
- _description expl_pkg_cache 'package cache'
- _description expl_src_cache 'source cache'
+ _description actions expl_action 'action'
+ _description packages expl_packages 'package'
+ _description files expl_pkg_cache 'package cache'
+ _description files expl_src_cache 'source cache'
_apt-cache_sm
}
@@ -453,13 +450,13 @@ _apt-cdrom () {
-c,--config-file:configfile \
-o,--option:arbitem \
-- \
- /$'add\0' \| \
- /"[]" !'compadd "$expl_action[@]" add'
+ /$'add\0'/ \| \
+ /"[]"/ :'_wanted actions expl_action action compadd add'
_apt-cdrom () {
local expl_action expl_mount_point
- _description expl_action 'action'
- _description expl_mount_point 'mount point'
+ _description actions expl_action 'action'
+ _description files expl_mount_point 'mount point'
_apt-cdrom_sm
}
@@ -474,19 +471,19 @@ _apt-config () {
-c,--config-file:configfile \
-o,--option:arbitem \
-- \
- /$'shell\0' \
+ /$'shell\0'/ \
\( \
- /$'[^\0]#\0' !'compgen "$expl_shell_var[@]" -v' \
- /$'[^\0]#\0' !'compadd "$expl_config_key[@]" - ${${(f)"$(apt-config dump 2>&1)"}% *}' \
+ /$'[^\0]#\0'/ :'_wanted parameters expl_shell_var "shell variable to assign" compadd - "${(@k)parameters}"' \
+ /$'[^\0]#\0'/ :'_wanted configuration-keys expl_config_key "configuration key" compadd - ${${(f)"$(apt-config dump 2>&1)"}% *}' \
\) \# \| \
- /$'dump\0' \| \
- /"[]" !'compadd "$expl_action[@]" shell dump'
+ /$'dump\0'/ \| \
+ /"[]"/ :'_wanted actions expl_action action compadd shell dump'
_apt-config () {
local expl_action expl_shell_var expl_config_key
- _description expl_action 'action'
- _description expl_shell_var 'shell variable to assign'
- _description expl_config_key 'configuration key'
+ _description actions expl_action 'action'
+ _description parameters expl_shell_var 'shell variable to assign'
+ _description configuration-keys expl_config_key 'configuration key'
_apt-config_sm
}
diff --git a/Completion/Debian/_bug b/Completion/Debian/_bug
index 376fa0135..ee6046a12 100644
--- a/Completion/Debian/_bug
+++ b/Completion/Debian/_bug
@@ -1,15 +1,62 @@
-#compdef bug
+#compdef bug reportbug
-_arguments '-c[exclude configs from report]' \
- '-d[debug - send mail to postmaster@localhost]' \
- '-f[argument is a file, not a package]' \
- '-H[special header]:custom header:' \
+_bug_commonargs=('-d[debug: send mail to postmaster@localhost]' \
'-m[maintainer-only]' \
'-p[print to stdout instead of mail]' \
'-q[quiet - no e-mail forwarding]' \
+ '-h[help]' \
+ '-v[version]' \
+ '*:package:_deb_packages installed')
+
+case "${words[1]:t}" in
+bug)
+_arguments '-c[exclude configs from report]' \
+ '-f[argument is a file, not a package]' \
+ '-H[special header]:custom header:' \
'-s[set subject]:subject:' \
'-S[set severity]:severity:(wishlist normal important grave critical)' \
'-x[do not cc submitter]' \
'-z[send configs verbatim]' \
- '-h[help]' \
- '*:package:_deb_packages installed'
+ "$_bug_commonargs[@]"
+;;
+
+reportbug)
+_arguments '(--no-config-files)-c[exclude configs from report]' \
+ '(-c)--no-config-files' \
+ '(--file)-f[argument is a file, not a package]:filename:' \
+ '(-f)--file=:filename:' \
+ '(--header)-H[special header]:custom header:' \
+ '(-H)--header=:custom header:' \
+ '(--subject)-s[set subject]:subject:' \
+ '(-s)--subject=:subject:' \
+ '(--severity)-S[set severity]:severity:(wishlist normal important grave critical)' \
+ '(-S)--severity=:severity:(wishlist normal important grave critical)' \
+ '(--no-cc)-x[do not cc submitter]' \
+ '(-x)--no-cc' \
+ '(--no-compress)-z[send configs verbatim]' \
+ '(-z)--no-compress[send configs verbatim]' \
+ '(--af)-a[use af instead of editor]' \
+ '(-a)--af[use af instead of editor]' \
+ '(--no-bts-query)-b[do not check bts]' \
+ '(-b)--no-bts-query' \
+ '(--bts)-B[use alternate BTS]:system:(debian gnome kde tdyc)' \
+ '(-B)--bts=:system:(debian gnome kde tdyc)' \
+ '-g[sign report with GnuPG]' \
+ '(--include)-i[include text]:' \
+ '(-i)--include=:' \
+ '(--no-ldap)-l[disable LDAP support]' \
+ '(-l)--no-ldap' \
+ '(--mutt)-M[use mutt instead of editor]' \
+ '(-M)--mutt' \
+ '--mua=[use specified mua instead of editor]' \
+ '(--nmh --mh)-n[use comp instead of editor]' \
+ '(-n --mh)--nmh' \
+ '(--nmh -n)--mh' \
+ '(--output)-o[output to file instead of mail]' \
+ '(-o)--output=' \
+ '(--pgp)-P[sign report with PGP]' \
+ '(-P)--pgp' \
+ '--ldap[enable LDAP support]' \
+ "$_bug_commonargs[@]"
+;;
+esac
diff --git a/Completion/Debian/_dpkg b/Completion/Debian/_dpkg
index 4e10844a2..43325c636 100644
--- a/Completion/Debian/_dpkg
+++ b/Completion/Debian/_dpkg
@@ -20,7 +20,7 @@ _dpkg_common_args=('--help[show help]' \
'--version[show version]' \
'--licence[show licensing]')
-case "$words[1]" in
+case "${words[1]:t}" in
dpkg)
_arguments -s '(--install)-i[install packages]:Debian package:_files -g \*.deb' \
'(-i)--install:Debian package:_files -g \*.deb' \
diff --git a/Completion/User/_chown b/Completion/User/_chown
index 1ec76b39e..aa2ff4928 100644
--- a/Completion/User/_chown
+++ b/Completion/User/_chown
@@ -1,13 +1,13 @@
#compdef chown chgrp
if [[ CURRENT -eq 2 || CURRENT -eq 3 && $words[CURRENT-1] = -* ]]; then
- if [[ $words[1] = chgrp ]] || compset -P '*[:.]'; then
+ if [[ ${words[1]:t} = chgrp ]] || compset -P '*[:.]'; then
_groups
else
if [[ $OSTYPE = (solaris*|hpux*) ]]; then
- compgen -u -S ':' -q
+ _users -S ':' -q
else
- compgen -u -S '.' -q
+ _users -S '.' -q
fi
fi
else
diff --git a/Completion/User/_dvi b/Completion/User/_dvi
index bb2fc293e..9d551ea07 100644
--- a/Completion/User/_dvi
+++ b/Completion/User/_dvi
@@ -1,3 +1,95 @@
-#defcomp xdvi dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype
+#compdef dvips dvibook dviconcat dvicopy dvidvi dviselect dvitodvi dvitype
-_files -g '*.(dvi|DVI)'
+local expl args
+
+args=(
+ '-i[specify input file]:input DVI file:_files -g \*.\(dvi\|DVI\)' \
+ '-o[specify output file]:output DVI file:_files -g \*.\(dvi\|DVI\)' \
+ ':input DVI file:_files -g \*.\(dvi\|DVI\)' \
+ ':output DVI file:_files -g \*.\(dvi\|DVI\)'
+)
+
+case "${words[1]:t}" in
+dvips)
+ _arguments -s \
+ '-a[make three passes]' \
+ '(-B)-A[print only odd numbered pages]' \
+ '(-A)-B[print only even numbered pages]' \
+ '(-c -C)-b[select number of copies (duplicating body)]:number of copies:' \
+ '(-b -C)-c[select number of copies]:number of copies:' \
+ '(-b -c)-C[select number of copies (collated)]:number of copies:' \
+ '-d[set debug flags]:debug flags:' \
+ '(-X -Y)-D[set resolution]:resolution in dots per inch:' \
+ '-e[set maximum character offset]:maximum character offset:' \
+ '-E[generate EPSF file]' \
+ '(-o)-f[write to stdout]' \
+ '-F[append control-D]' \
+ '-h[specify additional header file]:postscript header file:_files -g \*.\(\#i\)\(ps\|eps\)' \
+ '-i[one file per section]' \
+ '-k[print crop marks]' \
+ '-K[include postscript comments]' \
+ '(-pp)-l[specify last page to print]:number of last page:' \
+ '-m[specify manual feed for printer]' \
+ '-M[no automatic font generation]' \
+ '(-pp)-n[specify maximum number of pages to print]:maximum number of pages:' \
+ '-N[turn off structured comments]' \
+ '(-f)-o[specify output file name]:output file name:_files -g \*.\(\#i\)\(ps\|eps\)' \
+ '-O[specify offset of origin]:offset of origin (<x>,<y>):' \
+ '(-p -l -n)-pp[specify which pages to print]:list of pages or ranges to print:' \
+ '(-pp)-p[specify first page to print]:number of first page:' \
+ '-P[specify printer]:printer name:' \
+ '-q[quiet operation]' \
+ '-r[reverse order of pages]' \
+ '-s[enclose output in save/restore pair]' \
+ '-S[set maximum number of pages per section]:maximum number of pages per section:' \
+ '(-T)*-t[specify paper type]:paper type:(letter legal ledger a4 a3 landscape)' \
+ '(-t)-T[set paper size]:paper size (<x>,<y>):' \
+ '-x[set magnification ratio]:magnification ratio (per mille):' \
+ '(-D)-X[set horizontal resolution]:horizontal resolution:' \
+ '(-D)-Y[set vertical resolution]:vertical resolution:' \
+ '-Z[compress bitmapped fonts]' \
+ ':input file:_files -g \*.\(dvi\|DVI\)'
+ ;;
+dvibook)
+ _arguments -s \
+ '-q[quiet operation]' \
+ '-s-[specify signature size]:signature size:' \
+ "$args[@]"
+ ;;
+dviconcat)
+ _arguments \
+ '-m[specify magnification]:magnification factor:' \
+ '-o[specify output file]:output DVI file:_files -g \*.\(dvi\|DVI\)' \
+ '*:input DVI file:_files -g \*.\(dvi\|DVI\)'
+ ;;
+dvidvi)
+ _arguments -s \
+ '-q[quiet operation]' \
+ '-r[reverse order of pages]' \
+ '(-i -x)-f[select first page]:number of first page:' \
+ '(-i -x)-l[select last page]:number of last page:' \
+ '(-i -x)-n[select number of pages]:maximum number of pages:' \
+ '(-f -l -n)-i[specify included pages]:list of included pages:' \
+ '(-f -l -n)-x[specify excluded pages]:list of excluded pages:' \
+ ':input DVI file:_files -g \*.\(dvi\|DVI\)' \
+ ':output DVI file:_files -g \*.\(dvi\|DVI\)'
+ ;;
+dviselect)
+ _arguments -s \
+ '-s[silent operation]' \
+ ':list of pages:' \
+ "$args[@]"
+ ;;
+dvitodvi)
+ _arguments -s \
+ '-q[quiet operation]' \
+ '-w-[set w dimension specifier]:width for dimension specifier:' \
+ '-h-[set h dimension specifier]:height for dimension specifier:' \
+ ':page specifications:' \
+ "$args[@]"
+ ;;
+*)
+ _description files expl 'DVI file'
+ _files "$expl[@]" -g '*.(dvi|DVI)'
+ ;;
+esac
diff --git a/Completion/User/_imagemagick b/Completion/User/_imagemagick
index 788cbbd51..36b95fdb3 100644
--- a/Completion/User/_imagemagick
+++ b/Completion/User/_imagemagick
@@ -18,7 +18,7 @@ if (( $# )); then
return
fi
-case "$words[1]" in
+case "${words[1]:t}" in
display)
_arguments -M 'm:{a-z}={A-Z}' \
'*-backdrop[use full screen]' \
diff --git a/Completion/User/_ispell b/Completion/User/_ispell
index 2d2671e25..13b203584 100644
--- a/Completion/User/_ispell
+++ b/Completion/User/_ispell
@@ -1,6 +1,6 @@
#compdef ispell buildhash munchlist findaffix tryaffix icombine ijoin
-case "$words[1]" in
+case "${words[1]:t}" in
ispell)
_arguments -s \
'(-n)-t[input file is in TeX/LaTeX format]' \
diff --git a/Completion/User/_lp b/Completion/User/_lp
index cfa2a147c..e996507ce 100644
--- a/Completion/User/_lp
+++ b/Completion/User/_lp
@@ -59,7 +59,7 @@ if compset -P -P || [[ "$words[CURRENT-1]" = -P ]]; then
return 1
fi
else
- if [[ "$words[1]" = (lpq|lprm) ]]; then
+ if [[ "${words[1]:t}" = (lpq|lprm) ]]; then
if [[ "$words" = *-P* ]]; then
printer=(-P "${${words##*-P( |)}%% *}")
else
diff --git a/Completion/User/_mount b/Completion/User/_mount
index e92f56339..a148fff27 100644
--- a/Completion/User/_mount
+++ b/Completion/User/_mount
@@ -5,8 +5,10 @@
# arguments for the `mount' command for different operating systems
# are below these table.
-local state line ret=1 args fss deffs=iso9660 descr tmp
-typeset -A options
+local curcontext="$curcontext" state line ret=1
+local args fss deffs=iso9660 descr tmp typeops=-t _nfs_access _nfs_ufs
+
+typeset -A opt_args
if (( ! $+_fs_any )); then
@@ -14,96 +16,21 @@ if (( ! $+_fs_any )); then
# arguments for the `-o' option. There is one array per
# file system type (only for those that accept more values
# than those in the `_fs_any' array). The elements of the
- # array are used as arguments to `_values'.
+ # array are used as arguments to `_values'. The first tables
+ # are used by several systems while system specific tables are
+ # (re)defined in a "$OSTYPE" case.
_fs_any=(
- '(sync)async[do all I/O asynchronously]'
- '(noatime)atime[update access time]'
- '(noauto)auto[can be mounted with -a]'
- '(rw suid dev exec auto nouser async)defaults[use default options]'
- '(nodev)dev[interpret devices]'
- '(noexec)exec[permit execution of binaries]'
- '(atime)noatime[don'"'"'t update access time]'
- '(auto)noauto[can only be mounted explicitly]'
- '(dev)nodev[don'"'"'t interpret devices]'
- '(exec)noexec[don'"'"'t allow execution of binaries]'
- '(suid)nosuid[ignore suid and sgid bits]'
- '(user)nouser[can only be mounted by root]'
- 'remount[mount already mounted file system]'
'(rw)ro[mount file system read-only]'
'(ro)rw[mount file system read-write]'
- '(nosuid)suid[use suid and sgib bits]'
- '(async)sync[do I/O synchronously]'
- '(nouser noexec nosuid nodev)user[allow normal users to mount]'
- )
- _fs_affs=(
- 'uid[set owner of root]:user ID:'
- 'gid[set group of root]:group ID:'
- 'setuid[set owner of all files]:user ID:'
- 'setgid[set group of all files]:group ID:'
- 'mode[set file permissions]:file permission bits:'
- 'protect[don'"'"'t allow changes to permissions]'
- 'usemp[set owner of root to owner of mount point]'
- 'verbose[print message per mount]'
- 'prefix[prefix before volume name (link)]:prefix string:'
- 'volume[prefix before '"'"'/'"'"' (symlink)]:prefix string:'
- 'reserved[set number of unused blocks at start of device]:number of unused blocks:'
- 'root[specify location of the root block]:root block location:'
- 'bs[specify block size]:block size:(512 1024 2048 4192)'
- )
- _fs_ext2=(
- '(minixdf)bsddf[select bsddf behavior]'
- '(bsddf)minixdf[select bsddf behavior]'
- '(nocheck)check[set checking level]::checking level:((normal\:check\ inode\ and\ block\ bitmaps\ on\ mount strict\:check\ on block\ deallocation none\:no\ checking))'
- 'errors[specify behavior on error]:error behavior:((continue\:ignore\ errors remount-ro\:remount\ file\ system\ read-only panic\:panic\ and\ halt\ system))'
- '(nogrpid bsdgroups sysvgroups)grpid[new file gets group ID of directory]'
- '(grpid nogrpid sysvgroups)bsdgroups[new file gets group ID of directory]'
- '(grpid bsdgroups sysvgroups)nogrpid[new file gets fsgid of current process]'
- '(grpid bsdgroups nogrpid)sysvgroups[new file gets fsgid of current process]'
- 'resgid[specify access to reserved space (group ID)]:group ID:'
- 'resuid[specify access to reserved space (user ID)]:user ID:'
- 'sb[specify super block number]:super block number:'
- )
- _fs_fat=(
- 'blocksize[specify block size]:block size:(512 1024)'
- 'uid[specify user ID of all files]:user ID:'
- 'gid[specify group ID of all files]:group ID:'
- 'umask[specify umask]:umask value (octal):'
- 'check[specify checking level]:checking level:((relaxed\:accept\ upper\ and\ lower\ case,\ truncate\ long\ name normal\:like\ '"'\`'"'relaxed'"\\'"',\ but\ reject\ special\ characters strict\:like\ '"'\`'"'normal'"\\'"',\ but\ no\ long\ parts))'
- 'conf[specify CR/NL conversion]:CR/NL conversion mode:((binary\:no\ translation text\:conversion\ on\ all\ files auto\:perform\ translation\ on\ file\ without\ binary\ extension))'
- 'debug[debug mode]'
- 'fat[specify fat type]:fat type (bit):(12 16)'
- 'quiet[quiet mode]'
- )
- _fs_msdos=( "$_fs_fat[@]" )
- _fs_umsdos=( "$_fs_fat[@]" )
- _fs_vfat=( "$_fs_fat[@]"
- 'uni_xlate[translate unicode to escaped sequences]'
- 'posix[allow file names only differing in case]'
- 'nonumtail[try short name before number extension]'
- )
- _fs_hpfs=(
- 'uid[specify user ID of all files]:user ID:'
- 'gid[specify group ID of all files]:group ID:'
- 'umask[specify umask]:umask value (octal):'
- 'case[specify file name conversion]:file name conversion:((lower\:convert\ to\ lower\ case asis\:no\ conversion))'
- 'conv[specify CR elimination]:CR elimination:((binary\:no\ elimination test\:delete\ CRs\ \(e.g.\ before\ NL\) auto\:sometimes\ yes,\ sometimes\ not))'
- 'nocheck[don'"'"'t abort mount on consistency check failure]'
)
- _fs_iso9660=(
- 'norock[disable Rock Ridge extensions]'
- 'check[specify file name conversion]:file name conversion:((relaxed\:convert\ to\ lower\ case\ before\ lookup strict\:no\ conversion))'
- 'uid[specify user ID of all files]:user ID:'
- 'gid[specify group ID of all files]:group ID:'
- 'map[specify non-Rock Ridge name conversion]:file name conversion:((normal\:map\ upper\ to\ lower,\ ignore\ \;1,\ map\ \;\ to\ . off\:no\ conversion))'
- 'mode[specify permissions]:file access permissions:'
- 'unhide[show hidden and associated files]'
- 'block[specify block size]:block size:(512 1024 2048)'
- 'cruft[ignore high bits of file length]'
+ _nfs_access=(
+ 'acregmin[specify cached file attributes minimum hold time]:cached file attributes minimum hold time:'
+ 'acregmax[specify cached file attributes maximum hold time]:cached file attributes maximum hold time:'
+ 'acdirmin[specify cached directory attributes minimum hold time]:cached directory attributes minimum hold time:'
+ 'acdirmax[specify cached directory attributes maximum hold time]:cached directory attributes maximum hold time:'
+ 'actimeo[set all attributes'"'"' cache timeout]:set all attributes'"'"' cache timeout:'
)
-
- # I fear that we have to make these system specific, too.
-
_fs_nfs=(
'rsize[specify read buffer size]:read buffer size:(8192)'
'wsize[specify write buffer size]:write buffer size:(8192)'
@@ -114,150 +41,536 @@ if (( ! $+_fs_any )); then
'timeo[specify initial timeout for UDP]:initial timeout for UDP:'
'retrans[set number of NFS retransmissions]:number of NFS retransmissions:'
'retry[specify number of mount failure retries]:mount failure retries:'
- '(nobg)bg[retry in the background]'
- '(nofg)fg[retry in the foreground]'
- '(nointr)intr[allow operations to be interrupted]'
- '(bg)nobg[don'"'"'t retry in the background]'
- '(fg)nofg[don'"'"'t retry in the foreground]'
+ '(fg)bg[retry in the background]'
+ '(bg)fg[retry in the foreground]'
+ '(nintr)intr[allow operations to be interrupted]'
'(intr)nintr[prevent operations from being interrupted]'
'(nfsv3)nfsv2[use NFS version 2]'
'(nfsv2)nfsv3[use NFS version 3]'
'proto[specify protocol]:protocol:(udp tcp)'
- 'port[specify server port number]:server port number:' \
+ 'port[specify server port number]:server port number:'
'proplist[allow property lists]'
- 'acregmin[specify cached file attributes minimum hold time]:cached file attributes minimum hold time:'
- 'acregmax[specify cached file attributes maximum hold time]:cached file attributes maximum hold time:'
- 'acdirmin[specify cached directory attributes minimum hold time]:cached directory attributes minimum hold time:'
- 'acdirmax[specify cached directory attributes maximum hold time]:cached directory attributes maximum hold time:'
- 'actimeo[set all attributes'"'"' cache timeout]:set all attributes'"'"' cache timeout:'
+ "$_nfs_access[@]"
'nocto[don'"'"'t get fresh attributes on open]'
'noac[don'"'"'t set attribute caching]'
)
- _fs_advfs=(
- '(ro rw)rq[mount file system read-write]'
- 'dual[allow mount even if same domain ID as already mounted domain]'
+ _nfs_ufs=(
+ '(nodev)dev[interpret devices]'
+ '(dev)nodev[don'"'"'t interpret devices]'
+ '(nosuid)suid[use suid and sgib bits]'
+ '(suid)nosuid[ignore suid and sgid bits]'
+ '(nosync)sync[do I/O synchronously]'
+ '(sync)nosync[do all I/O asynchronously]'
+ '(noexec)exec[permit execution of binaries]'
+ '(exec)noexec[don'"'"'t allow execution of binaries]'
+ '(nogrpid)grpid[new file gets group ID of directory]'
+ '(grpid)nogrpid[new file gets fsgid of current process]'
)
_fs_ufs=(
'dirty[allow mount even if not cleanly unmounted]'
- "$_fs_nfs[@]"
- )
- _fs_cdfs=(
- '(nodefperm)defperm[ignore permission bits]'
- '(defperm)defperm[use permission bits]'
- 'noversion[strip off version extension]'
- 'rrip[use RRIP extensions]'
+ "$_nfs_ufs[@]"
)
+
+ case "$OSTYPE" in
+ aix*)
+ _fs_any=(
+ 'bsy[prevent mount over cwd of process]'
+ 'log[logical volume to log operations]:logical volume name'
+ 'nodev[cannot open devices from mount]'
+ 'nosuid[prevent running setuid/setgid from mount]'
+ "$_fs_any[@]"
+ )
+
+ _fs_nfs=(
+ '(fg)bg[mount in background]'
+ '(bg)fg[mount in foreground]'
+ 'vers[NFS version]:NFS version:(2 3)'
+ 'proto[specify transport protocol]'
+ 'retry[number of retries]:no. of retries'
+ 'rsize[read buffer size]:read buffer size'
+ 'wsize[write buffer size]:write buffer size'
+ 'llock[local locking]'
+ 'timeo[time-out period]:time-out period'
+ 'retrans[NFS transmissions]:no. of NFS transmissions'
+ 'port[IP port no]:IP port no'
+ '(hard)soft[error on no server response]'
+ '(soft)hard[retry pending server response]'
+ '(nointr)intr[allow keyboard interrupts on hard mount]'
+ '(intr)nointr[disallow keyboard interrupts on hard mount]'
+ 'posix[exchange pathconf info on NFS version 2 mount]'
+ 'secure[use DES encryption]'
+ 'grpid[inherit group id of parent directory]'
+ '(acl)noacl[don'"'"'t use access control lists]'
+ '(noacl)acl[Use acces control lists for this mount]'
+ 'noac[no attribute or directory caching]'
+ 'shortdev[server lack support for 32-bit device special files]'
+ "$_nfs_access[@]"
+ )
+ ;;
+ irix*)
+ _fs_any=(
+ 'nodev[cannot open devices from mount]'
+ 'nosuid[prevent running setuid/setgid from mount]'
+ 'grpid[inherit group id of parent directory]'
+ "$_fs_any[@]"
+ )
+
+ _fs_efs=(
+ 'raw[raw device pathname to filesystem]:raw device pathname:->devordir'
+ '(nofsck)fsck[fsck should check this filesystem by default]'
+ '(fsck)nofsck[fsck should not check this filesystem by default]'
+ '(noquota)quota[turn on quotas]'
+ '(quota)noquota[turn off quotas]'
+ 'lbsize[no of bytes transferred in each operation]:bytes'
+ )
+
+ _fs_iso9660=(
+ 'setx[set execute permissions on every file]'
+ 'notranslate[don'\''t translate filenames]'
+ 'cache[no of 2048 blocks for directory cache]:cache size'
+ 'noext[ignore rock ridge extensions]'
+ '(nosusp)susp[enable system use sharing protocol]'
+ '(susp)nosusp[disable system use sharing protocol]'
+ '(norrip)rrip[enable rock ridge extensions]'
+ '(rrip)norrip[disable rock ridge extensions]'
+ 'nmconv[specify filename translation]:filename translation:(c l m)'
+ )
+
+ _fs_nfs=(
+ '(fg)bg[mount in background]'
+ '(bg)fg[mount in foreground]'
+ 'retry[number of retries]:no. of retries'
+ 'rsize[read buffer size]:read buffer size'
+ 'wsize[write buffer size]:write buffer size'
+ 'timeo[time-out period]:time-out period'
+ 'retrans[NFS transmissions]:no. of NFS transmissions'
+ 'port[IP port no]:IP port no'
+ '(hard)soft[error on no server response]'
+ '(soft)hard[retry pending server response]'
+ 'intr[allow keyboard interrupts on hard mount]'
+ 'noac[no attribute caching]'
+ 'private[use local locking and do not flush on last close]'
+ 'symttl[time-to-live of cached symbolic links]:seconds'
+ "$_nfs_access[@]"
+ )
+
+ _fs_cachefs=(
+ 'backfstype[type of the back file system]:back file system type:(efs nfs iso9660 dos hfs cachefs)'
+ 'backpath[specify back file system location]:back file system location:_files -/'
+ 'cachedir[name of the cache directory]:name of cache directory:_files -/'
+ 'cacheid[cache ID]:cache ID'
+ '(write-around)non-shared[cache not shared]'
+ '(non-shared)write-around[cache shared]'
+ 'noconst[disable consistency checking]'
+ 'local-access[check permissions locally]'
+ 'purge[purge any cached information]'
+ "$_nfs_access[@]"
+ )
+
+ ;;
+ solaris*)
+ _fs_s5fs=(
+ 'remount[remount file system]'
+ '(suid)nosuid[ignore suid and sgid bits]'
+ '(nosuid)suid[use suid and sgib bits]'
+ )
+ _fs_ufs=(
+ '(atime)noatime[don'"'"'t update access time]'
+ 'f[fake an /etc/mnttab entry]'
+ 'm[don'"'"'t make an /etc/mnttab entry]'
+ '(noforcedirectio)forcedirectio[do I/O synchronously]'
+ '(forcedirectio)noforcedirectio[do all I/O asynchronously]'
+ '(nointr)intr[allow operations to be interrupted]'
+ '(intr)nointr[prevent operations from being interrupted]'
+ '(nolargefiles)largefiles[don'"'"' restrict file size]'
+ '(largefiles)nolargefiles[restrict file size]'
+ '(nologging)logging[log transactions]'
+ '(logging)nologging[log transactions]'
+ 'onerror[action to recover from error]:action(panic lock umout)'
+ 'quota[turn on quotas]'
+ '(ro rw)rq[mount file system read-write with quotas]'
+ "$_fs_s5fs[@]"
+ )
+ _fs_tmpfs=(
+ 'size[set file system size]:size:'
+ )
+ _fs_pcfs=(
+ '(nofoldcase)foldcase[force filenames to lowercase]'
+ '(foldcase)nofoldcase[don'"'"'t force filenames to lowercase]'
+ )
+ _fs_hsfs=(
+ 'nrr[no rock ridge]'
+ 'notraildot[no trail dot when no extension]'
+ 'nomaplcase[don'"'"'t force lowercase]'
+ 'nosiud[ignore suid and sgid bits]'
+ )
+ _fs_nfs=(
+ '(fg)bg[retry in the background]'
+ '(bg)fg[retry in the foreground]'
+ '(nogrpid)grpid[new file gets group ID of directory]'
+ '(grpid)nogrpid[new file gets fsgid of current process]'
+ '(nointr)intr[allow operations to be interrupted]'
+ '(intr)nointr[prevent operations from being interrupted]'
+ '(sec secure)kerberos[use kerberos authentication]'
+ 'noac[no attribute caching]'
+ 'port[server IP port number]:port:'
+ 'posix[posix sematics]'
+ 'proto[specify protocol]:protocol:'\("$(grep -v '^#' /etc/netconfig 2> /dev/null | cut -d ' ' -f 1)"\)
+ 'public[force public file handle]'
+ '(noquota)quota[enable quotas]'
+ '(quota)noquota[disable quotas]'
+ 'timeo[specify initial timeout for UDP]:initial timeout for UDP:'
+ 'retrans[set number of NFS retransmissions]:number of NFS retransmissions:(5)'
+ 'retry[specify number of mount failure retries]:mount failure retries:(10000)'
+ 'rsize[specify read buffer size]:read buffer size:(8192)'
+ 'wsize[specify write buffer size]:write buffer size:(8192)'
+ '(kerberos secure)sec[set the security mode]:security mode:(sys dh krb4 none)'
+ '(kerberos sec)secure[use Diffie-Hellman public key system]'
+ 'vers[set NFS vesion number]:NFS version number:(2 3)'
+ "$_nfs_access[@]"
+ "$_fs_s5fs[@]"
+ )
+ _fs_cachefs=(
+ 'backfstype[type of the back file system]:back file system type:(nfs hsfs)'
+ 'backpath[specify back file system location]:back file system location:_files -/'
+ 'cacheid[specify a cache ID]:cache ID:'
+ 'local-access[check permissions locally]'
+ 'noconst[disable cache consistency checking]'
+ 'purge[purge any cached information]'
+ '(suid)nosuid[ignore setuid and setgid bits]'
+ '(nosuid)suid[use setuid and setgid bits]'
+ '(write-around)non-shared[purge cache on writes]'
+ '(non-shared)write-around[keep file in cache on writes]'
+ "$_nfs_access[@]"
+ )
+ ;;
+ osf*)
+ _fs_advfs=(
+ '(ro rw)rq[mount file system read-write]'
+ 'dual[allow mount even if same domain ID as already mounted domain]'
+ 'sync[do I/O synchronously]'
+ )
+ _fs_cdfs=(
+ '(nodefperm)defperm[ignore permission bits]'
+ '(defperm)defperm[use permission bits]'
+ 'noversion[strip off version extension]'
+ 'rrip[use RRIP extensions]'
+ )
+ _fs_nfs=(
+ "$_nfs_ufs[@]"
+ "$_fs_nfs[@]"
+ )
+ ;;
+ linux*)
+ _fs_any=(
+ '(sync)async[do all I/O asynchronously]'
+ '(noatime)atime[update access time]'
+ '(noauto)auto[can be mounted with -a]'
+ '(rw suid dev exec auto nouser async)defaults[use default options]'
+ '(nodev)dev[interpret devices]'
+ '(noexec)exec[permit execution of binaries]'
+ '(atime)noatime[don'"'"'t update access time]'
+ '(auto)noauto[can only be mounted explicitly]'
+ '(dev)nodev[don'"'"'t interpret devices]'
+ '(exec)noexec[don'"'"'t allow execution of binaries]'
+ '(suid)nosuid[ignore suid and sgid bits]'
+ '(user)nouser[can only be mounted by root]'
+ 'remount[mount already mounted file system]'
+ '(rw)ro[mount file system read-only]'
+ '(ro)rw[mount file system read-write]'
+ '(nosuid)suid[use suid and sgib bits]'
+ '(async)sync[do I/O synchronously]'
+ '(nouser noexec nosuid nodev)user[allow normal users to mount]'
+ )
+ _fs_affs=(
+ 'uid[set owner of root]:user ID:'
+ 'gid[set group of root]:group ID:'
+ 'setuid[set owner of all files]:user ID:'
+ 'setgid[set group of all files]:group ID:'
+ 'mode[set file permissions]:file permission bits:'
+ 'protect[don'"'"'t allow changes to permissions]'
+ 'usemp[set owner of root to owner of mount point]'
+ 'verbose[print message per mount]'
+ 'prefix[prefix before volume name (link)]:prefix string:'
+ 'volume[prefix before '"'"'/'"'"' (symlink)]:prefix string:'
+ 'reserved[set number of unused blocks at start of device]:number of unused blocks:'
+ 'root[specify location of the root block]:root block location:'
+ 'bs[specify block size]:block size:(512 1024 2048 4192)'
+ )
+ _fs_ext2=(
+ '(minixdf)bsddf[select bsddf behavior]'
+ '(bsddf)minixdf[select bsddf behavior]'
+ '(nocheck)check[set checking level]::checking level:((normal\:check\ inode\ and\ block\ bitmaps\ on\ mount strict\:check\ on block\ deallocation none\:no\ checking))'
+ 'errors[specify behavior on error]:error behavior:((continue\:ignore\ errors remount-ro\:remount\ file\ system\ read-only panic\:panic\ and\ halt\ system))'
+ '(nogrpid bsdgroups sysvgroups)grpid[new file gets group ID of directory]'
+ '(grpid nogrpid sysvgroups)bsdgroups[new file gets group ID of directory]'
+ '(grpid bsdgroups sysvgroups)nogrpid[new file gets fsgid of current process]'
+ '(grpid bsdgroups nogrpid)sysvgroups[new file gets fsgid of current process]'
+ 'resgid[specify access to reserved space (group ID)]:group ID:'
+ 'resuid[specify access to reserved space (user ID)]:user ID:'
+ 'sb[specify super block number]:super block number:'
+ )
+ _fs_fat=(
+ 'blocksize[specify block size]:block size:(512 1024)'
+ 'uid[specify user ID of all files]:user ID:'
+ 'gid[specify group ID of all files]:group ID:'
+ 'umask[specify umask]:umask value (octal):'
+ 'check[specify checking level]:checking level:((relaxed\:accept\ upper\ and\ lower\ case,\ truncate\ long\ name normal\:like\ '"'\`'"'relaxed'"\\'"',\ but\ reject\ special\ characters strict\:like\ '"'\`'"'normal'"\\'"',\ but\ no\ long\ parts))'
+ 'conf[specify CR/NL conversion]:CR/NL conversion mode:((binary\:no\ translation text\:conversion\ on\ all\ files auto\:perform\ translation\ on\ file\ without\ binary\ extension))'
+ 'debug[debug mode]'
+ 'fat[specify fat type]:fat type (bit):(12 16)'
+ 'quiet[quiet mode]'
+ )
+ _fs_msdos=( "$_fs_fat[@]" )
+ _fs_umsdos=( "$_fs_fat[@]" )
+ _fs_vfat=( "$_fs_fat[@]"
+ 'uni_xlate[translate unicode to escaped sequences]'
+ 'posix[allow file names only differing in case]'
+ 'nonumtail[try short name before number extension]'
+ )
+ _fs_hpfs=(
+ 'uid[specify user ID of all files]:user ID:'
+ 'gid[specify group ID of all files]:group ID:'
+ 'umask[specify umask]:umask value (octal):'
+ 'case[specify file name conversion]:file name conversion:((lower\:convert\ to\ lower\ case asis\:no\ conversion))'
+ 'conv[specify CR elimination]:CR elimination:((binary\:no\ elimination test\:delete\ CRs\ \(e.g.\ before\ NL\) auto\:sometimes\ yes,\ sometimes\ not))'
+ 'nocheck[don'"'"'t abort mount on consistency check failure]'
+ )
+ _fs_iso9660=(
+ 'norock[disable Rock Ridge extensions]'
+ 'check[specify file name conversion]:file name conversion:((relaxed\:convert\ to\ lower\ case\ before\ lookup strict\:no\ conversion))'
+ 'uid[specify user ID of all files]:user ID:'
+ 'gid[specify group ID of all files]:group ID:'
+ 'map[specify non-Rock Ridge name conversion]:file name conversion:((normal\:map\ upper\ to\ lower,\ ignore\ \;1,\ map\ \;\ to\ . off\:no\ conversion))'
+ 'mode[specify permissions]:file access permissions:'
+ 'unhide[show hidden and associated files]'
+ 'block[specify block size]:block size:(512 1024 2048)'
+ 'cruft[ignore high bits of file length]'
+ )
+ _fs_smbfs=( "$_fs_nfs[@]" )
+ _fs_udf=(
+ 'uid[specify user ID of all files]:user ID:'
+ 'gid[specify group ID of all files]:group ID:'
+ 'umask[specify umask]:umask value (octal):'
+ 'unhide[show hidden and associated files]'
+ 'undelete[show deleted files]'
+ 'bs[set the block size]:block size:2048'
+ 'novrs[skip volume sequence recognition]'
+ 'session[set the CDROM session]:session:'
+ 'anchor[override standard anchor location]:anchor location:256'
+ 'lastblock[set the last block of the file system]:last block:'
+ )
+ _fs_ufs=(
+ 'ufstype[set ufs type]:ufs type:(old 44bsd sun sunx86 nextstep nextstep-cd openstep)'
+ 'onerror[set behaviour on error]:behaviour on error:(panic lock umount repair)'
+ )
+ ;;
+ esac
fi
-if [[ "$words[1]" = mount ]]; then
+if [[ "${words[1]:t}" = mount ]]; then
# Here are the tests and tables for the arguments and options for
# the `mount' program. The `fss' array has to be set to the names
# of the file system types understood on this system.
# This should also set the `deffs' parameter if the default file
# system type is not `iso9660' (it should be set to the name of
- # the default file system type).
+ # the default file system type), and set 'typeops' to the mount
+ # option for file system type selection when it is not '-t'.
case "$OSTYPE" in
+ aix*)
+ args=( -s
+ '-a[mount all filesystems in /etc/fstab]'
+ '-f[forced mount]'
+ '-n[remote node]:remote node:_hosts'
+ '-p[mount as removable file system]'
+ '-r[mount read-only]'
+ '-t[specify file system type]:file system type:->fstype'
+ '-o[specify file system options]:file system option:->fsopt'
+ '-v[filesystem defined by /etc/vfs]:VfsName'
+ ':dev or dir:->devordir'
+ ':mount point:_files -/'
+ )
+ fss=( jfs nfs cdrfs )
+ deffs=jfs
+ ;;
+ irix*)
+ args=( -s
+ '-a[mount all filesystems in /etc/fstab]'
+ '-b[mount all filesystems in /etc/fstab except those listed]:list of directories:_files -/ -S,'
+ '-c[check any dirty filesystems before mounting]'
+ '-f[fake a new /etc/mtab entry, but don'\''t mount any filesystems]'
+ '-h[mount all filesystems associated with host]:hostnames:_hosts'
+ '-n[mount filesystem without making entry in /etc/mtab]'
+ '-o[specify file system options]:file system option:->fsopt'
+ '-p[print list of mounted filesystems in format suitable for /etc/fstab]'
+ '-r[mount read-only]'
+ '-t[specify file system type]:file system type:->fstype'
+ '-v[verbose]'
+ '-M[use alternate mtab]:alternate mtab:_files'
+ '-P[with -p, prepend prefix to paths]:prefix'
+ )
+ fss=( efs proc fd nfs iso9660 dos hfs cachefs )
+ deffs=efs
+ ;;
linux*)
args=( -s
- '-h[show help]' \
- '-V[show version]' \
- '-v[verbose mode]' \
- '(-o)-a[mount all filesystems in fstab]' \
- '-F[fork off one child per device]' \
- '-f[fake mount]' \
- '-n[don'"'"'t write /etc/mtab]' \
- '-s[tolerate sloppy mount options]' \
- '-r[mount read-only]' \
- '-w[mount read/write]' \
- '-t[specify file system type]:file system type:->fstype' \
- '-o[specify file system options]:file system option:->fsopt' \
- ':dev or dir:->devordir' \
+ '-h[show help]'
+ '-V[show version]'
+ '-v[verbose mode]'
+ '(-o)-a[mount all filesystems in fstab]'
+ '-F[fork off one child per device]'
+ '-f[fake mount]'
+ '-n[don'"'"'t write /etc/mtab]'
+ '-s[tolerate sloppy mount options]'
+ '-r[mount read-only]'
+ '-w[mount read/write]'
+ '-t[specify file system type]:file system type:->fstype'
+ '-o[specify file system options]:file system option:->fsopt'
+ ':dev or dir:->devordir'
':mount point:_files -/'
)
fss=( minix ext ext2 xiafs hpfs msdos umsdos vfat proc nfs iso9660
- smbfs ncpfs affs ufs romfs sysv )
+ smbfs ncpfs affs ufs romfs sysv adfs autofs coda devpts efs
+ hfs ntfs qnx4 smbfs udf )
+ [[ -r /proc/filesystems ]] &&
+ fss=( ${$(</proc/filesystems)#nodev} )
;;
osf*)
args=( -s
- '(-o)-a[mount all filesystems in fstab]' \
- '-d[mount even if not unmounted]' \
- '-e[list all mount points]' \
- '-f[fake mount]' \
- '-l[display values of all file system options]' \
- '-t[specify file system type]:file system type:->fstype' \
- '-o[specify file system options]:file system option:->fsopt' \
- '-u[remount file system]' \
- ':dev or dir:->devordir' \
+ '(-o)-a[mount all filesystems in fstab]'
+ '-d[mount even if not unmounted]'
+ '-e[list all mount points]'
+ '-f[fake mount]'
+ '-l[display values of all file system options]'
+ '-t[specify file system type]:file system type:->fstype'
+ '-o[specify file system options]:file system option:->fsopt'
+ '-u[remount file system]'
+ '-r[mount read-only]'
+ '-w[mount read/write]'
+ '-v[verbose]'
+ ':dev or dir:->devordir'
':mount point:_files -/'
-
+ )
fss=( advfs ufs nfs mfs cdfs )
+ deffs=cdfs
+ ;;
+ solaris*)
+ args=( -s
+ '(-p -v)-a[mount all filesystems in fstab]'
+ '(-p -v)-F[specify file system type]:file system type:->fstype'
+ '(-a -v)-p[print mounted file systems]'
+ '(-p -a)-v[print mounted file systems verbosely]'
+ '(-p -v)-V[fake mount]'
+ '(-p -v)-m[don'"'"'t write /etc/mnttab]'
+ '(-p -v)-g[mount globally]'
+ '(-p -v)-o[specify file system options]:file system option:->fsopt'
+ '(-p -v)-O[overlay mount]'
+ '(-p -v)-r[mount read-only]'
+ ':dev or dir:->devordir'
+ ':mount point:_files -/'
+ )
+ fss=( ufs nfs hsfs s5fs pcfs cachefs tmpfs )
+ deffs=hsfs
+ typeops=-F
;;
*)
# Default for all other systems. Dunno.
args=( -s
- '(-o)-a[mount all filesystems in fstab]' \
- '-t[specify file system type]:file system type:->fstype' \
- '-o[specify file system options]:file system option:->fsopt' \
- '-f[fake mount]' \
- ':dev or dir:->devordir' \
+ '(-o)-a[mount all filesystems in fstab]'
+ '-t[specify file system type]:file system type:->fstype'
+ '-o[specify file system options]:file system option:->fsopt'
+ '-f[fake mount]'
+ ':dev or dir:->devordir'
':mount point:_files -/'
+ )
fss=( ufs )
+ deffs=ufs
+ ;;
esac
- _arguments "$args[@]" && ret=0
+ _arguments -C "$args[@]" && ret=0
else
# Completion for umount.
- _arguments -s \
- '-h[show help]' \
- '-V[show version]' \
- '-v[verbose mode]' \
- '-n[don'"'"'t write /etc/mtab]' \
- '-r[remount read-only on failure]' \
- '-a[unmount all file systems from /etc/mtab]' \
- '-t[specify file system type]:file system type:->fstype' \
- '*:dev or dir:->udevordir' && ret=0
+ case "$OSTYPE" in
+ aix*)
+ args=(
+ '-a[unmount all mounted file systems]'
+ '-f[force unmount]'
+ '-n[remote node]:remote node:_hosts'
+ '-t[specify file system type]:file system type:->fstype'
+ '*:dev or dir:->udevordir'
+ )
+ ;;
+ irix*)
+ args=(
+ '-a[unmount all mounted file systems]'
+ '-b[unmount all filesystems in /etc/fstab except those listed]:list of directories:_files -/ -S,'
+ '-h[unmount all filesystems associated with host]:hostnames:_hosts'
+ '-k[kill all processes with files open on filesystems before unmounting]'
+ '-t[unmount all filesystems of specified type]:file system type:->fstype'
+ '-v[verbose]'
+ )
+ ;;
+ *)
+ args=( \
+ '-h[show help]'
+ '-V[show version]'
+ '-v[verbose mode]'
+ '-n[don'"'"'t write /etc/mtab]'
+ '-r[remount read-only on failure]'
+ '-a[unmount all file systems from /etc/mtab]'
+ '-t[specify file system type]:file system type:->fstype'
+ '*:dev or dir:->udevordir'
+ )
+ ;;
+ esac
+
+ _arguments -C -s "$args[@]" && ret=0
+
fi
case "$state" in
fstype)
compset -P '*,'
- _description expl 'file system type'
- compadd "$expl[@]" -qS, -M 'L:no=' - "$fss[@]" && ret=0
+
+ _wanted types expl 'file system type' \
+ compadd "$expl[@]" -qS, -M 'L:|no=' - "$fss[@]" && ret=0
;;
fsopt)
- eval 'tmp=(' '"$_fs_'${(s:,:)^${options[-t]:-${deffs}}}'[@]"' ')'
+ _wanted options || return 1
+
+ eval 'tmp=(' '"$_fs_'${(s:,:)^${opt_args[$typeops]:-${deffs}}}'[@]"' ')'
tmp=( "$_fs_any[@]" "${(@)tmp:#}" )
_values -s , 'file system options' "$tmp[@]" && ret=0
;;
devordir)
- if (( $+options[-a] )); then
+ if (( $+opt_args[-a] )); then
_message "no device or directory with option \`-a'"
else
- _description expl device
- compadd "$expl[@]" /dev/* && ret=0
- if (( ! $+options[-t] )); then
- _description expl 'mount point'
- _files "$expl[@]" -/ && ret=0
- fi
+ _alternative \
+ 'devices:device:compadd /dev/\*' \
+ 'directories:mount point:_files -/' && ret=0
fi
;;
udevordir)
- if (( $+options[-a] )); then
+ if (( $+opt_args[-a] )); then
_message "no device or directory with option \`-a'"
else
+ local dev_tmp mp_tmp
+
tmp=( "${(@f)$(< /etc/mtab)}" )
- _description expl device
- compadd "$expl[@]" - "${(@)${(@)tmp%% *}:#none}" && ret=0
- if (( ! $+options[-t] )); then
- _description expl 'mount point'
- compadd "$expl[@]" - "${(@)${(@)tmp#* }%% *}"
- fi
+ dev_tmp=( "${(@)${(@)tmp%% *}:#none}" )
+ mp_tmp=( "${(@)${(@)tmp#* }%% *}" )
+
+ _alternative \
+ 'devices:device:compadd - $dev_tmp[@]' \
+ 'directories:mount point:compadd - $mp_tmp[@]' && ret=0
fi
;;
esac
diff --git a/Completion/User/_mysql_utils b/Completion/User/_mysql_utils
index 6d777112d..c696f774b 100644
--- a/Completion/User/_mysql_utils
+++ b/Completion/User/_mysql_utils
@@ -24,33 +24,33 @@ _mysql_hosts () {
local _mysql_user _mysql_port _mysql_host _mysql_params
_mysql_get_identity
- _wanted hosts expl 'server host' &&
+ _wanted hosts expl 'server host' \
_combination -s '[:@]' '' hosts-ports-users \
${_mysql_user:+users=${_mysql_user:q}} \
${_mysql_port:+ports=${_mysql_port:q}} \
- hosts "$expl[@]"
+ hosts -
}
_mysql_ports () {
local _mysql_user _mysql_port _mysql_host _mysql_params
_mysql_get_identity
- _wanted ports expl 'server port' &&
+ _wanted ports expl 'server port' \
_combination -s '[:@]' '' hosts-ports-users \
${_mysql_user:+users=${_mysql_user:q}} \
${_mysql_host:+hosts=${_mysql_host:q}} \
- ports "$expl[@]"
+ ports -
}
_mysql_users () {
local _mysql_user _mysql_port _mysql_host _mysql_params
_mysql_get_identity
- _wanted users expl 'server username' &&
+ _wanted users expl 'server username' \
_combination -s '[:@]' '' hosts-ports-users \
${_mysql_host:+hosts=${_mysql_host:q}} \
${_mysql_port:+ports=${_mysql_port:q}} \
- users "$expl[@]"
+ users -
}
_mysql_databases () {
@@ -205,15 +205,13 @@ _mysqladmin_commands () {
)
if (( CURRENT == 1 )); then
- _tags commands && compadd "$@" $cmds
+ _wanted commands expl command compadd "$@" - $cmds
else
local curcontext="$curcontext"
- case "$words[1]" in
- (create)
- ;&
- (drop)
- _wanted mysqldbs expl "MySQL databases" && _mysql_databases
+ case "${words[1]:t}" in
+ (create|drop)
+ _wanted mysqldbs expl "MySQL databases" _mysql_databases
;;
(kill)
_message 'thread ids'
@@ -226,7 +224,7 @@ _mysqladmin_commands () {
}
_mysql_utils () {
- case "$words[1]" in
+ case "${words[1]:t}" in
mysql)
_mysql "$@"
;;
diff --git a/Completion/User/_pbm b/Completion/User/_pbm
index 0a3f1144b..4b7163dcd 100644
--- a/Completion/User/_pbm
+++ b/Completion/User/_pbm
@@ -1,63 +1,90 @@
#compdef -P (p[bgpn]m*|*top[bgpn]m)
-local pat expl ret=1
+# Completion for all (or most, you'll never know) pbmplus commands.
+# For some of them there are special cases in the biggish `case' below.
+# Note that since this function is a post-pattern function, these
+# defaults can be overridden by simply defining completion functions
+# for those commands whose arguments you want to complete differently.
-if [[ "$words[1]" = pnm* ]]; then
+local pat expl ret=1 cmd="${words[1]:t}"
+
+if [[ "$cmd" = pnm* ]]; then
pat='*.(#i)p[bgp]m'
-elif [[ "$words[1]" = *top[bgpn]m ]]; then
- pat="*.(#i)${words[1]%%top[bgpn]m}"
+elif [[ "$cmd" = *top[bgpn]m ]]; then
+ pat="*.(#i)${cmd%%top[bgpn]m}"
else
- pat="*.(#i)${words[1][1,3]}"
+ pat="*.(#i)${cmd[1,3]}"
fi
if [[ $# -ne 0 || $+_in_pbm -ne 0 ]]; then
- if (( ! $# )); then
- _description expl 'picture file'
- set -- "$expl[@]"
- fi
- _path_files "$@" -g "$pat" || _files "$@" -g '*.(#i)p[bgp]m'
+ _wanted files expl 'picture file' _path_files "$@" -g "$pat" - ||
+ _files "$@" "$expl[@]" -g '*.(#i)p[bgp]m'
return
fi
local _in_pbm=yes
-
-case "$words[1]" in
-asciitopnm)
- _arguments '-d:divisor:' ':height:' ':width:' ':file: _pbm'
+
+case "$cmd" in
+asciitop[gn]m)
+ _arguments \
+ '-d[specify divisor]:divisor:' \
+ ':height:' ':width:' ':file: _pbm'
;;
fitstopgm)
- _arguments '-image:image number:' ':file: _pbm'
+ _arguments \
+ '-image[specify image number]:image number:' \
+ ':file: _pbm'
;;
fitstopnm)
- _arguments -{noraw,scanmax,printmax} '-image:image number:' \
- '-min:minimum value:' '-max:maximum value:' ':file: _pbm'
+ _arguments \
+ '-image[specify image number]:image number:' \
+ '-noraw[produce ASCII pnm file]' \
+ '(-min -max)-scanmax[force scanning data for minimum and maximum]' \
+ '-printmax[only print minimum and maximum values]' \
+ '(-scanmax)-min[override minimum value]:minimum value:' \
+ '(-scanmax)-max[override maximum value]:maximum value:' \
+ ':file: _pbm'
;;
g3topbm)
- _arguments -{kludge,reversebits,stretch} ':file: _pbm'
+ _arguments \
+ '-kludge[ignore first few lines]' \
+ '-reversebits[interpret bits least-significant first]' \
+ '-stretch[duplicate each row]' \
+ ':file: _pbm'
;;
giftopnm)
- _arguments -{verbose,comments} '-image:image number:' \
- ':file: _pbm'
+ _arguments \
+ '-verbose[verbose mode]' \
+ '-comments[only print comment fields]' \
+ '-image[specify image number]:image number:' \
+ ':file: _pbm'
;;
-
macptopbm)
_arguments '-extraskip:number of bytes to skip:' ':file: _pbm'
;;
pbmclean)
- _arguments '-connect' ':file: _pbm'
+ if [[ "$PREFIX" = -* ]]; then
+ _message 'maximum number of identical neighbours'
+ else
+ _pbm
+ fi
;;
pbmmake)
- _arguments -{white,black,gray} ':width:' ':height:'
+ _arguments \
+ '(-black -gray)-white[produce white pbm file]' \
+ '(-white -gray)-black[produce black pbm file]' \
+ '(-white -black)-gray[produce gray pbm file (stippled)]' \
+ ':width:' ':height:'
;;
pbmmask)
- _arguments '-expand' ':file: _pbm'
+ _arguments '-expand[expand mask by one pixel]' ':file: _pbm'
;;
pbmpscale)
@@ -65,16 +92,23 @@ pbmpscale)
;;
pbmreduce)
- _arguments -{floyd,fs,threshold} '-value:threshold value:' \
- ':reduction factor:' ':file: _pbm'
+ _arguments \
+ '(-fs -threshold)-floyd[use Floyd-Steinberg error diffusion]' \
+ '(-floyd -threshold)-fs[use Floyd-Steinberg error diffusion]' \
+ '(-floy -fs)-threshold[use simple thresholding]' \
+ '-value[specify thresholding value]:threshold value:' \
+ ':reduction factor:' ':file: _pbm'
;;
pbmtext)
- _arguments '-font:font file:_files -g \*.\(\#i\)pbm' '*:text:'
+ _arguments \
+ '(-builtin)-font[specify font file]:font file:_files -g \*.\(\#i\)pbm' \
+ '(-font)-builtin[select builtin font]:builtin font:(bdf fixed)' \
+ '*:text:'
;;
pbmto10x)
- _arguments '-h' ':file: _pbm'
+ _arguments '-h[use resolution 120 x 144]' ':file: _pbm'
;;
pbmtobg|pbmtobbnbg)
@@ -82,24 +116,37 @@ pbmtobg|pbmtobbnbg)
;;
pbmtoepsi)
- _arguments '-bbonly' ':file: _pbm'
+ _arguments '-bbonly[only create boundary box]' ':file: _pbm'
;;
pbmtolj)
- _arguments '-resolution:resolution:(75 100 150 300)' ':file: _pbm'
+ _arguments \
+ '-float[suppress positioning information]' \
+ '-norest[don'"'"'t write reset sequences]' \
+ '-resolution[specify output device resolution]:resolution:(75 100 150 300)' \
+ ':file: _pbm'
;;
pbmtoln03)
- _arguments -{l:left,r:right,t:top,b:bottom}' margin:' \
- '-f:form length:' ':file: _pbm'
+ _arguments \
+ '-l[specify left margin]:left margin:' \
+ '-r[specify right margin]:right margin:' \
+ '-t[specify top margin]:top margin:' \
+ '-b[specify bottom margin]:bottom margin:' \
+ '-f[specify form length]:form length:' ':file: _pbm'
;;
pbmtolps)
- _arguments '-dpi:resolution:' ':file: _pbm'
+ _arguments '-dpi[specify output resolution]:resolution:' ':file: _pbm'
;;
pbmtomacp)
- _arguments -{l:left,r:right,t:top,b:bottom}' offset:' ':file: _pbm'
+ _arguments \
+ '-l[specify left offset]:left offset:' \
+ '-r[specify right offset]:right offset:' \
+ '-t[specify top offset]:top offset:' \
+ '-b[specify bottom offset]:bottom offset:' \
+ ':file: _pbm'
;;
pbmtopgm)
@@ -109,13 +156,23 @@ pbmtopgm)
pbmtopk)
# This could be improved...
- _arguments '-s:design size:' '-C:coding scheme:' '-F:font family:' \
- '-f:option file:_files' '-c:character number:' \
- '-W:width:' '-H:height:' '-D:depth:' '-I:italic correction:' \
- '-h:horizontal escapement:' '-v:vertical escapement:' \
- '-x:x offset:' '-y:y offset:' \
- ':pk file:_files -g \*.\(\#i\)pk' ':tfm file:_files -g \*.\(\#i\)tfm' \
- '*:file: _pbm'
+ _arguments \
+ '-s[set design size]:design size:' \
+ '-C[set coding scheme]:coding scheme:' \
+ '-F[set font family comment]:font family:' \
+ '-f[specify file with options]:option file:_files' \
+ '*-c[specify next character number]:character number:' \
+ '*-W[specify TFM width of next character]:width:' \
+ '*-H[specify TFM height of next character]:height:' \
+ '*-D[specify TFM depth of next character]:depth:' \
+ '*-I[specify italic correction of next character]:italic correction:' \
+ '*-h[specify horizontal escapement of next character]:horizontal escapement:' \
+ '*-v[specify vertical escapement of next character]:vertical escapement:' \
+ '*-x[specify x offset of next character]:x offset:' \
+ '*-y[specify y offset of next character]:y offset:' \
+ ':pk file:_files -g \*.\(\#i\)pk' \
+ ':tfm file:_files -g \*.\(\#i\)tfm' \
+ '*:file: _pbm'
;;
pbmupc)
@@ -124,8 +181,13 @@ pbmupc)
;;
pgmcrater)
- _arguments '-number:number of craters:' '-gamma:factor:' \
- -{height,ysize}:height: -{width,xsize}:width:
+ _arguments \
+ '-number[specify number of craters]:number of craters:' \
+ '-gamma[specify gamma correction factor]:gamma factor:' \
+ '(-ysize)-height[specify picture height]:height:' \
+ '(-height)-ysize[specify picture height]:height:' \
+ '(-xsize)-width[specify picture width]:width:' \
+ '(-width)-xsize[specify picture width]:width:'
;;
pgmkernel)
@@ -137,26 +199,48 @@ pgmnoise)
;;
pgmnorm|ppmnorm)
- _arguments '-bpercent:black percentage:' '-bvalue:black pixel value:' \
- '-wpercent:white percentage:' '-wvalue:white pixel value:' \
- ':file: _pbm'
+ _arguments \
+ '(-bvalue)-bpercent[specify percentage to map to black]:black percentage:' \
+ '(-bpercent)-bvalue[specify pixel value to map to black]:black pixel value:' \
+ '(-wvalue)-wpercent[specify percentage to map to white]:white percentage:' \
+ '(-wpercent)-wvalue[specify pixel value to map to white]:white pixel value:' \
+ ':file: _pbm'
;;
pgmoil)
- _arguments '-n:smear size:' ':file: _pbm'
+ _arguments '-n[specify smear size]:smear size:' ':file: _pbm'
;;
pgmramp)
- _arguments -{lr,tb,rectangle,ellipse} ':width:' ':height:'
+ _arguments \
+ '(-tb -rectangle -ellipse)-lr[produce left to right ramp]' \
+ '(-lr -rectangle -ellipse)-tb[produce top to bottom ramp]' \
+ '(-lr -tb -ellipse)-rectangle[produce rectangular ramp]' \
+ '(-lr -tb -rectangle)-ellipse[produce elliptical ramp]' \
+ ':width:' ':height:'
;;
pgmtexture)
- _arguments '-d:distance:' ':file: _pbm'
+ _arguments '-d[specify distance]:distance:' ':file: _pbm'
;;
pgmtopbm)
- _arguments -{floyd,fs,threshold,dither8,d8,cluster3,c3,cluster4,c4,cluster8,c8} \
- '-value:threshold value:' ':file: _pbm'
+ _arguments \
+ '(-fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -clump)-floyd[use FLoyd-Steinberg error diffusion]' \
+ '(-floyd -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -clump)-fs[use FLoyd-Steinberg error diffusion]' \
+ '(-floyd -fs -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -clump)-threshold[use simple thresholding]' \
+ '(-floyd -fs -threshold -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -value)-hilbert[use space filling curve halftoning (hilbert curve)]' \
+ '(-floyd -fs -threshold -hilbert -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -value -clump)-dither8[use Bayer'"'"'s ordered dither (16 x 16 matrix)]' \
+ '(-floyd -fs -threshold -hilbert -dither8 -cluster3 -c3 -cluster4 -c4 -cluster8 -c8 -value -clump)-d8[use Bayer'"'"'s ordered dither (16 x 16 matrix)]' \
+ '(-floyd -fs -threshold -hilbert -dither8 -d8 -c3 -cluster4 -c4 -cluster8 -c8 -value -clump)-cluster3[use 45 degree clustered dither]' \
+ '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -cluster4 -c4 -cluster8 -c8 -value -clump)-c3[use 45 degree clustered dither]' \
+ '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -c4 -cluster8 -c8 -value -clump)-cluster4[use 45 degree clustered dither]' \
+ '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -cluster8 -c8 -value -clump)-c4[use 45 degree clustered dither]' \
+ '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -c8 -value -clump)-cluster8[use 45 degree clustered dither]' \
+ '(-floyd -fs -threshold -hilbert -dither8 -d8 -cluster3 -c3 -cluster4 -c4 -cluster8 -value -clump)-c8[use 45 degree clustered dither]' \
+ '-value[specify thresholding value]:threshold value:' \
+ '-clump[specify number of pixels per clump]:number of pixel:' \
+':file: _pbm'
;;
pgmtoppm)
@@ -167,12 +251,11 @@ pgmtoppm)
fi
_x_color && ret=0
- _description expl option
- compadd "$expl[@]" - -map && ret=0
+ _wanted options expl option compadd - -map && ret=0
return ret
elif [[ CURRENT -eq 3 && "$words[2]" = -map ]]; then
- _description expl 'map file'
+ _description files expl 'map file'
_files "$expl[@]" -g '*.(#i)ppm'
else
_pbm
@@ -180,30 +263,54 @@ pgmtoppm)
;;
pktopbm)
- _arguments ':pk file:_files -g \*.\(\#i\)pk' '-c:character number:' \
- '*:file: _pbm'
+ _arguments \
+ '*-x[set width of next bitmap]:width:' \
+ '*-y[set height of next bitmap]:height:' \
+ '*-c[set next character number]:character number:' \
+ ':pk file:_files -g \*.\(\#i\)pk' \
+ '*:file: _pbm'
;;
pnmalias)
- _arguments '-bgcolor:background color:_x_color' \
- '-fgcolor:foreground color:_x_color' \
- -{f,b}only -{f,b}alias \
- '-weight:central aliasing weight:' ':file: _pbm'
+ _arguments \
+ '-bgcolor[specify background color]:background color:_x_color' \
+ '-fgcolor[specify background color]:foreground color:_x_color' \
+ '(-bonly)-fonly[apply antialias only to foreground pixels]' \
+ '(-fonly)-bonly[apply antialias only to background pixels]' \
+ '(-balias)-falias[apply antialias to all pixels around foreground pixels]' \
+ '(-falias)-balias[apply antialias to all pixels around foreground pixels]' \
+ '-weight[set central aliasing weight]:central aliasing weight:' \
+ ':file: _pbm'
;;
pnmarith)
- _arguments -{add,subtract,multiply} '*:file: _pbm'
+ _arguments \
+ -{add,subtract,multiply,difference,minimum,maximum} \
+ '*:file: _pbm'
;;
pnmcat)
- _arguments -{white,black,leftright,lr,topbottom,tb,jtop,jbottom,jleft,jright} \
- '*:file: _pbm'
+ _arguments \
+ '(-black)-white[]' \
+ '(-white)-black[]' \
+ '(-lr -topbottom -tb -jleft -jright)-leftright[place pictures left to right]' \
+ '(-leftright -topbottom -tb -jleft -jright)-lr[place pictures left to right]' \
+ '(-tb -leftright -lr -jtop -jbottom)-topbottom[place pictures top to bottom]' \
+ '(-topbottom -leftright -lr -jtop -jbottom)-tb[place pictures top to bottom]' \
+ '(-topbottom -tb -jbottom -jleft -jright)-jtop[align pictures at top]' \
+ '(-topbottom -tb -jtop -jleft -jright)-jbottom[align pictures at bottom]' \
+ '(-leftright -lr -jright -jtop -jbottom)-jleft[align pictures at left side]' \
+ '(-leftright -lr -jleft -jtop -jbottom)-jright[align pictures at right side]' \
+ '*:file: _pbm'
;;
pnmcomp)
- _arguments '-invert' '-xoff:x offset:' '-yoff:y offset:' \
- '-alpha:alpha mask file:_files -g \*.\(\#i\)pgm' \
- ':overlay file:_pbm' '*:file: _pbm'
+ _arguments \
+ '-invert[invert overlay pixel values]' \
+ '-xoff[specify overlay x offset]:x offset:' \
+ '-yoff[specify overlay y offset]:y offset:' \
+ '-alpha[specify alpha mask file]:alpha mask file:_files -g \*.\(\#i\)pgm' \
+ ':overlay file:_pbm' '*:file: _pbm'
;;
pnmconvol)
@@ -211,7 +318,11 @@ pnmconvol)
;;
pnmcrop)
- _arguments -{white,black} ':file: _pbm'
+ _arguments \
+ '(-black)-white' \
+ '(-white)-black' \
+ -{left,right,top,bottom} \
+ ':file: _pbm'
;;
pnmcut)
@@ -227,7 +338,7 @@ pnmenlarge)
;;
pnmflip)
- _arguments -{leftright,lr,topbottom,tb,transpose,xy,rotate90,r90,ccw,rotate270,r270,cw} \
+ _arguments \*-{leftright,lr,topbottom,tb,transpose,xy,rotate90,r90,ccw,rotate270,r270,cw} \
':file: _pbm'
;;
@@ -246,18 +357,34 @@ pnmgamma)
return ret
;;
+pnmhisteq)
+ _arguments \
+ '-verbose[verbose mode]' \
+ '-gray[modify only gray pixels]' \
+ '-rmap[specify input luminosity map file]:luminosity map file:_files -g \*.\(\#i\)pgm' \
+ '-wmap[specify output luminosity map file]:luminosity map file:_files -g \*.\(\#i\)pgm' \
+ ':file: _pbm'
+ ;;
pnmhistmap)
_arguments -{black,white,verbose} '-max:maximum value:' ':file: _pbm'
;;
pnmindex)
- _arguments '-size:image size:' '-across:images per row:' \
- '-colors:number of colors:' '-black' '*:file: _pbm'
+ _arguments \
+ '-size[set size of index pictures]:image size:' \
+ '-across[specify number of pictures per ros]:images per row:' \
+ '-colors[specify maximum number of colors]:number of colors:' \
+ '-black[use black padding]' \
+ '*:file: _pbm'
;;
pnmmargin)
- _arguments -{white,black} '-color:color: _x_color' \
- ':border width:' ':file: _pbm'
+ _arguments \
+ '(-black -colors)-white' \
+ '(-white -colors)-black' \
+ '(-white -black)-color:color: _x_color' \
+ ':border width:' \
+ ':file: _pbm'
;;
pnmnlfilt)
@@ -265,14 +392,25 @@ pnmnlfilt)
;;
pnmpad)
- _arguments -{black,white} \
- -{l-:left,r-:right,t-:top,b-:bottom}' border width:' \
- ':file: _pbm'
+ _arguments \
+ '(-white)-black[add black border]' \
+ '(-black)-white[add white border]' \
+ '-l-[specify left border width]:left border width:' \
+ '-r-[specify right border width]:right border width:' \
+ '-t-[specify top border width]:top border width:' \
+ '-b-[specify bottom border width]:bottom border width:' \
+ ':file: _pbm'
;;
pnmpaste)
- _arguments -{replace,or,and,xor} ':"from" picture file:_pbm' \
- :{x,y}' position:' ':"into" picture file:_pbm'
+ _arguments \
+ '(-or -and -xor)-replace' \
+ '(-replace -and -xor)-or' \
+ '(-replace -or -xor)-and' \
+ '(-replace -or -and)-xor' \
+ ':"from" picture file:_pbm' \
+ :{x,y}' position:' \
+ ':"into" picture file:_pbm'
;;
pnmrotate)
@@ -288,11 +426,17 @@ pnmscale)
scale=( ':scale factor:' )
fi
- _arguments -{xsize,width}:width: -{ysize,height}:height: \
- '-xscale:horizontal scale factor:' \
- '-yscale:vertical scale factor:' \
- '-xysize:width::height:' "$scale[@]" \
- ':file: _pbm'
+ _arguments \
+ '(-width)-xsize:width:' \
+ '(-xsize)-width:width:' \
+ '(-height)-ysize:height:' \
+ '(-ysize)-height:height:' \
+ '-xscale:horizontal scale factor:' \
+ '-yscale:vertical scale factor:' \
+ '(-width -xsize -height -ysize -xscale -yscale -pixels)-xysize:width::height:' \
+ '(-width -xsize -height -ysize -xscale -yscale -xysize)-pixels:total number of pixels:' \
+ "$scale[@]" \
+ ':file: _pbm'
;;
pnmshear)
@@ -313,23 +457,39 @@ pnmtofits)
;;
pnmtops)
- _arguments -{turn,noturn,rle,runlength} '-scale:scale factor:' \
- '-dpi:output resolution:' \
- '-width:page width:' '-height:page height' ':file: _pbm'
+ _arguments \
+ '(-noturn)-turn' '(-turn)-noturn' \
+ '(-nocenter)-center '(-center)-nocenter \
+ '(-rle)-runlength' '(-runlength)-rle' \
+ '-scale:scale factor:' \
+ '-dpi:output resolution:' \
+ '-width:page width:' '-height:page height' ':file: _pbm'
;;
pnmtorast)
- _arguments -{standard,rle} ':file: _pbm'
+ _arguments '(-rle)-standard' '(-standard)-rle' ':file: _pbm'
;;
pnmtosgi)
- _arguments -{verbatim,rle} '-imagename:image name:' ':file: _pbm'
+ _arguments \
+ '(-rle)-verbatim' '(-verbatim)-rle' \
+ '-imagename:image name:' \
+ ':file: _pbm'
;;
pnmtotiff)
- _arguments -{none,packbits,lzw,g3,g4,2d,fill,msb2lsb,lsb2msb} \
- '-predictor:LZW predictor:((1\:without\ differencing 2\:with\ differencing))' \
- '-rowsperstrip:number of rows per strip:' ':file: _pbm'
+ _arguments \
+ '(-packbits -lzw -g3 -g4 -2d -fill -predictor)-none' \
+ '(-none -lzw -g3 -g4 -2d -fill -predictor)-packbits' \
+ '(-none -packbits -g3 -g4 -2d -fill -predictor)-lzw' \
+ '(-none -packbits -lzw -g4 -predictor)-g3' \
+ '(-none -packbits -lzw -g3 -2d -fill -predictor)-g4' \
+ '-2d' \
+ '-fill' \
+ '(-lsb2msb)-msb2lsb' \
+ '(-msb2lsb)-lsb2msb' \
+ '-predictor:LZW predictor:((1\:without\ differencing 2\:with\ differencing))' \
+ '-rowsperstrip:number of rows per strip:' ':file: _pbm'
;;
pnmtoxwd)
@@ -342,16 +502,20 @@ ppm3d)
;;
ppmbrighten)
- _arguments '-n' '-s:saturation:' '-v:value:' ':file: _pbm'
+ _arguments \
+ '-n[normalize value]' \
+ '-s[specify saturation difference]:saturation difference:' \
+ '-v[specify value difference]:value difference:' \
+ ':file: _pbm'
;;
ppmchange)
_pbm && ret=0
if (( CURRENT & 1 )); then
- _description expl 'new color'
+ _description colors expl 'new color'
else
- _description expl 'old color'
+ _description colors expl 'old color'
fi
_x_color "$expl[@]" && ret=0
@@ -364,7 +528,10 @@ ppmdim)
;;
ppmdist)
- _arguments -{intensity,frequency} ':file: _pbm'
+ _arguments \
+ '(-frequency)-intensity[sort colors by grayscale intensity]' \
+ '(-intensity)-frequency[sort colors by frequency]' \
+ ':file: _pbm'
;;
ppmdither)
@@ -382,14 +549,15 @@ ppmflash)
ppmforge)
_arguments -{clouds,night} \
'-dimension:fractal dimension:' '-hour:hour angle:' \
- '-inclination:inclination angle:' \
- '-tilt:inclination angle:' \
+ '(-tilt)-inclination:inclination angle:' \
+ '(-inclination)-tilt:inclination angle:' \
'-mesh:FFT mesh size:' '-power:elevations power factor:' \
'-glaciers:glacier elevation:' '-ice:polar ice cap extent:' \
'-saturation:star color saturation:' \
'-seed:randum number seed:' \
'-stars:minimum star pixel percentage:' \
- -{width,xsize}:width: -{height,ysize}:height:
+ '(-xsize)-width:width:' '(-width)-xsize:width:' \
+ '(-ysize)-height:height:' '(-height)-ysize:height:'
;;
ppmmake)
@@ -405,7 +573,7 @@ ppmntsc)
;;
ppmpat)
- _arguments -{gingham{2,3},g{2,3},madras,tartan,poles,squig,camo,anticamo} \
+ _arguments '(gingham2 -gingham3 -g2 -g3 -madras -tartan -poles -squig -camo -anticamo)'-{gingham{2,3},g{2,3},madras,tartan,poles,squig,camo,anticamo} \
':width:' ':height:'
;;
@@ -419,17 +587,16 @@ ppmquant)
fi
if [[ CURRENT -eq 2 ]]; then
- _description expl option
if [[ -n "$opt" ]]; then
- compadd "$expl[@]" - -map -fs -floyd && ret=0
+ _wanted options expl option compadd - -map -fs -floyd && ret=0
else
- compadd "$expl[@]" - -map && ret=0
+ _wanted options expl option compadd - -map && ret=0
fi
_message 'number of colors'
return ret
elif [[ CURRENT -eq 3 && "$words[2]" = -map ]]; then
- _description expl 'map file'
+ _description files expl 'map file'
_files "$expl[@]" -g '*.(#i)ppm'
else
_pbm
@@ -449,12 +616,18 @@ ppmspread)
;;
ppmtoacad)
- _arguments -{dxb,poly,white,8} '-background:background color:_x_color' \
- '-aspect:pixel aspect ratio:' ':file: _pbm'
+ _arguments \
+ '(-poly)-dxb[write AutoCAD binary database import file]' \
+ '(-dxb)-poly[render pixels as filled polygons]' \
+ '-8[restrict colors to the 8 RGB shades]' \
+ '(-background)-white[use white background]' \
+ '(-white)-background:background color (0-255):' \
+ '-aspect:pixel aspect ratio:' \
+ ':file: _pbm'
;;
ppmtobmp)
- _arguments -{os2,windows} ':file: _pbm'
+ _arguments '(-windows)-os2' '(-os2)-windows' ':file: _pbm'
;;
ppmtogif)
@@ -490,12 +663,17 @@ ppmtopj)
;;
ppmtopjxl)
- _arguments -{nopack,presentation,dark,diffuse,cluster,dither} \
- '-gamma:gamma value:' \
- '-xshift:x shift:' '-yshift:y shift:' \
- -{xscale:x,yscale:y}' scale factor:' \
- -{xsize,width}:width: -{ysize,height}:height: \
- ':file: _pbm'
+ _arguments \
+ -{nopack,presentation,dark,diffuse,cluster,dither} \
+ '-gamma:gamma value:' \
+ '-xshift:x shift:' '-yshift:y shift:' \
+ '(-width -xscale)-xscale:width:' \
+ '(-xsize -xscale)-width:width:' \
+ '(-xsize -width)-xscale:horizontal scale factor:' \
+ '(-height -yscale)-ysize:height:' \
+ '(-ysize -yscale)-height:height:' \
+ '(-ysize -height)-yscale:vertical scale factor:' \
+ ':file: _pbm'
;;
ppmtosixel)
@@ -518,15 +696,20 @@ psidtopgm)
_arguments ':width:' ':height:' ':bits per sample:' \
':postscript file:_files -g \*.\(\#i\)\(ps\|eps\)'
;;
-
pstopnm)
- _arguments -{forceplain,help,landscape,portrait,nocrop,pbm,pgm,ppm,verbose} \
- '-llx:loxer left x position:' '-lly:lower left y position:' \
- '-urx:upper right x position:' '-ury:upper right y position:' \
- '-xborder:x border fraction:' '-yborder:y border fraction:' \
- '-xmax:maximum width:' '-ymax:maximum height' \
- '-xsize:width:' '-ysize:height:' \
- ':postscript file:_files -g \*.\(\#i\)\(ps\|eps\)'
+ _arguments \
+ '(-portrait)-landscape' \
+ '(-landscape)-portrait' \
+ '(-pgm -ppm)-pbm' \
+ '(-pbm -ppm)-pgm' \
+ '(-pbm -pgm)-ppm' \
+ -{forceplain,help,nocrop,verbose} \
+ '-llx:loxer left x position:' '-lly:lower left y position:' \
+ '-urx:upper right x position:' '-ury:upper right y position:' \
+ '-xborder:x border fraction:' '-yborder:y border fraction:' \
+ '-xmax:maximum width:' '-ymax:maximum height' \
+ '-xsize:width:' '-ysize:height:' \
+ ':postscript file:_files -g \*.\(\#i\)\(ps\|eps\)'
;;
rawtopgm)
@@ -536,10 +719,13 @@ rawtopgm)
;;
rawtoppm)
- _arguments '-headerskip:header bytes to skip:' \
- '-rowskip:row padding to skip:' \
- -{rgb,rbg,grb,gbr,brg,bgr,interpixel,interrow} \
- ':width:' ':height:' ':grayscale bytes:'
+ _arguments \
+ '-headerskip:header bytes to skip:' \
+ '-rowskip:row padding to skip:' \
+ '(-rgb -rbg -grb -gbr -brg -bgr)'-{rgb,rbg,grb,gbr,brg,bgr} \
+ '(-interrow)-interpixel' \
+ '(-interpixel)-interrow' \
+ ':width:' ':height:' ':grayscale bytes:'
;;
rgb3toppm)
@@ -552,7 +738,7 @@ rgb3toppm)
fi
if [[ -n "$expl" ]]; then
- _description expl "$expl"
+ _description files expl "$expl"
_files "$expl" -g '*.(#i)pgm'
fi
;;
@@ -563,9 +749,11 @@ sgitopnm)
sldtoppm)
_arguments -{adjust,dir,info,verbose} \
- -{width,xsize}:width: -{height,ysize}:height: \
+ '(-width -xsize)'-{width,xsize}:width: \
+ '(-height -ysize)'-{height,ysize}:height: \
'-scale:scale factor:' \
- '-lib:slide name:' '-Lib:slide name:' ':file: _pbm'
+ '(-lib -Lib)'-{l,L}'ib:slide name:' \
+ ':file: _pbm'
;;
yuvsplittoppm)
@@ -577,10 +765,10 @@ yuvtoppm)
;;
zeisstopnm)
- _arguments -p{g,p}m ':file: _pbm'
+ _arguments '(-pgm -ppm)'-p{g,p}m ':file: _pbm'
;;
-*)
- _description expl 'picture file'
- _path_files "$expl[@]" -g "$pat" || _files "$expl[@]" -g '*.(#i)p[bgp]m'
+*)
+ _wanted files expl 'picture file' _path_files -g "$pat" ||
+ _files "$expl[@]" -g '*.(#i)p[bgp]m'
esac
diff --git a/Completion/User/_psutils b/Completion/User/_psutils
index 7869803b9..58cfff112 100644
--- a/Completion/User/_psutils
+++ b/Completion/User/_psutils
@@ -1,6 +1,6 @@
#compdef epsffit extractres fixdlsrps fixfmps fixmacps fixpsditps fixpspps fixscribeps fixtpps fixwfwps fixwpps fixwwps includeres psbook psmerge psnup psresize psselect pstops getafm showchar
-case "$words[1]" in
+case "${words[1]:t}" in
epsffit)
_arguments \
'-v[print version]' \
diff --git a/Completion/User/_rcs b/Completion/User/_rcs
index 537db6278..1792179d7 100644
--- a/Completion/User/_rcs
+++ b/Completion/User/_rcs
@@ -1,9 +1,12 @@
-#defcomp co ci rcs
+#compdef co ci rcs
-[[ $COMMAND = ci || $COMMAND = rcs ]] && _files
+local nm=$compstate[nmatches] cmd="${words[1]:t}"
+
+[[ $cmd = ci || $cmd = rcs ]] && _files
+
+if [[ $compstate[nmatches] -eq nm && -d RCS && $cmd != ci ]]; then
+ local rep expl
-if [[ $NMATCHES -eq 0 && -d RCS && $COMMAND != ci ]]; then
- local rep
rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//))
- (( $#rep )) && compadd -m $rep
+ (( $#rep )) && _wanted files expl 'RCS file' compadd - $rep
fi
diff --git a/Completion/User/_rlogin b/Completion/User/_rlogin
index e36554f23..bf8ff751d 100644
--- a/Completion/User/_rlogin
+++ b/Completion/User/_rlogin
@@ -1,9 +1,74 @@
-#defcomp rlogin rsh ssh
-
-if [[ -position 1 ]]; then
- complist -k hosts
-elif [[ -position 2 ]]; then
- complist -k '(-l)'
-else
- complist -u
-fi
+#compdef rlogin rsh remsh rcp
+
+_rlogin () {
+ case "${words[1]:t}" in
+ rlogin)
+ _arguments -s \
+ '-8[allow 8-Bit data]' \
+ '-e-[specify escape character]:escape character:' \
+ '-l[specify login user name]:login as:_rlogin_users' \
+ ':remote host name:_rlogin_hosts'
+ ;;
+ rsh|remsh)
+ local context state line ret=1
+ typeset -A opt_args
+
+ _arguments -s \
+ '-n[ignore stdin]' \
+ '-l[specify login user name]:login as:_rlogin_users' \
+ ':remote host name:_rlogin_hosts' \
+ ':command: _command_names -e' \
+ '*::command:->command' && ret=0
+
+ if [[ -n "$state" ]]; then
+ shift 1 words
+ (( CURRENT-- ))
+ _normal && ret=0
+ fi
+ return ret
+ ;;
+ rcp)
+ local curcontext="$curcontext" state line ret=1
+ typeset -A opt_args
+
+ _arguments -C -s \
+ '-p[preserve modification times]' \
+ '-r[recursively copy directories]' \
+ '*:files:->files' && ret=0
+
+ if [[ -n "$state" ]]; then
+ if compset -P '*:'; then
+ _files && ret=0
+ elif compset -P '*@'; then
+ _wanted hosts && _rlogin_hosts -S: -q && ret=0
+ else
+ _alternative \
+ 'files:: _files' \
+ 'hosts:: _rlogin_all_hosts -qS:' \
+ 'users:: _rlogin_users -qS@' && ret=0
+ fi
+ fi
+ return ret
+ ;;
+ esac
+}
+
+_rlogin_users () {
+ _wanted users && _combination -s '[:@]' my-accounts users-hosts users "$@"
+}
+
+_rlogin_hosts () {
+ _wanted hosts &&
+ if [[ "$IPREFIX" == *@ ]]; then
+ _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@"
+ else
+ _combination -s '[:@]' my-accounts users-hosts \
+ ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@"
+ fi
+}
+
+_rlogin_all_hosts () {
+ _tags hosts && _combination -s '[:@]' my-accounts users-hosts hosts "$@"
+}
+
+_rlogin "$@"
diff --git a/Completion/User/_ssh b/Completion/User/_ssh
index 1c0d61beb..04ee5f2e2 100644
--- a/Completion/User/_ssh
+++ b/Completion/User/_ssh
@@ -1,152 +1,232 @@
-#compdef ssh ssh-add ssh-agent ssh-keygen
+#compdef ssh slogin scp ssh-add ssh-agent ssh-keygen
-local state lstate line ret=1 expl
-typeset -A options
+_remote_files () {
+ # This is extremely simple-minded; could parse "ls -F" output to do
+ # colorings and LIST_TYPES and so on, but I'm just not that ambitious.
+ compadd $(ssh ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*)
+}
-case "$words[1]" in
-ssh)
- _arguments -s \
- '-a[disable forwarding of authentication agent connection]' \
- '-c[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' \
- '-e[set escape character]:escape character (or `none'"'"'):' \
- '(-n)-f[go to background]' \
- '-i[select identity file]:SSH identity file:_files' \
- '-k[disable forwarding of kerberos tickets]' \
- '-l[specify login name]:login name:_users' \
- '-n[redirect stdin from /dev/null]' \
- '*-o[specify extra options]:option string:->option' \
- '-p[specify port on remote host]:port number on remote host:' \
- '-q[quiet operation]' \
- '-P[use non priviledged port]' \
- '-t[force pseudo-tty allocation]' \
- '-v[verbose mode]' \
- '-V[show version number]' \
- '-x[disable X11 forwarding]' \
- '-C[compress all data]' \
- '-L[specify local port forwarding]:local port forwarding:->forward' \
- '-R[specify remote port forwarding]:remote port forwarding:->forward' \
- ':remote host name:_hosts' \
- ':command: _command_names -e' \
- '*::args:->command' && ret=0
+_ssh () {
+ local curcontext="$curcontext" state lstate line ret=1 expl args tmp
+ typeset -A opt_args
- while [[ -n "$state" ]]; do
- lstate="$state"
- state=''
+ args=()
- case "$lstate" in
- option)
- if compset -P '* '; then
- case "$IPREFIX" in
- *(#i)(batchmode|compression|fallbacktorsh|forward(agent|x11)|keepalive|passwordauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authetication|tgtparsing)|usepriviledgedport)*)
- compadd yes no && ret=0
- ;;
- *(#i)cipher*)
- _description expl 'encryption cipher'
- compadd "$expl[@]" idea des 3des blowfish arcfour tss none && ret=0
- ;;
- *(#i)globalknownhostsfile*)
- _description expl 'global file with known hosts'
- _files "$expl[@]" && ret=0
- ;;
- *(#i)hostname*)
- _description expl 'real host name to log into'
- _hosts "$expl[@]" && ret=0
- ;;
- *(#i)identityfile*)
- _description expl 'SSH identity file'
- _files "$expl[@]" && ret=0
- ;;
- *(#i)(local|remote)forward*)
- state=forward
- ;;
- *(#i)proxycommand*)
- compset -q
- shift 1 words
- (( CURRENT-- ))
- _normal && ret=0
- ;;
- *(#i)stricthostkeychecking*)
- compadd yes no ask
- ;;
- *(#i)userknownhostsfile*)
- _description expl 'user file with known hosts'
- _files "$expl[@]" && ret=0
- ;;
- *(#i)user*)
- _description expl 'user to log in as'
- _users "$expl[@]" && ret=0
- ;;
- *(#i)xauthlocation*)
- _description expl 'xauth program'
- _files "$expl[@]" -g '*(*)' && ret=0
- ;;
- esac
- else
- _description expl 'configure file option'
- compadd "$expl[@]" -M 'm:{a-z}={A-Z}' -S ' ' - \
- BatchMode ClearAllForwardings Cipher Compression CompressionLevel \
- Host ConnectionAttempts EscapeChar FallBackToRsh ForwardAgent \
- ForwardX11 GlobalKnownHostsFile HostName IdentityFile KeepAlive \
- KerberosAuthentication KerberosTgtPassing LocalForward \
- NumberOfPasswordPrompts PasswordAuthentication Port ProxyCommand \
- RemoteForward RhostsAuthentication RhostsRSAAuthentication \
- RSAAuthentication StrictHostKeyChecking TISAuthentication \
- UsePriviledgedPort User UserKnownHostsFile UseRsh \
- XAuthLocation && ret=0
- fi
- ;;
- forward)
- if compset -P 1 '*:'; then
- if compset -P '*:'; then
- _message 'port number'
+ # ssh-opt is a pseudo-command used to complete ssh options for `scp -o'.
+
+ case "${words[1]:t}" in
+ ssh|slogin)
+ args=(
+ ':remote host name:->userhost'
+ ':command: _command_names -e'
+ '*::args:->command'
+ )
+ ;&
+ ssh-opt)
+ _arguments -C -s \
+ '-a[disable forwarding of authentication agent connection]' \
+ '-c[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' \
+ '-e[set escape character]:escape character (or `none'"'"'):' \
+ '(-n)-f[go to background]' \
+ '-i[select identity file]:SSH identity file:_files' \
+ '-k[disable forwarding of kerberos tickets]' \
+ '-l[specify login name]:login name:_ssh_users' \
+ '-n[redirect stdin from /dev/null]' \
+ '*-o[specify extra options]:option string:->option' \
+ '-p[specify port on remote host]:port number on remote host:' \
+ '-q[quiet operation]' \
+ '-P[use non priviledged port]' \
+ '-t[force pseudo-tty allocation]' \
+ '-v[verbose mode]' \
+ '-V[show version number]' \
+ '-x[disable X11 forwarding]' \
+ '-C[compress all data]' \
+ '-L[specify local port forwarding]:local port forwarding:->forward' \
+ '-R[specify remote port forwarding]:remote port forwarding:->forward' \
+ "$args[@]" && ret=0
+
+ while [[ -n "$state" ]]; do
+ lstate="$state"
+ state=''
+
+ case "$lstate" in
+ option)
+ if compset -P '*[= ]'; then
+ case "$IPREFIX" in
+ *(#i)(batchmode|compression|fallbacktorsh|forward(agent|x11)|keepalive|passwordauthentication|rhosts(|rsa)authentication|rsaauthentication|usersh|kerberos(authetication|tgtparsing)|usepriviledgedport)*)
+ _wanted values expl 'truth value' compadd yes no && ret=0
+ ;;
+ *(#i)cipher*)
+ _wanted values expl 'encryption cipher' \
+ compadd idea des 3des blowfish arcfour tss none && ret=0
+ ;;
+ *(#i)globalknownhostsfile*)
+ _description files expl 'global file with known hosts'
+ _files "$expl[@]" && ret=0
+ ;;
+ *(#i)hostname*)
+ _wanted hosts expl 'real host name to log into' _ssh_hosts && ret=0
+ ;;
+ *(#i)identityfile*)
+ _description files expl 'SSH identity file'
+ _files "$expl[@]" && ret=0
+ ;;
+ *(#i)(local|remote)forward*)
+ state=forward
+ ;;
+ *(#i)proxycommand*)
+ compset -q
+ shift 1 words
+ (( CURRENT-- ))
+ _normal && ret=0
+ ;;
+ *(#i)stricthostkeychecking*)
+ _wanted values expl 'checking type' compadd yes no ask && ret=0
+ ;;
+ *(#i)userknownhostsfile*)
+ _description files expl 'user file with known hosts'
+ _files "$expl[@]" && ret=0
+ ;;
+ *(#i)user*)
+ _wanted users expl 'user to log in as' _ssh_users && ret=0
+ ;;
+ *(#i)xauthlocation*)
+ _description files expl 'xauth program'
+ _files "$expl[@]" -g '*(-*)' && ret=0
+ ;;
+ esac
+ else
+ _wanted values expl 'configure file option' \
+ compadd -M 'm:{a-z}={A-Z}' -S '=' - \
+ BatchMode ClearAllForwardings Cipher Compression \
+ CompressionLevel Host ConnectionAttempts EscapeChar \
+ FallBackToRsh ForwardAgent ForwardX11 \
+ GlobalKnownHostsFile HostName IdentityFile KeepAlive \
+ KerberosAuthentication KerberosTgtPassing LocalForward \
+ NumberOfPasswordPrompts PasswordAuthentication Port \
+ ProxyCommand RemoteForward RhostsAuthentication \
+ RhostsRSAAuthentication RSAAuthentication \
+ StrictHostKeyChecking TISAuthentication \
+ UsePriviledgedPort User UserKnownHostsFile UseRsh \
+ XAuthLocation && ret=0
+ fi
+ ;;
+ forward)
+ if compset -P 1 '*:'; then
+ if compset -P '*:'; then
+ _message 'port number'
+ else
+ _wanted hosts expl host _ssh_hosts -qS:
+ fi
+ else
+ _message 'listen-port number'
+ fi
+ return
+ ;;
+ command)
+ shift 1 words
+ (( CURRENT-- ))
+ _normal
+ return
+ ;;
+ userhost)
+ if compset -P '*@'; then
+ _wanted hosts expl 'remote host name' _ssh_hosts && ret=0
else
- _hosts -S:
+ if (( $+opt_args[-l] )); then
+ tmp=()
+ else
+ tmp=( 'users:login name:_ssh_users -qS@' )
+ fi
+ _alternative \
+ 'hosts:remote host name:_ssh_hosts' \
+ "$tmp[@]" && ret=0
fi
+ ;;
+ esac
+
+ break;
+ done
+
+ return ret
+ ;;
+ scp)
+ _arguments -C -s \
+ '-c[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' \
+ '-P[specify port on remote host]:port number on remote host:' \
+ '-i[select identity file]:SSH identity file:_files' \
+ '-S[specify path to ssh]:path to ssh:_files -g \*\(-\*\)' \
+ '-o[give SSH options]:options:->options' \
+ '-p[preserve modification times]' \
+ '-r[recursively copy directories]' \
+ '-v[verbose mode]' \
+ '-B[batch mode]' \
+ '-C[compress data]' \
+ '*:file:->file' && ret=0
+
+ if [[ "$state" = options ]]; then
+ compset -q
+ words=(ssh-opt "$words[@]" )
+ (( CURRENT++ ))
+ _ssh
+ return
+ elif [[ -n "$state" ]]; then
+ if compset -P '*:'; then
+ _remote_files && ret=0
+ elif compset -P '*@'; then
+ _wanted hosts expl host _ssh_hosts -S: && ret=0
else
- _message 'listen-port number'
+ _alternative \
+ 'files:: _files' \
+ 'hosts:host:_ssh_hosts -S:' \
+ 'users:user:_ssh_users -S@' && ret=0
fi
- return
- ;;
- command)
- shift 1 words
- (( CURRENT-- ))
- _normal
- return
- ;;
- esac
+ fi
+ return ret
+ ;;
+ ssh-add)
+ _arguments -s \
+ '-p[read passphrase from stdin]' \
+ '-l[list all identities]' \
+ '-d[remove identity]' \
+ '-D[delete all identities]' \
+ '*:SSH identity file:_files'
+ return
+ ;;
+ ssh-agent)
+ _arguments -s \
+ '(:)-k[kill agent automatically]' \
+ '(:)-s[force sh-style shell]' \
+ '(:)-c[force csh-style shell]' \
+ '*::command: _normal'
+ return
+ ;;
+ ssh-keygen)
+ _arguments \
+ '(-p -c -u -P)-b[specify number of bits in key]:bits in key:' \
+ '(-p -c)-f[key file]:key file:_files' \
+ '(-c -u)-N[specify new passphrase]:new passphrase:' \
+ '(-b -u -f)-P[specify old passphrase]:old passphrase:' \
+ '(-p -u)-C[specify new comment]:new comment:' \
+ '(-b -f -C -u -c)-p[change passphrase of private key file]' \
+ '(-b -f -N -p -u)-c[change comment in private and public key files]' \
+ '(-b -N -C -p -c)-u[change key cipher to default]'
+ return
+ ;;
+ esac
+}
+
+_ssh_users () {
+ _combination -s '[:@]' my-accounts users-hosts users "$@"
+}
- break;
- done
+_ssh_hosts () {
+ if [[ "$IPREFIX" == *@ ]]; then
+ _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@"
+ else
+ _combination -s '[:@]' my-accounts users-hosts \
+ ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@"
+ fi
+}
- return ret
- ;;
-ssh-add)
- _arguments -s \
- '-p[read passphrase from stdin]' \
- '-l[list all identities]' \
- '-d[remove identity]' \
- '-D[delete all identities]' \
- '*:SSH identity file:_files'
- return
- ;;
-ssh-agent)
- _arguments -s \
- '(:)-k[kill agent automatically]' \
- '(:)-s[force sh-style shell]' \
- '(:)-c[force csh-style shell]' \
- '*::command: _normal'
- return
- ;;
-ssh-keygen)
- _arguments \
- '(-p -c -u -P)-b[specify number of bits in key]:bits in key:' \
- '(-p -c)-f[key file]:key file:_files' \
- '(-c -u)-N[specify new passphrase]:new passphrase:' \
- '(-b -u -f)-P[specify old passphrase]:old passphrase:' \
- '(-p -u)-C[specify new comment]:new comment:' \
- '(-b -f -C -u -c)-p[change passphrase of private key file]' \
- '(-b -f -N -p -u)-c[change comment in private and public key files]' \
- '(-b -N -C -p -c)-u[change key cipher to default]'
- return
- ;;
-esac
+_ssh "$@"
diff --git a/Completion/User/_tiff b/Completion/User/_tiff
index 318c536d0..9616009c3 100644
--- a/Completion/User/_tiff
+++ b/Completion/User/_tiff
@@ -1,9 +1,9 @@
#compdef -P (tiff*|*2tiff|pal2rgb)
-local pat expl ret=1
+local pat expl ret=1 cmd="${words[1]:t}"
-if [[ "$words[1]" = *2tiff ]]; then
- pat="*.(#i)${words[1]%%2tiff}"
+if [[ "$cmd" = *2tiff ]]; then
+ pat="*.(#i)${cmd%%2tiff}"
else
pat="*.(#i)tiff"
fi
@@ -23,7 +23,7 @@ local _in_tiff=yes
local curcontext="$curcontext" state line ret=1
typeset -A opt_args
-case "$words[1]" in
+case "$cmd" in
tiff2bw)
_arguments -C \
'-c[specify compression scheme]:compression scheme:->compress' \
diff --git a/Completion/User/_yp b/Completion/User/_yp
index 85d783b06..5b0c86143 100644
--- a/Completion/User/_yp
+++ b/Completion/User/_yp
@@ -1,11 +1,11 @@
#compdef ypcat ypmatch yppasswd ypwhich ypset ypserv ypbind yppush yppoll ypxfr domainname
-local line state ret=1
-typeset -A options
+local curcontext="$curcontext" line state ret=1
+typeset -A opt_args
if (( ! $+_yp_cache_maps )); then
- _yp_cache_maps=( "${(@)${(@f)$(ypwhich -m)}%% *}" )
- _yp_cache_nicks=( "${(@)${(@)${(@f)$(ypwhich -x)}#*\"}%%\"*}" )
+ _yp_cache_maps=( "${(@)${(@f)$(_call maps ypwhich -m)}%% *}" )
+ _yp_cache_nicks=( "${(@)${(@)${(@f)$(_call names ypwhich -x)}#*\"}%%\"*}" )
_yp_args=(
'(-x)-d[specify domain]:domain name:' \
'(-x)-k[display keys]' \
@@ -14,19 +14,19 @@ if (( ! $+_yp_cache_maps )); then
)
fi
-case "$words[1]" in
+case "${words[1]:t}" in
ypcat)
- _arguments -s "$_yp_args[@]" ':map name:->map' && ret=0
+ _arguments -C -s "$_yp_args[@]" ':map name:->map' && ret=0
;;
ypmatch)
- _arguments -s "$_yp_args[@]" '*::key map:->keymap' && ret=0
+ _arguments -C -s "$_yp_args[@]" '*::key map:->keymap' && ret=0
;;
yppasswd)
_users
return
;;
ypwhich)
- _arguments \
+ _arguments -C \
'(-x)-d[specify domain]:domain name:' \
'(-x -V2 -m -t)-V1[identify version 1 servers]' \
'(-x -V1 -m -t)-V2[identify version 2 servers]' \
@@ -36,7 +36,7 @@ ypwhich)
':host:_hosts' && ret=0
;;
ypset)
- _arguments \
+ _arguments -C \
'(-V2)-V1[bind version 1 servers]' \
'(-V1)-V2[bind version 2 servers]' \
'-d[specify domain]:domain name:' \
@@ -44,30 +44,30 @@ ypset)
':server:_hosts' && ret=0
;;
ypserv)
- _arguments \
+ _arguments -C \
'-a[specify database routines]:database routines:((b\:btree d\:dbm/ndbm h\:hash))' && ret=0
;;
ypbind)
- _arguments \
+ _arguments -C \
'-s[allow secure mode for ypbind]' \
'-S[set domain and servers]:domain:->servers' \
'(-ypsetme)-ypset[accept all ypset requests]' \
'(-ypset)-ypsetme[accept only local ypset requests]' && ret=0
;;
yppush)
- _arguments \
+ _arguments -C \
'-d[specify domain]:domain name:' \
'-v[print messages]' \
':map name:->map' && ret=0
;;
yppoll)
- _arguments \
+ _arguments -C \
'-d[specify domain]:domain name:' \
'-h[specify host]:ask server on host:_hosts' \
':map name:->map' && ret=0
;;
ypxfr)
- _arguments \
+ _arguments -C \
'-a[specify database routines]:database routines:((b\:btree d\:dbm/ndbm h\:hash))' \
'-f[force transfer]' \
'-c[don'"'"'t clear current map]' \
@@ -87,16 +87,24 @@ esac
if [[ "$state" = map* ]]; then
local expl
- _description expl 'map name'
- compadd "$expl[@]" - "$_yp_cache_maps[@]" && ret=0
- if [[ $+options[-t] -eq 0 && "$state" != maponly ]]; then
- _description expl 'nicknames'
- compadd "$expl[@]" - "$_yp_cache_nicks[@]" && ret=0
+ if [[ $+opt_args[-t] -eq 0 && "$state" != maponly ]]; then
+ _tags maps nicknames
+ else
+ _tags maps
fi
+
+ while _tags; do
+ # The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'.
+ _requested maps expl 'map name' \
+ compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' - \
+ "$_yp_cache_maps[@]" && ret=0
+ _requested nicknames expl nicknames \
+ compadd - "$_yp_cache_nicks[@]" && ret=0
+ (( ret )) || return 0
+ done
elif [[ "$state" = servers ]]; then
if compset -P '*,'; then
- _description expl 'server'
- _hosts -qS, && ret=0
+ _wanted hosts expl server _hosts -qS, && ret=0
else
_message 'domain name'
fi
diff --git a/Completion/X/_xutils b/Completion/X/_xutils
index 4eea8ded1..a57f7be36 100644
--- a/Completion/X/_xutils
+++ b/Completion/X/_xutils
@@ -1,6 +1,6 @@
#compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb
-case "$words[1]" in
+case "${words[1]:t}" in
xdpyinfo)
_x_arguments \
-queryExtensions \