1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-28 05:00:59 +01:00

16461: a number of minor completion function updates

This commit is contained in:
Oliver Kiddle 2002-01-16 16:29:51 +00:00
parent 8476aa7fc2
commit d7822305b4
22 changed files with 90 additions and 44 deletions

View file

@ -1,3 +1,18 @@
2002-01-16 Oliver Kiddle <opk@zsh.org>
* 16461: Completion/AIX/Command/_lspv
Completion/Base/Utility/_sep_parts,
Completion/Mandrake/Command/_urpmi, Completion/Unix/Command/_cpio,
Completion/Unix/Command/_fsh, Completion/Unix/Command/_ifconfig,
Completion/Unix/Command/_java, Completion/Unix/Command/_lynx,
Completion/Unix/Command/_modutils, Completion/Unix/Command/_mount,
Completion/Unix/Command/_ssh, Completion/Unix/Command/_telnet,
Completion/Unix/Command/_user_admin, Completion/Unix/Command/_w3m,
Completion/Unix/Type/.distfiles, Completion/Unix/Type/_terminals,
Completion/X/Command/_xfig, Completion/X/Command/_xloadimage,
Completion/X/Command/_xterm, Completion/Zsh/Command/_alias,
Completion/Zsh/Context/_value: various minor completion changes
2002-01-14 Oliver Kiddle <opk@zsh.org> 2002-01-14 Oliver Kiddle <opk@zsh.org>
* 16449: Completion/Unix/Command/_chkconfig: new completion for * 16449: Completion/Unix/Command/_chkconfig: new completion for

View file

@ -1,7 +1,7 @@
#compdef lspv #compdef lspv
_arguments -C -s \ _arguments -C -s \
'(-p -M)-l[list logical volumns on physical volume]' \ '(-p -M)-l[list logical volumes on physical volume]' \
'(-l -M)-p[list partitions on physical volume]' \ '(-l -M)-p[list partitions on physical volume]' \
'(-l -p)-M[list mapping of physical and logical partition numbers]' \ '(-l -p)-M[list mapping of physical and logical partition numbers]' \
'-n[specify physical volume to access variable descriptor from]:physical volume:_physical_volumes' \ '-n[specify physical volume to access variable descriptor from]:physical volume:_physical_volumes' \

View file

@ -3,7 +3,7 @@
# This function can be used to separately complete parts of strings # This function can be used to separately complete parts of strings
# where each part may be one of a set of matches and different parts # where each part may be one of a set of matches and different parts
# have different sets. # have different sets.
# Arguments are alternatingly arrays and separator strings. Arrays may # Arguments are alternately arrays and separator strings. Arrays may
# be given by name or literally as words separated by white space in # be given by name or literally as words separated by white space in
# parentheses, e.g.: # parentheses, e.g.:
# #

View file

