mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-27 02:01:09 +01:00
remove _apt-cache _apt-get _apt_arguments
This commit is contained in:
parent
03902f7a05
commit
48306f7ac4
3 changed files with 0 additions and 293 deletions
|
@ -1,40 +0,0 @@
|
|||
#compdef apt-cache
|
||||
|
||||
_apt_arguments _apt-cache_sm \
|
||||
-h,--help:bool \
|
||||
-v,--version:bool \
|
||||
-p,--pkg-cache:'_files "$expl_pkg_cache[@]"' \
|
||||
-s,--src-cache:'_files "$expl_src_cache[@]"' \
|
||||
-q,--quiet:intlevel \
|
||||
-i,--important:bool \
|
||||
-f,--full:bool \
|
||||
--name-only:bool \
|
||||
-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' \
|
||||
\)
|
||||
|
||||
_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'
|
||||
|
||||
_apt-cache_sm
|
||||
}
|
||||
|
||||
_apt-cache "$@"
|
|
@ -1,23 +0,0 @@
|
|||
#compdef apt-get
|
||||
|
||||
_arguments -s \
|
||||
-{,-no-}d --{,no-}download-only \
|
||||
-{,-no-}f --{,no-}fix-broken \
|
||||
-{,-no-}h --{,no-}help \
|
||||
-{,-no-}v --{,no-}version \
|
||||
-{,-no-}m --{,no-}ignore-missing \
|
||||
--{,no-}fix-missing \
|
||||
--{,no-}no-download \
|
||||
\*-{,-no-}q \*--{,no-}{quiet,silent} \
|
||||
-{,-no-}s --{,no-}{simulate,just-print,dry-run,recon,no-act} \
|
||||
-{,-no-}y --{,no-}{yes,assume-yes} \
|
||||
-{,-no-}u --{,no-}show-upgraded \
|
||||
-{,-no-}b --{,no-}{compile,build} \
|
||||
--{,no-}ignore-hold \
|
||||
--{,no-}no-upgrade \
|
||||
--{,no-}force-yes \
|
||||
--{,no-}print-uris \
|
||||
{-{,-no-}c,--{,no-}config-file}':Configuration File:_files' \
|
||||
{-o,--option}':Foo\:\:Bar=bar:' \
|
||||
':command:(update upgrade dselect-upgrade dist-upgrade install remove source check clean autoclean help)' \
|
||||
'*:package:_deb_packages'
|
|
@ -1,230 +0,0 @@
|
|||
#autoload
|
||||
|
||||
# short_bool=(h v d b s y f u m)
|
||||
# short_intlevel=(q)
|
||||
# short_configfile=(c)
|
||||
# short_arbitem=(o)
|
||||
#
|
||||
# long_bool=(help version download-only compile build simulate just-print recon
|
||||
# no-act yes assume-yes fix-broken show-upgraded ignore-missing no-download
|
||||
# fix-missing ignore-hold no-upgrade force-yes print-uris)
|
||||
# long_intlevel=(quiet silent)
|
||||
# long_configfile=(config-file)
|
||||
# long_arbitem=(option)
|
||||
|
||||
###
|
||||
|
||||
local funcname
|
||||
funcname="$1"
|
||||
shift
|
||||
|
||||
local short_seq false true bool bool_ __bool_ intlevel word word1 nul
|
||||
local comp_bool comp_intlevel comp_configfile comp_arbitem comp_long
|
||||
local regex_short regex_long regex_message regex_action
|
||||
|
||||
regex_action=("$@")
|
||||
|
||||
short_seq="(${(j:|:)short_bool}|${(j:|:)short_intlevel})#"
|
||||
|
||||
false=(no false without off disable)
|
||||
true=(yes true with on enable)
|
||||
bool=($false $true)
|
||||
|
||||
bool_=(${^bool}-)
|
||||
__bool_=(--$^bool_)
|
||||
|
||||
intlevel='[0-9]##'
|
||||
|
||||
word=$'[^\0]#\0'
|
||||
word1=$'[^\0]##\0'
|
||||
|
||||
nul=$'\0'
|
||||
|
||||
comp_bool='compadd "$expl_bool[@]" '"$bool"
|
||||
comp_intlevel= #"_message 'intlevel'"
|
||||
comp_configfile='_files "$expl_configfile[@]"'
|
||||
comp_arbitem= #"_message 'Foo::Bar=bar'"
|
||||
|
||||
comp_long="\
|
||||
tmp1=\${(kj:|:)long_to_option[(R)\${(kj:|:)~options[(R)*~0]}]}
|
||||
tmp2=(--\${(M)^long_bool:#\$~tmp1} --\${(M)^long_intlevel:#\$~tmp1})
|
||||
compadd \"\$expl_opt[@]\" - \$tmp2
|
||||
tmp2=(--\${(M)^long_configfile:#\$~tmp1} --\${(M)^long_arbitem:#\$~tmp1})
|
||||
compadd \"\$expl_opt[@]\" -S= - \$tmp2
|
||||
compadd \"\$expl_opt[@]\" -S '' - $__bool_"
|
||||
|
||||
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_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_configfile})(=|)"
|
||||
-"apt_consume_short \${_ra_match%=}"
|
||||
\( /"$word1" !"$comp_configfile" \| /"$nul" /"$word" !"$comp_configfile" \) \|
|
||||
/"$short_seq(${(j:|:)short_arbitem})(=|)"
|
||||
-"apt_consume_short \${_ra_match%=}"
|
||||
\( /"$word1" !"$comp_arbitem" \| /"$nul" /"$word" !"$comp_arbitem" \) \|
|
||||
/"[]" !"{
|
||||
if [[ \$PREFIX = -$short_seq ]]; then
|
||||
apt_consume_short \${PREFIX[2,-1]}
|
||||
tmp1=(\${(k)short_to_option[(R)\${(kj:|:)~options[(R)*~0]}]})
|
||||
tmp2=(-\${^tmp1})
|
||||
compadd \"\$expl_opt[@]\" -y \"(\$tmp2)\" - \${PREFIX}\${^tmp1}
|
||||
fi
|
||||
$comp_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_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_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_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:|:)bool})-"
|
||||
\(
|
||||
/"(${(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_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_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_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:|:)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_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_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_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" \) \|
|
||||
/"[]" !"{ tmp1=\${(kj:|:)long_to_option[(R)\${(kj:|:)~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_configfile:#\$~tmp1} \$_ra_left\${(M)^long_arbitem:#\$~tmp1})
|
||||
compadd \"\$expl_opt[@]\" -S= - \$tmp2
|
||||
tmp1=\${(kj:|:)short_to_option[(R)\${(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_configfile:#\$~tmp1} \$_ra_left\${(M)^short_arbitem:#\$~tmp1})
|
||||
compadd \"\$expl_opt[@]\" -S= - \$tmp2
|
||||
}"
|
||||
\) \|
|
||||
/"[]" !"{
|
||||
$comp_long
|
||||
}"
|
||||
\)
|
||||
)
|
||||
|
||||
regex_message=(
|
||||
/"[]" !"[[ -prefix - || -z \"\$compconfig[option_prefix]\" ]] && {
|
||||
if [[ \$PREFIX = -$short_seq ]]; then
|
||||
apt_consume_short \${PREFIX[2,-1]}
|
||||
tmp1=(\${(k)short_to_option[(R)\${(kj:|:)~options[(R)*~0]}]})
|
||||
tmp2=(-\${^tmp1})
|
||||
compadd \"\$expl_opt[@]\" -y \"(\$tmp2)\" - \${PREFIX}\${^tmp1}
|
||||
elif [[ -z "\$PREFIX" ]]; then
|
||||
tmp1=(-\${(k)^short_to_option[(R)\${(kj:|:)~options[(R)*~0]}]})
|
||||
compadd \"\$expl_opt[@]\" - \$tmp1
|
||||
fi
|
||||
$comp_long
|
||||
}"
|
||||
)
|
||||
|
||||
apt_consume_short () {
|
||||
local short opt
|
||||
for short in ${(s::)1}; do
|
||||
opt="$short_to_option[$short]"
|
||||
(( 0 < options[$opt] && options[$opt]-- ))
|
||||
done
|
||||
}
|
||||
|
||||
apt_consume_long () {
|
||||
local long opt
|
||||
opt="$long_to_option[$1]"
|
||||
(( 0 < options[$opt] && options[$opt]-- ))
|
||||
}
|
||||
|
||||
_regex_arguments "${funcname}_sm" /"$word" \( "$regex_long[@]" \| "$regex_short[@]" \| "$regex_message[@]" \) \# "$regex_action[@]"
|
||||
|
||||
eval "$funcname () {
|
||||
local short_bool short_intlevel short_configfile short_arbitem
|
||||
local long_bool long_intlevel long_configfile long_arbitem
|
||||
short_bool=($short_bool)
|
||||
short_intlevel=($short_intlevel)
|
||||
short_configfile=($short_configfile)
|
||||
short_arbitem=($short_arbitem)
|
||||
long_bool=($long_bool)
|
||||
long_intlevel=($long_intlevel)
|
||||
long_configfile=($long_configfile)
|
||||
long_arbitem=($long_arbitem)
|
||||
|
||||
${funcname}_sm
|
||||
}"
|
||||
|
Loading…
Reference in a new issue