@ -11,12 +11,12 @@ _urpmi_cache_policy() {
} }
_urpmi() { _urpmi() {
local state context line ret=1 local expl state curcontext="$curcontext" line ret=1
typeset -A opt_args typeset -A opt_args
case "$service" in case "$service" in
urpmi.addmedia ) urpmi.addmedia )
_arguments -A '-*' \ _arguments -C -A '-*' \
"(--wget)--curl[use curl to retrieve distant files]" \ "(--wget)--curl[use curl to retrieve distant files]" \
"(:)--distrib[automatically create all media from an installation medium]:media URL:->media_url" \ "(:)--distrib[automatically create all media from an installation medium]:media URL:->media_url" \
"--update[mark as update media]" \ "--update[mark as update media]" \
@ -31,13 +31,13 @@ _urpmi() {
&& ret=0 && ret=0
;; ;;
urpmi.removemedia ) urpmi.removemedia )
_arguments -A '-*' \ _arguments -C -A '-*' \
"(:)-a[select all media]" \ "(:)-a[select all media]" \
"(-a)"{,\*}": :->urpmi_media" \ "(-a)"{,\*}": :->urpmi_media" \
&& ret=0 && ret=0
;; ;;
urpmi.update ) urpmi.update )
_arguments -A '-*' \ _arguments -C -A '-*' \
"(--wget)--curl[use curl to retrieve distant files]" \ "(--wget)--curl[use curl to retrieve distant files]" \
"(--curl)--wget[use wget to retrieve distant files]" \ "(--curl)--wget[use wget to retrieve distant files]" \
"(:)-a[select all non-removable media]" \ "(:)-a[select all non-removable media]" \
@ -48,7 +48,7 @@ _urpmi() {
&& ret=0 && ret=0
;; ;;
urpmi ) urpmi )
_arguments -A '-*' \ _arguments -C -A '-*' \
"(: -)--help[print usage information]" \ "(: -)--help[print usage information]" \
"(--help)--allow-medium-change[allow change of removable media]" \ "(--help)--allow-medium-change[allow change of removable media]" \
"(--help)--auto[do not ask any questions]" \ "(--help)--auto[do not ask any questions]" \

View file

@ -2,7 +2,7 @@
(( $+_is_gnu )) || typeset -gA _is_gnu (( $+_is_gnu )) || typeset -gA _is_gnu
local cmd=$service args ig context curcontext="$curcontext" state line opt_args local cmd=$service args ig curcontext="$curcontext" state line
local expl ret local expl ret
local fmts='(bar bin odc newc crc tar ustar hpbin hpodc)' local fmts='(bar bin odc newc crc tar ustar hpbin hpodc)'
@ -114,7 +114,7 @@ else
fi fi
ret=1 ret=1
_arguments -s "$args[@]" && ret=0 _arguments -C -s "$args[@]" && ret=0
if [[ $state = afile ]]; then if [[ $state = afile ]]; then
if compset -P '*:'; then if compset -P '*:'; then

View file

@ -1,6 +1,8 @@
#compdef fsh #compdef fsh
_arguments \ local curcontext="$curcontext" state line
_arguments -C \
'(--help)-h[help]' \ '(--help)-h[help]' \
'(-h)--help' \ '(-h)--help' \
'(--version)-V[version]' \ '(--version)-V[version]' \

View file

@ -1,6 +1,6 @@
#compdef ifconfig #compdef ifconfig
local context state line ret=1 local curcontext="$curcontext" state line ret=1
local -a opts args alias debug updownlist local -a opts args alias debug updownlist
alias=( '(-alias alias)'{,-}'alias[remove or establish alternate address for if]' ) alias=( '(-alias alias)'{,-}'alias[remove or establish alternate address for if]' )
@ -63,7 +63,7 @@ case $OSTYPE in
;; ;;
esac esac
_arguments "$args[@]" \ _arguments -C "$args[@]" \
'-a[apply to all interfaces]' \ '-a[apply to all interfaces]' \
'1:network interface:_net_interfaces' \ '1:network interface:_net_interfaces' \
'::address family:(atalk ether inet inet6 ax25 ddp ipx netrom)' \ '::address family:(atalk ether inet inet6 ax25 ddp ipx netrom)' \

View file

@ -8,7 +8,7 @@ jdb_args=()
case "$service" in case "$service" in
javac) javac)
_arguments \ _arguments -C \
'-g-[generate debugging information]:debug:->debug' \ '-g-[generate debugging information]:debug:->debug' \
'-O[optimize]' \ '-O[optimize]' \
'-nowarn[suppress warnings]' \ '-nowarn[suppress warnings]' \
@ -32,7 +32,7 @@ jdb)
;& ;&
java) java)
_arguments \ _arguments -C \
"$jdb_args[@]" \ "$jdb_args[@]" \
'(-cp)-classpath[specify path for user class files]:class path:->classpath' \ '(-cp)-classpath[specify path for user class files]:class path:->classpath' \
'(-classpath)-cp[specify path for user class files]:class path:->classpath' \ '(-classpath)-cp[specify path for user class files]:class path:->classpath' \
@ -50,7 +50,7 @@ java)
;; ;;
javadoc) javadoc)
_arguments \ _arguments -C \
'-overview[specify overview file]:_files' \ '-overview[specify overview file]:_files' \
'-public[display public classes and members only]' \ '-public[display public classes and members only]' \
'-protected[display public/protected classes and members only (default)]' \ '-protected[display public/protected classes and members only (default)]' \
@ -94,7 +94,7 @@ javadoc)
;; ;;
appletviewer) appletviewer)
_arguments \ _arguments -C \
'-debug[run applet on jdb]' \ '-debug[run applet on jdb]' \
'-encoding[specify character encoding for source files]:encoding:->encoding' \ '-encoding[specify character encoding for source files]:encoding:->encoding' \
'-J-[specify java option]:java option:' \ '-J-[specify java option]:java option:' \
@ -120,7 +120,7 @@ jar)
m ':manifest file:_files' m ':manifest file:_files'
f ':archive file:_files -g \*.\(jar\|zip\)' f ':archive file:_files -g \*.\(jar\|zip\)'
) )
_arguments \ _arguments -C \
"${jar_cmd/[^-]*/:dummy:}" \ "${jar_cmd/[^-]*/:dummy:}" \
${${(s::)jar_cmd}/(#b)(?)/$tmpassoc[$match[1]]} \ ${${(s::)jar_cmd}/(#b)(?)/$tmpassoc[$match[1]]} \
'*:file:->jararg' && return 0 '*:file:->jararg' && return 0
@ -128,7 +128,7 @@ jar)
;; ;;
javah|javah_g) javah|javah_g)
_arguments \ _arguments -C \
'-o[specify output file]:output file:_files' \ '-o[specify output file]:output file:_files' \
'-d[specify destination directory]:directory:_files -/' \ '-d[specify destination directory]:directory:_files -/' \
'-stubs[generate stubs]' \ '-stubs[generate stubs]' \
@ -144,7 +144,7 @@ javah|javah_g)
;; ;;
javap) javap)
_arguments \ _arguments -C \
'-help[print help message]' \ '-help[print help message]' \
'-l[line and local variable tables]' \ '-l[line and local variable tables]' \
'-b[backward compatible to JDK1.1]' \ '-b[backward compatible to JDK1.1]' \
@ -169,7 +169,7 @@ extcheck)
;; ;;
rmic) rmic)
_arguments \ _arguments -C \
'-classpath[specify path for user class files]:class path:->classpath' \ '-classpath[specify path for user class files]:class path:->classpath' \
'-d[specify destination directory]:directory:_files -/' \ '-d[specify destination directory]:directory:_files -/' \
'-depend[treat dependencies]' \ '-depend[treat dependencies]' \
@ -207,7 +207,7 @@ serialvar)
;; ;;
native2ascii) native2ascii)
_arguments \ _arguments -C \
'-reverse[convert Latin-1 (with \udddd) to native encoding]' \ '-reverse[convert Latin-1 (with \udddd) to native encoding]' \
'-encoding[specify character encoding]:encoding:->encoding' \ '-encoding[specify character encoding]:encoding:->encoding' \
':input file:_files' \ ':input file:_files' \

View file

@ -14,20 +14,20 @@ _arguments -C \
'-blink' \ '-blink' \
'-book' \ '-book' \
'-buried_news' \ '-buried_news' \
'-cache=:NUMBER:' \ '-cache=:number of documents:' \
'-case' \ '-case' \
'-cfg=:FILENAME:_files' \ '-cfg=:configuration file:_files' \
'-child' \ '-child' \
'-color' \ '-color' \
'-cookies' \ '-cookies' \
'-core' \ '-core' \
'-crawl' \ '-crawl' \
'-display=:DISPLAY:_x_display' \ '-display=:display:_x_display' \
'-dump' \ '-dump' \
'-editor=:EDITOR:_files' \ '-editor=:editor:_command_names -e' \
'-emacskeys' \ '-emacskeys' \
'-enable_scrollback' \ '-enable_scrollback' \
'-error_file=:FILENAME:_files' \ '-error_file=:error file:_files' \
'-fileversions' \ '-fileversions' \
'-force_html' \ '-force_html' \
'-force_secure' \ '-force_secure' \
@ -41,7 +41,7 @@ _arguments -C \
'-image_links' \ '-image_links' \
'-ismap' \ '-ismap' \
'-index=:URL:->html' \ '-index=:URL:->html' \
'-link=:NUMBER:' \ '-link=:starting count:' \
'-localhost' \ '-localhost' \
'-locexec' \ '-locexec' \
'-mime_header' \ '-mime_header' \
@ -83,7 +83,7 @@ _arguments -C \
'-startfile_ok' \ '-startfile_ok' \
'-tagsoup' \ '-tagsoup' \
'-telnet' \ '-telnet' \
'-term=:TERM:' \ '-term=:terminal name:_terminals' \
'-tlog' \ '-tlog' \
'-trace' \ '-trace' \
'-traversal' \ '-traversal' \

View file

@ -1,6 +1,6 @@
#compdef modprobe rmmod #compdef modprobe rmmod
local expl loaded local curcontext="$curcontext" state line expl loaded
_modutils_loaded_modules() { _modutils_loaded_modules() {
@ -62,7 +62,7 @@ case "$service" in
'(-C)--config:config file:_files' '(-C)--config:config file:_files'
) )
_arguments '(--remove)-r[remove]:*:loaded module:->modprobe_remove' \ _arguments -C '(--remove)-r[remove]:*:loaded module:->modprobe_remove' \
'(-r)--remove:*:loaded module:->modprobe_remove' \ '(-r)--remove:*:loaded module:->modprobe_remove' \
'(--list)-l[list matching modules]:*:module file:->modprobe_list' \ '(--list)-l[list matching modules]:*:module file:->modprobe_list' \
'(-l)--list:*:module file:->modprobe_list' \ '(-l)--list:*:module file:->modprobe_list' \

View file

@ -50,7 +50,7 @@ fi
# are below these table. # are below these table.
local curcontext="$curcontext" state line suf ret=1 local curcontext="$curcontext" state line suf ret=1
local args fss deffs=iso9660 descr tmp typeops=-t _nfs_access _nfs_ufs local args deffs=iso9660 tmp typeops=-t _nfs_access _nfs_ufs
typeset -A opt_args typeset -A opt_args
@ -177,7 +177,7 @@ if (( ! $+_fs_any )); then
'(susp)nosusp[disable system use sharing protocol]' '(susp)nosusp[disable system use sharing protocol]'
'(norrip)rrip[enable rock ridge extensions]' '(norrip)rrip[enable rock ridge extensions]'
'(rrip)norrip[disable rock ridge extensions]' '(rrip)norrip[disable rock ridge extensions]'
'nmconv[specify filename translation]:filename translation:(c l m)' 'nmconv[specify filename translation]:filename translation:((c\:no\ translation l\:to\ lowercase m\:suppress\ version\ no))'
) )
_fs_nfs=( _fs_nfs=(
@ -537,7 +537,6 @@ if [[ "$service" = mount ]]; then
'-M[use alternate mtab]:alternate mtab:_files' '-M[use alternate mtab]:alternate mtab:_files'
'-P[with -p, prepend prefix to paths]:prefix' '-P[with -p, prepend prefix to paths]:prefix'
) )
fss=( efs proc fd nfs iso9660 dos hfs cachefs )
deffs=efs deffs=efs
;; ;;
linux*) linux*)

View file

@ -5,8 +5,12 @@ _remote_files () {
# colorings and LIST_TYPES and so on, but I'm just not that ambitious. # colorings and LIST_TYPES and so on, but I'm just not that ambitious.
local expl local expl
_wanted files expl 'remote files' \ if zstyle -T ":completion:${curcontext}:" remote-access; then
compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*) _wanted files expl 'remote files' \
compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*)
else
_message 'remote files'
fi
} }
_ssh () { _ssh () {

View file

@ -9,7 +9,7 @@ local curcontext="$curcontext" state line expl
typeset -A opt_args typeset -A opt_args
if (( ! $+_telnet_args )); then if (( ! $+_telnet_args )); then
local help="$(_call_program options telnet -\? < /dev/null 2>&1)" local help="$(_call_program options 'telnet -\?' < /dev/null 2>&1)"
local -A optionmap local -A optionmap
optionmap=( optionmap=(
'*\[-8\]*' '-8[allow 8-Bit data]' '*\[-8\]*' '-8[allow 8-Bit data]'

View file

@ -15,7 +15,7 @@ if [[ $service = user* ]]; then
args=( args=(
'(-D)-c+[comment]:comment' '(-D)-c+[comment]:comment'
"(-D)-${home}+[home directory]:home directory:_directories -W /" "(-D)-${home}+[home directory]:home directory:_directories -W /"
'(-D)-e+[specify expriration date]:expiration date (YYYY-MM-DD)' '(-D)-e+[specify expiration date]:expiration date (YYYY-MM-DD)'
'(-D)-f+[specify inactive days]:inactive days' '(-D)-f+[specify inactive days]:inactive days'
'(-D)-g+[initial group]:initial group:_groups' '(-D)-g+[initial group]:initial group:_groups'
'(-D)-G+[supplementary groups]:supplementary groups:_groups -S,' '(-D)-G+[supplementary groups]:supplementary groups:_groups -S,'

View file

@ -3,7 +3,7 @@
local curcontext="$curcontext" state line local curcontext="$curcontext" state line
typeset -A opt_args typeset -A opt_args
_arguments \ _arguments -C \
'-t[tabwidth]:tabwidth:' \ '-t[tabwidth]:tabwidth:' \
'-r[ignore backspace effect]' \ '-r[ignore backspace effect]' \
'-l[preserved lines]:number of lines:' \ '-l[preserved lines]:number of lines:' \

View file

@ -8,5 +8,5 @@ _domains _path_files _ps _user_at_host
_files _pdf _pspdf _users _files _pdf _pspdf _users
_groups _perl_basepods _signals _users_on _groups _perl_basepods _signals _users_on
_hosts _perl_builtin_funcs _tar_archive _time_zone _hosts _perl_builtin_funcs _tar_archive _time_zone
_file_systems _net_interfaces _file_systems _net_interfaces _terminals
' '

View file

@ -0,0 +1,8 @@
#compdef infocmp
local desc expl
desc=( $TERMINFO ~/.terminfo $TERMINFO_DIRS /usr/{,share/}{,lib/}terminfo )
_wanted terminals expl 'terminal name' \
compadd "$@" - $desc/*/*(N:t)

View file

@ -7,7 +7,7 @@ _x_arguments \
'-but_per_row:number of buttons:' \ '-but_per_row:number of buttons:' \
'-cbg:canvas background color:_x_color' \ '-cbg:canvas background color:_x_color' \
'-cfg:canvas foreground color:_x_color' \ '-cfg:canvas foreground color:_x_color' \
'-depth:visual depth:_x_visdepth' \ '-depth:visual depth:' \
'-exportlanguage:export language:(box latex epic eepic eepicemu pictex ibmgl eps ps pstex textyl tpic pic mf acad pcx png gif jpeg tiff ppm xbm xpm)' \ '-exportlanguage:export language:(box latex epic eepic eepicemu pictex ibmgl eps ps pstex textyl tpic pic mf acad pcx png gif jpeg tiff ppm xbm xpm)' \
'-iconGeometry:icon geometry:_x_geometry' \ '-iconGeometry:icon geometry:_x_geometry' \
'-internalBW:internal border width:' \ '-internalBW:internal border width:' \

View file

@ -16,7 +16,7 @@ if rc=( ${(f)"$($words[1] -path)"} ); then
'*-iscale[scale image]:scale factor' '*-iscale[scale image]:scale factor'
'*-c'{,olor}'dither[dither image]' '*-c'{,olor}'dither[dither image]'
'*-expand[expand image to 24-bit]' '*-expand[expand image to 24-bit]'
'*-xpm[specify xpm color map]:color context key:(m g4 g c)' '*-xpm[specify xpm color map]:color context key:((m\:mono g4\:4\ level\ gray g\:gray c\:color))'
) )
else else
# xloadimage # xloadimage
@ -40,7 +40,7 @@ extension=( ${=rc[2]#*:} )
_x_arguments "$args[@]" \ _x_arguments "$args[@]" \
'-default[set root background to default]' \ '-default[set root background to default]' \
'-fit[use default visual and colormap]' \ '-fit[use default visual and colormap]' \
'-fullscreen[use whole screen, suurounding image with border]' \ '-fullscreen[use whole screen, surrounding image with border]' \
"-goto[specify image to display at end]:image name:_files -W ipath -g '*(#i)(${(j:|:)extension})(|${(j:|:)filters})'" \ "-goto[specify image to display at end]:image name:_files -W ipath -g '*(#i)(${(j:|:)extension})(|${(j:|:)filters})'" \
'(*)-help[display information on options]' \ '(*)-help[display information on options]' \
'-identity[identify supplied images instead of displaying]' \ '-identity[identify supplied images instead of displaying]' \

View file

@ -16,7 +16,7 @@ _xt_arguments \
'-ms:pointer cursor color:_x_color' \ '-ms:pointer cursor color:_x_color' \
'-nb:margin bell number:' \ '-nb:margin bell number:' \
'-sl:save lines:' \ '-sl:save lines:' \
'-ti:terminal ID:(vt52 vt100 vt101 vt102 vt220)' \ '-ti:terminal ID:_terminals' \
'-tm:terminal setting:' \ '-tm:terminal setting:' \
'-tn:terminal type:' \ '-tn:terminal type:' \
'-ziconbeep:iconbeep (percent):' \ '-ziconbeep:iconbeep (percent):' \

View file

@ -1,8 +1,21 @@
#compdef alias #compdef alias
local curcontext="$curcontext" state line suf
_arguments -C -s -A "-*" -S \ _arguments -C -s -A "-*" -S \
'-+g[list or define global aliases]' \ '-+g[list or define global aliases]' \
'-+r[list or define regular aliases]' \ '-+r[list or define regular aliases]' \
'-+m[print aliases matching specified pattern]' \ '-+m[print aliases matching specified pattern]' \
'-L[print each alias in the form of calls to alias]' \ '-L[print each alias in the form of calls to alias]' \
'*::alias definition:_aliases -S =' '*::alias definition:->defn'
if [[ -n "$state" ]]; then
if compset -P 1 '*='; then
compset -q
_normal
else
compset -S '=*' || suf='='
_wanted alias expl 'alias definition' _aliases -S "$suf"
fi
fi

View file

@ -60,6 +60,11 @@ _value:LDFLAGS () {
_value:DISPLAY() { _x_display "$@" } _value:DISPLAY() { _x_display "$@" }
_value:PRINTER() { _printers "$@" }
_value:LPDEST() { _printers "$@" }
_value:TERM() { _terminals "$@" }
_value:TZ() { _time_zone "$@" } _value:TZ() { _time_zone "$@" }
_value "$@" _value "$@"