From d8c0f241b7dc74a7ffff98bc63777a78ad1dbd88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sat, 18 Apr 2009 14:22:28 +0000 Subject: [PATCH] removed non applicable completion (linux, bsd) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30238 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- data/etc/bash_completion | 3955 +------------------------------------- 1 file changed, 10 insertions(+), 3945 deletions(-) diff --git a/data/etc/bash_completion b/data/etc/bash_completion index 5f07ed9fa3..959e621846 100644 --- a/data/etc/bash_completion +++ b/data/etc/bash_completion @@ -83,30 +83,17 @@ complete -f -X '!*.@(zip|ZIP|jar|JAR|exe|EXE|pk3|war|wsz|ear|zargo|xpi|sxw|ott)' complete -f -X '*.Z' compress znew complete -f -X '!*.@(Z|gz|tgz|Gz|dz)' gunzip zcmp zdiff zcat zegrep zfgrep zgrep zless zmore complete -f -X '!*.Z' uncompress -complete -f -X '!*.@(gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' ee display -complete -f -X '!*.@(gif|jp?(e)g|tif?(f)|png|p[bgp]m|bmp|x[bp]m|rle|rgb|pcx|fits|pm|GIF|JPG|JP?(E)G|TIF?(F)|PNG|P[BGP]M|BMP|X[BP]M|RLE|RGB|PCX|FITS|PM)' xv qiv complete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview complete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi complete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype kdvi dvipdf advi complete -f -X '!*.@(pdf|PDF)' acroread gpdf xpdf kpdf -complete -f -X '!*.@(@(?(e)ps|?(E)PS)?(.gz|.GZ)|pdf|PDF|gif|jp?(e)g|miff|tif?(f)|pn[gm]|p[bgp]m|bmp|xpm|ico|xwd|tga|pcx|GIF|JP?(E)G|MIFF|TIF?(F)|PN[GM]|P[BGP]M|BMP|XPM|ICO|XWD|TGA|PCX)' evince complete -f -X '!*.@(?(e)ps|?(E)PS)' ps2pdf complete -f -X '!*.texi*' makeinfo texi2html complete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi -complete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay -complete -f -X '!*.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|vcd|ps|pes|fli|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp3|MP3|ogg|OGG|ogm|OGM|mp4|MP4|wav|WAV|asx|ASX|mng|MNG)' xine aaxine fbxine kaffeine -complete -f -X '!*.@(avi|asf|wmv)' aviplay -complete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay -complete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim complete -f -X '!*.@(ogg|OGG|m3u|flac|spx)' ogg123 -complete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp -complete -f -X '!*.fig' xfig -complete -f -X '!*.@(mid?(i)|MID?(I))' playmidi -complete -f -X '!*.@(mid?(i)|MID?(I)|rmi|RMI|rcp|RCP|[gr]36|[GR]36|g18|G18|mod|MOD|xm|XM|it|IT|x3m|X3M)' timidity complete -f -X '*.@(o|so|so.!(conf)|a|t@(ar?(.@(Z|gz|bz?(2)))|gz|bz?(2))|rpm|zip|ZIP|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' vi vim gvim rvim view rview rgvim rgview gview complete -f -X '*.@(o|so|so.!(conf)|a|rpm|gif|GIF|jp?(e)g|JP?(E)G|mp3|MP3|mp?(e)g|MPG|avi|AVI|asf|ASF|ogg|OGG|class|CLASS)' emacs complete -f -X '!*.@(exe|EXE|com|COM|scr|SCR|exe.so)' wine -complete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme complete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon curl dillo elinks amaya complete -f -X '!*.@(sxw|stw|sxg|sgl|doc|dot|rtf|txt|htm|html|odt|ott|odm)' oowriter complete -f -X '!*.@(sxi|sti|pps|ppt|pot|odp|otp)' ooimpress @@ -114,7 +101,6 @@ complete -f -X '!*.@(sxc|stc|xls|xlw|xlt|csv|ods|ots)' oocalc complete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw complete -f -X '!*.@(sxm|smf|mml|odf)' oomath complete -f -X '!*.odb' oobase -complete -f -X '!*.rpm' rpm2cpio # FINISH exclude -- do not remove this line # start of section containing compspecs that can be handled within bash @@ -163,7 +149,7 @@ complete -b builtin have() { unset -v have - PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin type $1 &>/dev/null && + type $1 &>/dev/null && have="yes" } @@ -226,26 +212,7 @@ _signals() # _configured_interfaces() { - if [ -f /etc/debian_version ]; then - # Debian system - COMPREPLY=( $( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' \ - /etc/network/interfaces ) ) - elif [ -f /etc/SuSE-release ]; then - # SuSE system - COMPREPLY=( $( command ls \ - /etc/sysconfig/network/ifcfg-* | \ - sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) ) - elif [ -f /etc/pld-release ]; then - # PLD Linux - COMPREPLY=( $( command ls -B \ - /etc/sysconfig/interfaces | \ - sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) ) - else - # Assume Red Hat - COMPREPLY=( $( command ls \ - /etc/sysconfig/network-scripts/ifcfg-* | \ - sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) ) - fi + COMPREPLY=( $( ifconfig | egrep "^[/:alpha:]" | cut -d" " -f 1 ) ) } # This function completes on all available network interfaces @@ -526,48 +493,6 @@ complete -F _complete complete # start of section containing completion functions for external programs -# a little help for FreeBSD ports users -[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \ - extract patch configure build install reinstall \ - deinstall clean clean-depends kernel buildworld' make - -# This completes on a list of all available service scripts for the -# 'service' command and/or the SysV init.d directory, followed by -# that script's available commands -# -{ have service || [ -d /etc/init.d/ ]; } && -_service() -{ - local cur sysvdir - - COMPREPLY=() - prev=${COMP_WORDS[COMP_CWORD-1]} - cur=${COMP_WORDS[COMP_CWORD]} - - # don't complete for things like killall, ssh and mysql if it's - # the standalone command, rather than the init script - [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0 - - # don't complete past 2nd token - [ $COMP_CWORD -gt 2 ] && return 0 - - [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \ - || sysvdir=/etc/init.d - - if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then - _services - else - COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \ - s/^.*Usage.*{\(.*\)}.*$/\1/p" \ - $sysvdir/${prev##*/} 2>/dev/null`' -- $cur ) ) - fi - - return 0 -} && -complete -F _service service -[ -d /etc/init.d/ ] && complete -F _service $default \ - $(for i in /etc/init.d/*; do echo ${i##*/}; done) - # chown(1) completion # _chown() @@ -637,11 +562,11 @@ _umount() COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} - COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) ) + COMPREPLY=( $( compgen -W '$( df | cut -d" " -f 1 | tail -n+3 )' -- $cur ) ) return 0 } -complete -F _umount $dirnames umount +complete -F _umount $dirnames unmount # mount(8) completion. This will pull a list of possible mounts out of # /etc/{,v}fstab, unless the word being completed contains a ':', which @@ -687,64 +612,6 @@ _mount() } complete -F _mount $default $filenames mount -# Linux rmmod(8) completion. This completes on a list of all currently -# installed kernel modules. -# -have rmmod && { -_rmmod() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - COMPREPLY=( $( /sbin/lsmod | \ - awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' 2>/dev/null )) - return 0 -} -complete -F _rmmod rmmod - -# Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a -# list of all available modules for the version of the kernel currently -# running. -# -_insmod() -{ - local cur prev modpath - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - # behave like lsmod for modprobe -r - if [ $1 = "modprobe" ] && - [ "${COMP_WORDS[1]}" = "-r" ]; then - COMPREPLY=( $( /sbin/lsmod | \ - awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) ) - return 0 - fi - - # do filename completion if we're giving a path to a module - if [[ "$cur" == */* ]]; then - _filedir '@(?(k)o?(.gz))' - return 0 - fi - - if [ $COMP_CWORD -gt 1 ] && - [[ "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then - # do module parameter completion - COMPREPLY=( $( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | \ - awk '{if ($1 ~ /^parm:/ && $2 ~ /^'$cur'/) { print $2 } \ - else if ($1 !~ /:/ && $1 ~ /^'$cur'/) { print $1 }}' ) ) - else - _modules $(uname -r) - fi - - return 0 -} -complete -F _insmod $filenames insmod modprobe modinfo -} - # man(1) completion # [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \ @@ -1012,456 +879,6 @@ _find() } complete -F _find $filenames find -# Linux iwconfig(8) completion -# -[ $UNAME = Linux ] && have iwconfig && -_iwconfig() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case $prev in - mode) - COMPREPLY=( $( compgen -W 'managed ad-hoc master \ - repeater secondary monitor' -- $cur ) ) - return 0 - ;; - essid) - COMPREPLY=( $( compgen -W 'on off any' -- $cur ) ) - if [ -n "${COMP_IWLIST_SCAN:-}" ]; then - COMPREPLY=( ${COMPREPLY[@]:-} \ - $( iwlist ${COMP_WORDS[1]} scan | \ - awk -F '"' '/ESSID/ {print $2}' | \ - grep "^$cur" )) - fi - return 0 - ;; - nwid) - COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) - return 0 - ;; - channel) - COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \ - awk '/^[[:space:]]*Channel/ {print $2}' | \ - grep "^$cur" ) ) - return 0 - ;; - - freq) - COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \ - awk '/^[[:space:]]*Channel/ {print $4"G"}' | \ - grep "^$cur" ) ) - return 0 - ;; - ap) - COMPREPLY=( $( compgen -W 'on off any' -- $cur ) ) - if [ -n "${COMP_IWLIST_SCAN:-}" ]; then - COMPREPLY=( ${COMPREPLY[@]:-} \ - $( iwlist ${COMP_WORDS[1]} scan | \ - awk -F ': ' '/Address/ {print $2}' | \ - grep "^$cur" ) ) - fi - return 0 - ;; - rate) - COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) ) - COMPREPLY=( ${COMPREPLY[@]:-} \ - $( iwlist ${COMP_WORDS[1]} rate | \ - awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \ - grep "^$cur" ) ) - return 0 - ;; - rts) - COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) ) - return 0 - ;; - frag) - COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) ) - return 0 - ;; - key) - COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) ) - return 0 - ;; - enc) - COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) ) - return 0 - ;; - power) - COMPREPLY=( $( compgen -W 'period timeout off on' -- $cur ) ) - return 0 - ;; - txpower) - COMPREPLY=( $( compgen -W 'off on auto' -- $cur ) ) - return 0 - ;; - retry) - COMPREPLY=( $( compgen -W 'limit lifetime' -- $cur ) ) - return 0 - ;; - esac - - if [ $COMP_CWORD -eq 1 ]; then - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) - else - _available_interfaces -w - fi - else - COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \ - ap nick rate rts frag enc key power txpower commit' -- $cur ) ) - fi - -} && -complete -F _iwconfig iwconfig - -# Linux iwlist(8) completion -# -[ $UNAME = Linux ] && have iwlist && -_iwlist() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - if [ $COMP_CWORD -eq 1 ]; then - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) - else - _available_interfaces -w - fi - else - COMPREPLY=( $( compgen -W 'scan scanning freq frequency \ - channel rate bit bitrate key enc encryption power \ - txpower retry ap accesspoint peers event' -- $cur ) ) - fi -} && -complete -F _iwlist iwlist - -# Linux iwspy(8) completion -# -[ $UNAME = Linux ] && have iwspy && -_iwspy() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [ $COMP_CWORD -eq 1 ]; then - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) - else - _available_interfaces -w - fi - else - COMPREPLY=( $( compgen -W 'setthr getthr off' -- $cur ) ) - fi -} && -complete -F _iwspy iwspy - -# Linux iwpriv(8) completion -# -[ $UNAME = Linux ] && have iwpriv && -_iwpriv() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - roam) - COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) - return 0 - ;; - port) - COMPREPLY=( $( compgen -W 'ad-hoc managed' -- $cur ) ) - return 0 - ;; - esac - - if [ $COMP_CWORD -eq 1 ]; then - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --version' -- $cur ) ) - else - _available_interfaces -w - fi - else - COMPREPLY=( $( compgen -W '--all roam port' -- $cur ) ) - fi -} && -complete -F _iwpriv iwpriv - -# RedHat & Debian GNU/Linux if{up,down} completion -# -[ $UNAME = Linux ] && { have ifup || have ifdown; } && -_ifupdown() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [ $COMP_CWORD -eq 1 ]; then - _configured_interfaces - fi - - return 0 -} && -complete -F _ifupdown ifup ifdown -[ $UNAME = Linux ] && have ifstatus && complete -F _ifupdown ifstatus - -# Linux ipsec(8) completion (for FreeS/WAN) -# -[ $UNAME = Linux ] && have ipsec && -_ipsec() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - - if [ $COMP_CWORD -eq 1 ]; then - COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look \ - manual pluto ranbits rsasigkey \ - setup showdefaults showhostkey spi \ - spigrp tncfg whack' -- $cur ) ) - return 0 - fi - - case ${COMP_WORDS[1]} in - auto) - COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \ - --replace --down --route --unroute \ - --ready --status --rereadsecrets' \ - -- $cur ) ) - ;; - manual) - COMPREPLY=( $( compgen -W '--up --down --route --unroute \ - --union' -- $cur ) ) - ;; - ranbits) - COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \ - -- $cur ) ) - ;; - setup) - COMPREPLY=( $( compgen -W '--start --stop --restart' -- $cur ) ) - ;; - - *) - ;; - esac - - return 0 -} && -complete -F _ipsec ipsec - -# Postfix completion. -# -have postfix && { -# postfix(1) -# -_postfix() -{ - local cur prev - - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $cur == '-' ]]; then - COMPREPLY=(-c -D -v) - return 0 - fi - if [[ $prev == '-c' ]]; then - _filedir -d - return 0 - fi - if [[ $prev == '-D' ]]; then - COMPREPLY=( $( compgen -W 'start' -- "${COMP_WORDS[COMP_CWORD]}" ) ) - return 0 - fi - COMPREPLY=( $( compgen -W 'start stop reload abort flush check' -- \ - "${COMP_WORDS[COMP_CWORD]}" ) ) -} -complete -F _postfix postfix - -# postalias(1) and postmap(1) -# -_postmap() -{ - local cur prev len idx - - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $cur == '-' ]]; then - COMPREPLY=(-N -f -i -n -o -p -r -v -w -c -d -q) - return 0 - fi - if [[ $prev == '-c' ]]; then - _filedir -d - return 0 - fi - if [[ $prev == -[dq] ]]; then - return 0 - fi - - if [[ "$cur" == *:* ]]; then - COMPREPLY=( $( compgen -f -- ${cur#*:} ) ) - else - len=${#cur} - idx=0 - for pval in $( /usr/sbin/postconf -m ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]="$pval:" - idx=$(($idx+1)) - fi - done - if [[ $idx -eq 0 ]]; then - COMPREPLY=( $( compgen -f -- "$cur" ) ) - fi - fi - return 0 -} -complete -F _postmap postmap postalias - -# postcat(1) -# -_postcat() -{ - local cur prev pval len idx qfile - - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $cur == '-' ]]; then - COMPREPLY=(-c -q -v) - return 0 - fi - if [[ $prev == '-c' ]]; then - _filedir -d - return 0 - fi - - qfile=0 - for idx in ${COMP_WORDS[@]}; do - [[ "$idx" = -q ]] && qfile=1 && break - done - if [[ $qfile == 1 ]]; then - len=${#cur} - idx=0 - for pval in $( mailq | \ - sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) - fi - done - return 0 - else - _filedir - return 0 - fi -} -complete -F _postcat postcat - -# postconf(1) -# -_postconf() -{ - local cur prev pval len idx eqext - - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - if [[ $cur == '-' ]]; then - COMPREPLY=(-c -d -e -h -m -l -n -v) - return 0 - fi - if [[ $prev == '-c' ]]; then - _filedir -d - return 0 - fi - if [[ $prev == '-e' ]]; then - cur=${cur#[\"\']} - eqext='=' - fi - len=${#cur} - idx=0 - for pval in $( /usr/sbin/postconf | cut -d ' ' -f 1 ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]="$pval$eqext" - idx=$(($idx+1)) - fi - done - return 0 -} -complete -F _postconf postconf - -# postsuper(1) -# -_postsuper() -{ - local cur prev pval len idx - - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - if [[ $cur == '-' ]]; then - COMPREPLY=(-c -d -h -H -p -r -s -v) - return 0 - fi - case $prev in - -[dr]) - len=${#cur} - idx=0 - for pval in $( echo ALL; mailq | \ - sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) - fi - done - return 0 - ;; - -h) - len=${#cur} - idx=0 - for pval in $( echo ALL; mailq | \ - sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) - fi - done - return 0 - ;; - -H) - len=${#cur} - idx=0 - for pval in $( echo ALL; mailq | \ - sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do - if [[ "$cur" == "${pval:0:$len}" ]]; then - COMPREPLY[$idx]=$pval - idx=$(($idx+1)) - fi - done - return 0 - ;; - esac - COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) ) - return 0 -} -complete -F _postsuper postsuper -} - # cvs(1) completion # have cvs && { @@ -1727,607 +1144,6 @@ _cvs() complete -F _cvs $default cvs } -have rpm && { -# helper functions for rpm completion -# -_rpm_installed_packages() -{ - local ver nodig nosig - - if [ -r /var/log/rpmpkgs -a \ - /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then - # using RHL 7.2 or later - this is quicker than querying the DB - COMPREPLY=( $( sed -ne \ - 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+.*\.rpm$|\1|p' \ - /var/log/rpmpkgs ) ) - else - nodig="" - nosig="" - ver=$(rpm --version) - ver=${ver##* } - - if [[ "$ver" > "4.0.4" ]]; then - nodig="--nodigest" - fi - if [[ "$ver" > "4.0.99" ]]; then - nosig="--nosignature" - fi - - COMPREPLY=( $( rpm -qa $nodig $nosig | sed -ne \ - 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+$|\1|p' ) ) - fi -} - -_rpm_groups() -{ - local IFS=$'\t' - # remove trailing backslash, or grep will complain - cur=${cur%"\\"} - COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat '%{group}\n' | \ - grep "^$cur" ) ) - # backslash escape spaces and translate newlines to tabs - COMPREPLY=( $( echo ${COMPREPLY[@]} | sed 's/ /\\ /g' | tr '\n' '\t' ) ) -} - -# rpm(8) completion -# -_rpm() -{ - local cur prev ver nodig nosig - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - nodig="" - nosig="" - ver=$(rpm --version); ver=${ver##* } - - if [[ "$ver" > "4.0.4" ]]; then - nodig="--nodigest" - fi - if [[ "$ver" > "4.0.99" ]]; then - nosig="--nosignature" - fi - - if [ $COMP_CWORD -eq 1 ]; then - # first parameter on line - case "$cur" in - -b*) - COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs'\ - -- $cur ) ) - ;; - -t*) - COMPREPLY=( $( compgen -W '-ta -tb -tc -ti -tl -tp -ts'\ - -- $cur ) ) - ;; - --*) - COMPREPLY=( $( compgen -W '--help --version --initdb \ - --checksig --recompile --rebuild --resign --addsign \ - --rebuilddb --showrc --setperms --setugids --tarbuild \ - --eval --install --upgrade --query --freshen --erase \ - --verify --querytags --rmsource --rmspec --clean \ - --import' -- $cur ) ) - ;; - *) - COMPREPLY=( $( compgen -W '-b -e -F -i -q -t -U -V' \ - -- $cur ) ) - ;; - esac - - return 0 - fi - - case "$prev" in - --@(@(db|exclude)path|prefix|relocate|root)) - _filedir -d - return 0 - ;; - --eval) - # get a list of macros - COMPREPLY=( $( sed -ne 's|^\(%'${cur#\%}'[^ '$'\t'']*\).*$|\1|p' \ - /usr/lib/rpm/macros ) ) - return 0 - ;; - --pipe) - COMPREPLY=( $( compgen -c -- $cur ) ) - return 0 - ;; - --rcfile) - _filedir - return 0 - ;; - --specfile) - # complete on .spec files - _filedir spec - return 0 - ;; - --whatprovides) - if [[ "$cur" == */* ]]; then - _filedir - else - # complete on capabilities - COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \ - '%{providename}\n' | grep "^$cur" ) ) - fi - return 0 - ;; - --whatrequires) - # complete on capabilities - COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \ - '%{requirename}\n' | grep "^$cur" ) ) - return 0 - ;; - esac - - case "${COMP_WORDS[1]}" in - -@([iFU]*|-install|-freshen|-upgrade)) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--percent --force --test \ - --replacepkgs --replacefiles --root --excludedocs \ - --includedocs --noscripts --rcfile --ignorearch \ - --dbpath --prefix --ignoreos --nodeps --allfiles \ - --ftpproxy --ftpport --justdb --httpproxy --httpport \ - --noorder --relocate --badreloc --notriggers \ - --excludepath --ignoresize --oldpackage --define \ - --eval --pipe --queryformat --repackage --nosuggests \ - --nodigest --nosignature' -- $cur ) ) - else - _filedir 'rpm' - fi - ;; - -@(e|-erase)) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--allmatches --noscripts \ - --notriggers --nodeps --test --repackage' -- $cur ) ) - else - _rpm_installed_packages - fi - ;; - -@(q*|-query)) - # check whether we're doing file completion - if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--scripts --root \ - --rcfile --requires --ftpport --ftpproxy \ - --httpproxy --httpport --provides --triggers \ - --dump --changelog --dbpath \ - --last --filesbypkg \ - --info --list --state \ - --docfiles --configfiles --queryformat \ - --conflicts --obsoletes \ - --nodigest --nosignature \ - --triggerscripts' -- $cur ) ) - else - _filedir - fi - elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then - _rpm_groups - elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then - # uninstalled package completion - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--scripts --root \ - --rcfile --whatprovides --whatrequires \ - --requires --triggeredby --ftpport --ftpproxy \ - --httpproxy --httpport --provides --triggers \ - --dump --changelog --dbpath --filesbypkg \ - --define --eval --pipe --showrc --info --list \ - --state --docfiles --configfiles --queryformat\ - --conflicts --obsoletes --nodigest \ - --nosignature' -- $cur ) ) - else - _filedir 'rpm' - fi - else - # installed package completion - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--scripts --root \ - --rcfile --whatprovides --whatrequires \ - --requires --triggeredby --ftpport --ftpproxy \ - --httpproxy --httpport --provides --triggers \ - --dump --changelog --dbpath --specfile \ - --querybynumber --last --filesbypkg --define \ - --eval --pipe --showrc --info --list --state \ - --docfiles --configfiles --queryformat \ - --conflicts --obsoletes --pkgid --hdrid \ - --fileid --tid --nodigest --nosignature \ - --triggerscripts' -- $cur ) ) - elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then - _rpm_installed_packages - fi - fi - ;; - -@(K*|-checksig)) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--nopgp --nogpg --nomd5 \ - --nodigest --nosignature' -- $cur ) ) - else - _filedir 'rpm' - fi - ;; - -@([Vy]*|-verify)) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--root --rcfile --dbpath \ - --nodeps --nogroup --nolinkto --nomode --nomtime \ - --nordev --nouser --nofiles --noscripts --nomd5 \ - --querytags --specfile --whatrequires --whatprovides \ - --nodigest --nosignature' -- $cur ) ) - # check whether we're doing file completion - elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then - _filedir - elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then - _rpm_groups - elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then - _filedir 'rpm' - else - _rpm_installed_packages - fi - ;; - -[bt]*) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--short-circuit --timecheck \ - --clean --rmsource --rmspec --test --sign --buildroot \ - --target -- buildarch --buildos --nobuild --nodeps \ - --nodirtokens' -- $cur ) ) - elif [[ ${COMP_WORDS[1]} == -b* ]]; then - _filedir 'spec' - else - _filedir '@(tgz|tar.@(gz|bz2))' - fi - ;; - --re@(build|compile)) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--nodeps --rmsource \ - --rmspec --sign --nodirtokens --target' -- $cur ) ) - else - _filedir '?(no)src.rpm' - fi - ;; - --tarbuild) - _filedir '@(tgz|tar.@(gz|bz2))' - ;; - --@(re|add)sign) - _filedir 'rpm' - ;; - --set@(perms|gids)) - _rpm_installed_packages - ;; - --@(clean|rms@(ource|pec))) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--clean --rmsource \ - --rmspec' -- $cur ) ) - else - _filedir 'spec' - fi - ;; - --@(import|dbpath|root)) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--import --dbpath --root' \ - -- $cur ) ) - else - _filedir - fi - ;; - esac - - return 0 -} -complete -F _rpm $filenames rpm rpmbuild -} - -# Debian apt-get(8) completion. -# -have apt-get && -_apt_get() -{ - local cur prev special i - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do - if [[ ${COMP_WORDS[i]} == @(install|remove|source|build-dep) ]]; then - special=${COMP_WORDS[i]} - fi - done - - if [ -n "$special" ]; then - case $special in - remove) - if [ -f /etc/debian_version ]; then - # Debian system - COMPREPLY=( $( _comp_dpkg_installed_packages \ - $cur ) ) - else - # assume RPM based - _rpm_installed_packages - fi - return 0 - ;; - *) - COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) - return 0 - ;; - - esac - fi - - case "$prev" in - -@(c|-config-file)) - _filedir - return 0 - ;; - - -@(t|-target-release|-default-release)) - COMPREPLY=( $( apt-cache policy | \ - grep "release.o=Debian,a=$cur" | \ - sed -e "s/.*a=\(\w*\).*/\1/" | uniq ) ) - return 0 - ;; - - esac - - if [[ "$cur" == -* ]]; then - - COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y \ - -u -t -b -c -o --download-only --fix-broken \ - --help --version --ignore-missing \ - --fix-missing --no-download --quiet --simulate \ - --just-print --dry-run --recon --no-act --yes \ - --assume-yes --show-upgraded --only-source \ - --compile --build --ignore-hold \ - --target-release --no-upgrade --force-yes \ - --print-uris --purge --reinstall \ - --list-cleanup --default-release \ - --trivial-only --no-remove --diff-only \ - --tar-only --config-file --option' -- $cur ) ) - else - - COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \ - dist-upgrade install remove source build-dep \ - check clean autoclean' -- $cur ) ) - - fi - - - return 0 -} && -complete -F _apt_get $filenames apt-get - -# Debian apt-cache(8) completion. -# -have apt-cache && -_apt_cache() -{ - local cur prev special i - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - - if [ "$cur" != show ]; then - for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do - if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|policy|rdepends|show?(pkg|src|)) ]]; then - special=${COMP_WORDS[i]} - fi - done - fi - - - if [ -n "$special" ]; then - case $special in - add) - _filedir - return 0 - ;; - - *) - COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) - return 0 - ;; - - esac - fi - - - case "$prev" in - -@(c|p|s|-config-file|-@(pkg|src)-cache)) - _filedir - return 0 - ;; - search) - if [[ "$cur" != -* ]]; then - return 0 - fi - ;; - esac - - if [[ "$cur" == -* ]]; then - - COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \ - -o --help --version --pkg-cache --src-cache \ - --quiet --important --full --all-versions \ - --no-all-versions --generate --no-generate \ - --names-only --all-names --recurse \ - --config-file --option' -- $cur ) ) - else - - COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \ - stats dump dumpavail unmet search search \ - depends rdepends pkgnames dotty xvcg \ - policy' -- $cur ) ) - - fi - - - return 0 -} && -complete -F _apt_cache $filenames apt-cache - - -# Debian aptitude(1) completion -# -have aptitude && { -have grep-status && { -_comp_dpkg_hold_packages() -{ - grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package -} -} || { -_comp_dpkg_hold_packages() -{ - grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" \ - | cut -d\ -f2 -} -} - -_aptitude() -{ - local cur dashoptions prev special i - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - - dashoptions='-S -u -i -h --help --version -s --simulate -d \ - --download-only -P --prompt -y --assume-yes -F \ - --display-format -O --sort -w --width -f -r -g \ - --with-recommends --with-suggests -R -G \ - --without-recommends --without-suggests -t \ - --target-release -V --show-versions -D --show-deps\ - -Z -v --verbose' - - for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do - if [[ ${COMP_WORDS[i]} == @(install|reinstall|hold|unhold|markauto|unmarkauto|dist-upgrade|download|show|forbid-version|purge|remove) ]]; then - special=${COMP_WORDS[i]} - fi - #exclude some mutually exclusive options - [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i} - [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u} - done - - if [[ -n "$special" ]]; then - case $special in - @(install|hold|markauto|unmarkauto|dist-upgrade|download|show)) - COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) - return 0 - ;; - @(purge|remove|reinstall|forbid-version)) - COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) ) - return 0 - ;; - unhold) - COMPREPLY=( $( _comp_dpkg_hold_packages $cur ) ) - return 0 - ;; - - esac - fi - - case $prev in - # don't complete anything if these options are found - @(autoclean|clean|forget-new|search|upgrade|update)) - return 0 - ;; - - -S) - _filedir - return 0 - ;; - - -@(t|-target-release|-default-release)) - COMPREPLY=( $( apt-cache policy | \ - grep "release.o=Debian,a=$cur" | \ - sed -e "s/.*a=\(\w*\).*/\1/" | uniq ) ) - return 0 - ;; - - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) ) - else - COMPREPLY=( $( compgen -W 'update upgrade forget-new clean \ - autoclean install reinstall remove \ - hold unhold purge markauto unmarkauto \ - dist-upgrade download search show \ - forbid-version' -- $cur ) ) - fi - - - return 0 -} -complete -F _aptitude $default aptitude -} - -# Debian apt-build(1) completion. -# -have apt-build && -_apt_build() -{ - local cur prev special i - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do - if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then - special=${COMP_WORDS[i]} - fi - done - - if [ -n "$special" ]; then - case $special in - @(install|source|info)) - COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) ) - return 0 - ;; - remove) - COMPREPLY=( $( _comp_dpkg_installed_packages \ - $cur ) ) - return 0 - ;; - *) - return 0 - ;; - esac - fi - - case "$prev" in - - --@(patch|build-dir|repository-dir)) - _filedir - return 0 - ;; - - -@(h|-help)) - return 0 - ;; - - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \ - --repository-dir --build-only \ - --build-command --reinstall --rebuild \ - --remove-builddep --no-wrapper --purge \ - --patch --patch-strip -p --yes -y \ - --version -v --no-source' -- $cur ) ) - - else - COMPREPLY=( $( compgen -W 'update upgrade install remove \ - source dist-upgrade world clean info \ - clean-build update-repository ' -- $cur ) ) - fi - - - return 0 -} && -complete -F _apt_build $filenames apt-build - # chsh(1) completion # _chsh() @@ -2352,40 +1168,6 @@ _chsh() } complete -F _chsh chsh -# chkconfig(8) completion -# -have chkconfig && -_chkconfig() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - @([1-6]|--@(list|add|del))) - _services - return 0 - ;; - --level) - COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--list --add --del --level' -- $cur ) ) - else - if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then - COMPREPLY=( $( compgen -W 'on off reset' -- $cur ) ) - else - _services - fi - fi -} && -complete -F _chkconfig chkconfig - # This function provides simple user@host completion # _user_at_host() { @@ -2696,9 +1478,9 @@ _rsync() } && complete -F _rsync $nospace $filenames rsync -# Linux route(8) completion +# route(8) completion # -[ $UNAME = Linux ] && +have route && _route() { local cur prev @@ -2712,8 +1494,8 @@ _route() return 0 fi - COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \ - window irtt reject mod dyn reinstate dev \ + COMPREPLY=( $( compgen -W 'add delete list -local -host netmask mtu \ + -reject \ default gw' -- $cur ) ) COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \ @@ -2729,8 +1511,8 @@ _route() echo ${COMPREPLY[@]}) ) ) return 0 -} -[ $UNAME = Linux ] && complete -F _route route +} && +complete -F _route route # GNU make(1) completion # @@ -2921,67 +1703,6 @@ _jar() } && complete -F _jar $filenames jar -# Linux iptables(8) completion -# -have iptables && -_iptables() -{ - local cur prev table chain - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - chain='s/^Chain \([^ ]\+\).*$/\1/p' - - if [[ $COMP_LINE == *-t\ *filter* ]]; then - table="-t filter" - elif [[ $COMP_LINE == *-t\ *nat* ]]; then - table="-t nat" - elif [[ $COMP_LINE == *-t\ *mangle* ]]; then - table="-t mangle" - fi - - case "$prev" in - -*[AIDRPFXLZ]) - COMPREPLY=( $( compgen -W '`iptables $table -nL | \ - sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur ) ) - ;; - -*t) - COMPREPLY=( $( compgen -W 'nat filter mangle' -- $cur ) ) - ;; - -j) - if [ "$table" = "-t filter" -o "$table" = "" ]; then - COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ - `iptables $table -nL | sed -ne "$chain" \ - -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ - $cur ) ) - elif [ "$table" = "-t nat" ]; then - COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ - MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \ - sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \ - -- $cur ) ) - elif [ "$table" = "-t mangle" ]; then - COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \ - MARK TOS `iptables $table -nL | sed -ne "$chain" \ - -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \ - $cur ) ) - fi - ;; - *) - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \ - --delete --insert --replace --list --flush --zero --new \ - --delete-chain --policy --rename-chain --proto --source \ - --destination --in-interface --jump --match --numeric \ - --out-interface --table --verbose --line-numbers --exact \ - --fragment --modprobe= --set-counters --version' -- "$cur") ) - fi - ;; - esac - -} && -complete -F _iptables iptables - # tcpdump(8) completion # have tcpdump && @@ -3014,23 +1735,6 @@ _tcpdump() } && complete -F _tcpdump tcpdump -# autorpm(8) completion -# -have autorpm && -_autorpm() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - COMPREPLY=( $( compgen -W '--notty --debug --help --version \ - auto add fullinfo info help install list \ - remove set' -- $cur ) ) - -} && -complete -F _autorpm autorpm - # This meta-cd function observes the CDPATH variable, so that cd additionally # completes on directories under those specified in CDPATH. # @@ -4195,302 +2899,6 @@ _cardctl() } && complete -F _cardctl cardctl -# This function is required by _dpkg() and _dpkg-reconfigure() -# -have dpkg && { -have grep-status && { -_comp_dpkg_installed_packages() -{ - grep-status -P -e "^$1" -a -FStatus 'install ok installed' -n -s Package -} -} || { -_comp_dpkg_installed_packages() -{ - grep -A 2 "Package: $1" /var/lib/dpkg/status | \ - grep -B 2 'ok installed' | grep "Package: $1" | cut -d\ -f2 -} -} - -# Debian dpkg(8) completion -# -_dpkg() -{ - local cur prev i - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - i=$COMP_CWORD - - _expand || return 0 - - # find the last option flag - if [[ $cur != -* ]]; then - while [[ $prev != -* && $i != 1 ]]; do - i=$((i-1)) - prev=${COMP_WORDS[i-1]} - done - fi - - case "$prev" in - -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info| \ - fsys-tarfile|field|control|extract))) - _filedir '?(u)deb' - return 0 - ;; - -@(b|-build)) - _filedir -d - return 0 - ;; - -@(s|p|l|-@(status|print-avail|list))) - COMPREPLY=( $( apt-cache pkgnames $cur 2>/dev/null ) ) - return 0 - ;; - -@(S|-search)) - _filedir - return 0 - ;; - -@(r|L|P|-@(remove|purge|listfiles))) - COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) ) - return 0 - ;; - *) - - COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \ - --configure -r --remove -P --purge --get-selections \ - --set-selections --update-avail --merge-avail \ - --clear-avail --command-fd --forget-old-unavail -s \ - --status -p --print-avail -L --listfiles -l --list \ - -S --search -C --audit --print-architecture \ - --print-gnu-build-architecture \ - --print-installation-architecture \ - --compare-versions --help --version --force-help \ - --force-all --force-auto-select --force-downgrade \ - --force-configure-any --force-hold --force-bad-path \ - --force-not-root --force-overwrite \ - --force-overwrite-diverted --force-bad-verify \ - --force-depends-version --force-depends \ - --force-confnew --force-confold --force-confdef \ - --force-confmiss --force-conflicts --force-architecture\ - --force-overwrite-dir --force-remove-reinstreq \ - --force-remove-essential -Dh \ - --debug=help --licence --admindir= --root= --instdir= \ - -O --selected-only -E --skip-same-version \ - -G --refuse-downgrade -B --auto-deconfigure \ - --no-debsig --no-act -D --debug= --status-fd \ - -b --build -I --info -f --field -c --contents \ - -x --extract -X --vextract --fsys-tarfile -e --control \ - --ignore-depends= --abort-after' -- $cur ) ) - ;; - esac - - -} -complete -F _dpkg $filenames dpkg dpkg-deb -} - -# Debian GNU dpkg-reconfigure(8) completion -# -have dpkg-reconfigure && -_dpkg_reconfigure() -{ - local cur prev opt - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - - case "$prev" in - -@(f|-frontend)) - opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) ) - opt=( ${opt[@]##*/} ) - opt=( ${opt[@]%.pm} ) - COMPREPLY=( $( compgen -W '${opt[@]}' -- $cur ) ) - return 0 - ;; - -@(p|-priority)) - COMPREPLY=( $( compgen -W 'low medium high critical' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all \ - -u --unseen-only -h --help -s --showold \ - --force --terse' -- $cur ) ) - else - COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) ) - fi -} && -complete -F _dpkg_reconfigure $default dpkg-reconfigure - -# Debian dpkg-source completion -# -have dpkg-source && -_dpkg_source() -{ - local cur prev options work i action packopts unpackopts - - packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR" - unpackopts="-sp -sn -su" - options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo` - - COMPREPLY=() - if [ "$1" != "dpkg-source" ]; then - exit 1 - fi - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - action="options" - for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do - if [[ ${COMP_WORDS[$i]} == "-x" ]]; then - action=unpack - elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then - action=pack - elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then - action=help - fi - done - # if currently seeing a complete option, return just itself. - for i in $options; do - if [ "$cur" = "$i" ]; then - COMPREPLY=( "$cur" ) - return 0 - fi - done - case "$action" in - "unpack") - if [ "$cur" = "-" -o "$cur" = "-s" ]; then - COMPREPLY=( $unpackots ) - return 0 - fi - case "$prev" in - "-x") - COMPREPLY=( $( compgen -d -- "$cur" ) \ - $( compgen -f -X '!*.dsc' -- "$cur" ) ) - return 0 - ;; - *) - COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) ) - return 0 - ;; - esac - return 0 - ;; - "pack") - if [ "$cur" = "-" ]; then - COMPREPLY=( $packopts ) - return 0 - fi - if [ "$cur" = "-s" ]; then - COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \ - "-sA" "-sK" "-sP" "-sU" "-sR" ) - return 0 - fi - case "$prev" in - "-b") - COMPREPLY=( $( compgen -d -- "$cur" ) ) - return 0 - ;; - "-c"|"-l"|"-T"|"-i"|"-I") - # -c: get controlfile - # -l: get per-version info from this file - # -T: read variables here, not debian/substvars - # -i: filter out files to ignore diffs of. - # -I: filter out files when building tarballs. - # return directory names and file names - COMPREPLY=( $( compgen -d -f ) ) - return 0 - ;; - "-F") - # -F: force change log format - COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) ) - return 0 - ;; - "-V"|"-D") - # -V: set a substitution variable - # we don't know anything about possible variables or values - # so we don't try to suggest any completion. - COMPREPLY=() - return 0 - ;; - "-D") - # -D: override or add a .dsc field and value - # if $cur doesn't contain a = yet, suggest variable names - if echo -- "$cur" | grep -q "="; then - # $cur contains a "=" - COMPREPLY=() - return 0 - else - COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files ) - return 0 - fi - ;; - "-U") - # -U: remove a field - # Suggest possible fieldnames - COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files ) - return 0 - ;; - *) - COMPREPLY=( $packopts ) - return 0 - ;; - esac - return 0 - ;; - *) - # if seeing a partial option, return possible completions. - if [ "$cur" = "-s" ]; then - COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \ - "-sA" "-sK" "-sP" "-sU" "-sR" ) - return 0 - fi - # else return all possible options. - COMPREPLY=( $options ) - return 0 - ;; - esac -} && -complete -F _dpkg_source dpkg-source - -# Debian Linux dselect(8) completion. -# -have dselect && -_dselect() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - --admindir) - _filedir -d - return 0 - ;; - - -@(D|debug)) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--admindir --help --version --licence \ - --license --expert --debug' -- $cur ) ) - else - COMPREPLY=( $( compgen -W 'access update select install config \ - remove quit' -- $cur ) ) - fi - - - return 0 -} && -complete -F _dselect $filenames dselect - # Java completion # @@ -4914,201 +3322,6 @@ _configure_func() } complete -F _configure_func $default configure -# Debian reportbug(1) completion -# -have reportbug && -_reportbug() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -f|--filename|-i|--include|--mta|-o|--output) - _filedir - return 0 - ;; - -B|--bts) - COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \ - $cur )) - return 0 - ;; - -e|--editor|--mua) - COMP_WORDS=(COMP_WORDS[0] $cur) - COMP_CWORD=1 - _command - return 0 - ;; - --mode) - COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) ) - return 0 - ;; - -S|--severity) - COMPREPLY=( $( compgen -W "grave serious important normal \ - minor wishlist" -- $cur ) ) - return 0 - ;; - -u|--ui|--interface) - COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) ) - return 0 - ;; - -t|--type) - COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) ) - return 0 - ;; - -T|--tags) - COMPREPLY=( $( compgen -W "none patch security upstream sid \ - woody potato sarge fixed" -- $cur )) - return 0 - ;; - *) - ;; - esac - - COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \ - --no-query-bts --query-bts -B --bts -c --configure \ - --no-config-files --check-available -d --debug \ - --no-check-available -e --editor --email -f \ - --filename -g --gnupg -H --header -i --include -j \ - --justification -l --ldap --no-ldap -L --list-cc -m \ - --maintonly --mode --mua --mta --mutt -n --mh --nmh \ - -o --output -p --print -P --pgp --proxy --http_proxy\ - -q --quiet -Q --query-only --realname --report-quiet \ - --reply-to --replyto -s --subject -S --severity \ - --smtphost -t --type -T --tags --template -V -x \ - --no-cc --package-version -z --no-compress \ - --ui --interface -u \ - wnpp boot-floppies kernel-image' -- $cur ) \ - $( apt-cache pkgnames -- $cur ) ) - _filedir - return 0 -} && -complete -F _reportbug $filenames reportbug - -# Debian querybts(1) completion -# -have querybts && -_querybts() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -B|--bts) - COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \ - $cur )) - return 0 - ;; - -u|--ui|--interface) - COMPREPLY=($( compgen -W "newt text gnome" -- $cur )) - return 0 - ;; - *) - ;; - esac - - COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \ - -B --bts -l --ldap --no-ldap --proxy= --http_proxy= \ - -s --source -w --web -u --ui --interface \ - wnpp boot-floppies' -- $cur ) \ - $( apt-cache pkgnames -- $cur ) ) -} && -complete -F _querybts $filenames querybts - -# update-alternatives completion -# -have update-alternatives && { -installed_alternatives() -{ - local admindir - # find the admin dir - for i in alternatives dpkg/alternatives rpm/alternatives; do - [ -d /var/lib/$i ] && admindir=/var/lib/$i && break - done - for (( i=1; i < COMP_CWORD; i++ )); do - if [[ "${COMP_WORDS[i]}" == --admindir ]]; then - admindir=${COMP_WORDS[i+1]} - break - fi - done - COMPREPLY=( $( command ls $admindir | grep "^$cur" ) ) -} - -_update_alternatives() -{ - local cur prev mode args i - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - --@(altdir|admindir)) - _filedir -d - return 0 - ;; - --@(help|version)) - return 0 - ;; - esac - - # find wich mode to use and how many real args used so far - for (( i=1; i < COMP_CWORD; i++ )); do - if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config) ]]; then - mode=${COMP_WORDS[i]} - args=$(($COMP_CWORD - i)) - break - fi - done - - case $mode in - --install) - case $args in - 1) - _filedir - ;; - 2) - installed_alternatives - ;; - 3) - _filedir - ;; - esac - ;; - --remove) - case $args in - 1) - installed_alternatives - ;; - 2) - _filedir - ;; - esac - ;; - --auto) - installed_alternatives - ;; - --display) - installed_alternatives - ;; - --config) - installed_alternatives - ;; - *) - COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \ - --altdir --admindir' -- $cur ) \ - $( compgen -W '--install --remove --auto --display \ - --config' -- $cur ) ) - esac -} -complete -F _update_alternatives update-alternatives -} - # Python completion # have python && @@ -5316,61 +3529,6 @@ _rcs() } && complete -F _rcs $filenames ci co rlog rcs rcsdiff -# lilo(8) completion -# -have lilo && { -_lilo_labels() -{ - COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \ - /etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) ) -} - -_lilo() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case $prev in - -@(C|i|m|s|S)) - _filedir - return 0 - ;; - -r) - _filedir -d - return 0 - ;; - -@(I|D|R)) - # label completion - _lilo_labels - return 0 - ;; - -@(A|b|M|u|U)) - # device completion - cur=${cur:=/dev/} - _filedir - return 0 - ;; - -T) - # topic completion - COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \ - table= video' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - # relevant options completion - COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \ - -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \ - $cur ) ) - fi -} -complete -F _lilo lilo -} - # links completion # have links && @@ -5408,119 +3566,6 @@ _links() } && complete -F _links $filenames links -[ $UNAME = FreeBSD ] && { -# FreeBSD package management tool completion -# -_pkg_delete() -{ - local cur pkgdir prev - - pkgdir=${PKG_DBDIR:-/var/db/pkg}/ - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - [ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0 - - COMPREPLY=( $( compgen -d $pkgdir$cur ) ) - COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) - - return 0 -} -complete -F _pkg_delete $dirnames pkg_delete pkg_info -have pkg_deinstall && complete -F _pkg_delete $dirnames pkg_deinstall - -# FreeBSD kernel module commands -# -_kldload() -{ - local cur moddir - - moddir=/modules/ - [ -d $moddir ] || moddir=/boot/kernel/ - cur=${COMP_WORDS[COMP_CWORD]} - - COMPREPLY=( $( compgen -f $moddir$cur ) ) - COMPREPLY=( ${COMPREPLY[@]#$moddir} ) - COMPREPLY=( ${COMPREPLY[@]%.ko} ) - - return 0 -} -complete -F _kldload $filenames kldload - -_kldunload() -{ - local cur - cur=${COMP_WORDS[COMP_CWORD]} - COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") ) -} -complete -F _kldunload $filenames kldunload -} - -# FreeBSD portupgrade completion -# -have portupgrade && -_portupgrade() -{ - local cur pkgdir prev - - pkgdir=${PKG_DBDIR:-/var/db/pkg}/ - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0 - - COMPREPLY=( $( compgen -d $pkgdir$cur ) ) - COMPREPLY=( ${COMPREPLY[@]#$pkgdir} ) - COMPREPLY=( ${COMPREPLY[@]%-*} ) - - return 0 -} && -complete -F _portupgrade $dirnames portupgrade - -# FreeBSD portinstall completion -# -have portinstall && -_portinstall() -{ - local cur portsdir prev indexfile - local -a COMPREPLY2 - - portsdir=${PORTSDIR:-/usr/ports}/ - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - # First try INDEX-5 - indexfile=$portsdir/INDEX-5 - # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x - [ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] || - indexfile=$portsdir/INDEX - - [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0 - - COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) ) - COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \ - cut -d'|' -f2 ) ) - COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} ) - COMPREPLY=( ${COMPREPLY[@]} ${COMPREPLY2[@]} ) - - return 0 -} && -complete -F _portinstall $dirnames portinstall - -# Slackware Linux removepkg completion -# -have removepkg && [ -f /etc/slackware-version ] && -_removepkg() -{ - local packages cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) ) -} && -complete -F _removepkg $filenames removepkg && - complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg - # look(1) completion # have look && @@ -5565,356 +3610,6 @@ _ypmatch() } && complete -F _ypmatch ypmatch ypcat -# mplayer(1) completion -# -have mplayer && { -_mplayer_options_list() -{ - cur=${cur%\\} - COMPREPLY=( $( $1 $2 help 2> /dev/null | \ - sed -e '1,/^Available/d' | awk '{print $1}' | \ - sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' | \ - grep "^$cur" ) ) -} - -_mplayer() -{ - local cmd cur prev skinsdir IFS=$' \t\n' i j k=0 - - COMPREPLY=() - cmd=${COMP_WORDS[0]} - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(ac|afm|vc|vfm|ao|vo|vop|fstype)) - _mplayer_options_list mplayer $prev - return 0 - ;; - -@(oac|ovc|of)) - _mplayer_options_list mencoder $prev - return 0 - ;; - -audiofile) - _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|wav|WAV|mid|MID)' - return 0 - ;; - -font) - _filedir '@(desc|ttf)' - return 0 - ;; - -sub) - _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js)' - return 0 - ;; - -vobsub) - _filedir '@(idx|IDX|ifo|IFO|sub|SUB)' - IFS=$'\t\n' - COMPREPLY=( $( for i in ${COMPREPLY[@]}; do - if [ -f $i -a -r $i ]; then - echo ${i%.*} - else - echo $i - fi - done ) ) - IFS=$' \t\n' - return 0 - ;; - -ifo) - _filedir '@(ifo|IFO)' - return 0 - ;; - -cuefile) - _filedir '@(bin|BIN|cue|CUE)' - return 0 - ;; - -skin) - # if you don't have installed mplayer in /usr/local you - # may want to set the MPLAYER_SKINS_DIR global variable - if [ -n "$MPLAYER_SKINS_DIR" ]; then - skinsdir=$MPLAYER_SKINS_DIR - else - skinsdir=/usr/local/share/mplayer/Skin - fi - - IFS=$'\t\n' - for i in ~/.mplayer/Skin $skinsdir; do - if [ -d $i -a -r $i ]; then - for j in $( compgen -d $i/$cur ); do - COMPREPLY[$k]=${j#$i/} - k=$((++k)) - done - fi - done - IFS=$' \t\n' - return 0 - ;; - -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev)) - cur=${cur:=/dev/} - _filedir - return 0 - ;; - -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \ - -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \ - -passlogfile) - _filedir - return 0 - ;; - -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \ - -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \ - -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \ - -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \ - -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \ - -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \ - -@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \ - -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \ - -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \ - -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \ - -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \ - -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \ - -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale))) - return 0 - ;; - -lavdopts) - COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' \ - -- $cur ) ) - return 0 - ;; - -lavcopts) - COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= \ - vqmax= mbqmin= mbqmax= vqdiff= \ - vmax_b_frames= vme= vhq v4mv \ - keyint= vb_strategy= vpass= \ - aspect= vbitrate= vratetol= \ - vrc_maxrate= vrc_minrate= \ - vrc_buf_size= vb_qfactor= vi_qfactor= \ - vb_qoffset= vi_qoffset= vqblur= \ - vqcomp= vrc_eq= vrc_override= \ - vrc_init_cplx= vqsquish= vlelim= \ - vcelim= vstrict= vdpart vpsize= gray \ - vfdct= idct= lumi_mask= dark_mask= \ - tcplx_mask= scplx_mask= naq ildct \ - format= pred qpel precmp= cmp= \ - subcmp= predia= dia= trell last_pred= \ - preme= subq= psnr mpeg_quant aic umv' \ - -- $cur ) ) - return 0 - ;; - -ssf) - COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= \ - cvs=' -- $cur ) ) - return 0 - ;; - -jpeg) - COMPREPLY=( $( compgen -W 'noprogressive progressive \ - nobaseline baseline optimize= \ - smooth= quality= outdir=' -- $cur ) ) - return 0 - ;; - -xvidopts) - COMPREPLY=( $( compgen -W 'dr2 nodr2' -- $cur ) ) - return 0 - ;; - -xvidencopts) - COMPREPLY=( $( compgen -W 'pass= bitrate= \ - fixed_quant= me_quality= 4mv \ - rc_reaction_delay_factor= \ - rc_averaging_period= rc_buffer= \ - quant_range= min_key_interval= \ - max_key_interval= mpeg_quant \ - mod_quant lumi_mask hintedme \ - hintfile debug keyframe_boost= \ - kfthreshold= kfreduction=' -- $cur ) ) - return 0 - ;; - -divx4opts) - COMPREPLY=( $( compgen -W 'br= key= deinterlace q= \ - min_quant= max_quant= rc_period= \ - rc_reaction_period= crispness= \ - rc_reaction_ratio= pass= vbrpass= \ - help' -- $cur ) ) - return 0 - ;; - -info) - COMPREPLY=( $( compgen -W 'name= artist= genre= \ - subject= copyright= srcform= \ - comment= help' -- $cur ) ) - return 0 - ;; - -lameopts) - COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= \ - ratio= vol= mode= padding= fast \ - preset= help' -- $cur ) ) - return 0 - ;; - -rawaudio) - COMPREPLY=( $( compgen -W 'on channels= rate= \ - samplesize= format=' -- $cur ) ) - return 0 - ;; - -rawvideo) - COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif \ - 4cif pal ntsc w= h= y420 yv12 yuy2 \ - y8 format= size=' -- $cur ) ) - return 0 - ;; - -aop) - COMPREPLY=( $( compgen -W 'list= delay= format= fout= \ - volume= mul= softclip' -- $cur ) ) - return 0 - ;; - -dxr2) - COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded \ - iec958-decoded mute ucode= 75ire bw \ - color interlaced macrovision= norm= \ - square-pixel ccir601-pixel cr-left= \ - cr-right= cr-top= cr-bot= ck-rmin= \ - ck-gmin= ck-bmin= ck-rmax= ck-gmax= \ - ck-bmax= ck-r= ck-g= ck-b= \ - ignore-cache= ol-osd= olh-cor= \ - olw-cor= olx-cor= oly-cor= overlay \ - overlay-ratio= update-cache' -- $cur )) - return 0 - ;; - -tv) - COMPREPLY=( $( compgen -W 'on noaudio driver= device= \ - input= freq= outfmt= width= height= \ - buffersize= norm= channel= chanlist= \ - audiorate= forceaudio alsa amode= \ - forcechan= adevice= audioid= volume= \ - bass= treble= balance= fps= \ - channels= immediatemode=' -- $cur ) ) - return 0 - ;; - -mf) - COMPREPLY=( $( compgen -W 'on w= h= fps= type=' \ - -- $cur ) ) - return 0 - ;; - -cdda) - COMPREPLY=( $( compgen -W 'speed= paranoia= \ - generic-dev= sector-size= overlap= \ - toc-bias toc-offset= skip noskip' \ - -- $cur ) ) - return 0 - ;; - -input) - COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate \ - keylist cmdlist js-dev file' -- $cur ) ) - return 0 - ;; - -af) - COMPREPLY=( $( compgen -W 'resample resample= \ - channels channels= format format= \ - volume volume= delay delay= pan \ - pan= sub sub= surround surround=' \ - -- $cur ) ) - return 0 - ;; - -af-adv) - COMPREPLY=( $( compgen -W 'force= list=' -- $cur ) ) - return 0 - ;; - esac - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W '-aid -alang -audio-demuxer \ - -audiofile -cdrom-device -cache -cdda \ - -channels -chapter -csslib -demuxer \ - -dvd -dvd-device -dvdangle -dvdauth \ - -dvdkey -dvdnav -forceidx -fps -frames \ - -hr-mp3-seek -idx -mc -mf -ni -nobps \ - -passwd -rawaudio -rtsp-stream-over-tcp\ - -skipopening -sb -srate -ss -tv -user \ - -vcd -vid -vivo -ifo -ffactor -font \ - -noautosub -nooverlapsub -sid -slang \ - -sub -subcc -subcp -sub-demuxer \ - -subdelay -subfont-autoscale \ - -subfont-blur -subfont-encoding \ - -subfont-osd-scale -subfont-outline \ - -subfont-text-scale -subfps -subfile \ - -subpos -unicode -utf8 -vobsub \ - -vobsubid -ac -afm -aspect -flip \ - -lavdopts -noaspect -nosound -pp -ssf \ - -stereo -sws -vc -vfm -vop -xvidopts\ - -xy -zoom -bandwidth -cuefile \ - -noextbased -rawvideo -overlapsub \ - -sub-bg-alpha -sub-bg-color -subalign \ - -subwidth -sub-no-text-pp -spualign \ - -spuaa -spugauss -pphelp -verbose -v \ - -noni -noidx -nohr-mp3-seek -extbased \ - -bps -oldpp -nozoom -noflip -nounicode \ - -noutf8' -- $cur ) ) - # add mplayer specific options - [[ "$cmd" == @(?(g)mplayer) ]] && COMPREPLY=( ${COMPREPLY[@]} \ - $(compgen -W '-autoq -autosync -benchmark \ - -framedrop -h -help -hardframedrop \ - -identify -input -lircconf -loop \ - -nojoystick -nolirc -nortc -playlist \ - -quiet -really-quiet -rnd -sdp -skin \ - -slave -softsleep -speed -sstep \ - -use-stdin -dumpaudio -dumpfile \ - -dumpstream -dumpvideo -dumpmicrodvdsub\ - -dumpmpsub -dumpsrtsub -dumpjacosub \ - -dumpsami -dumpsub -osdlevel -af \ - -af-adv -ao -aofile -aop -delay -mixer \ - -nowaveheader -bpp -brightness \ - -contrast -display -double -dr -dxr2 \ - -fb -fbmode -fbmodeconfig -forcexv -fs \ - -geometry -hue -icelayer -jpeg \ - -monitor-dotclock -monitor-hfreq \ - -monitor-vfreq -monitoraspect \ - -nograbpointer -noslices -panscan \ - -rootwin -saturation -screenw -screenh \ - -stop-xscreensaver -vm -vo -vsync -wid \ - -xineramascreen -z -zrbw -zrcrop \ - -zrdev -zrfd -zrhelp -zrnorm -zrquality \ - -zrvdec -zrhdec -zrxdoff -zrydoff -y \ - -edl -edlout -enqueue -fixed-vo \ - -menu -menu-root -menu-cfg -shuffle \ - -format -aahelp -dfbopts -fstype \ - -guiwid -nokeepaspect -x --help \ - -aaosdcolor -aasubcolor -aadriver \ - -aaextended -aaeight' -- $cur) ) - # add mencoder specific options - [[ "$cmd" = mencoder ]] && COMPREPLY=( ${COMPREPLY[@]} \ - $(compgen -W '-audio-density -audio-delay \ - -audio-preload -divx4opts -endpos \ - -ffourcc -include -info -lameopts \ - -lavcopts -noskip -o -oac -ofps -ovc \ - -passlogfile -skiplimit -vobsubout \ - -vobsuboutindex -vobsuboutid \ - -xvidencopts -of --verbose' -- $cur) ) - ;; - *) - _filedir '@(mp?(e)g|MP?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fli|FLI|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[34]|MP[34]|og[gm]|OG[GM]|wav|WAV|dump|DUMP|mkv|MKV|m4a|M4A|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3gp|mpc|MPC|flac|FLAC)' - ;; - esac - - return 0 -} -complete $filenames -F _mplayer mplayer mencoder gmplayer kplayer -} - -# KDE dcop completion -# -have dcop && -_dcop() -{ - local cur compstr - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - if [ -z $cur ]; then - compstr=${COMP_WORDS[*]} - else - compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" ) - fi - COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- $cur ) ) -} && -complete -F _dcop dcop - # wvdial(1) completion # have wvdial && @@ -6291,97 +3986,6 @@ _mc() } && complete -F _mc $filenames mc -# yum(8) completion -# -have yum && { -_yum() -{ - local cur prev special - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do - if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist) ]]; then - special=${COMP_WORDS[i]} - fi - done - - if [ -n "$special" ]; then - case $special in - install|deplist) - COMPREPLY=( $( compgen -W '$( yum -C list | cut -d" " -f1 )' -- $cur ) ) - return 0 - ;; - *) - _rpm_installed_packages - return 0 - ;; - esac - fi - - case $cur in - --*) - COMPREPLY=( $( compgen -W '--installroot --version --help --enablerepo --disablerepo --exclude --obsoletes --noplugins' -- $cur ) ) - return 0 - ;; - -*) - COMPREPLY=( $( compgen -W '-c -e -d -y -t -R -C -h' -- $cur ) ) - return 0 - ;; - esac - - case $prev in - list) - COMPREPLY=( $( compgen -W 'all available updates installed extras obsoletes recent' -- $cur ) ) - ;; - clean) - COMPREPLY=( $( compgen -W 'packages headers metadata cache dbcache all' -- $cur ) ) - ;; - localinstall) - _filedir rpm - ;; - -c) - _filedir - ;; - --installroot) - _filedir -d - ;; - *) - COMPREPLY=( $( compgen -W 'install update check-update upgrade remove list \ - search info provides clean groupinstall groupupdate \ - grouplist deplist erase groupinfo groupremove \ - localinstall localupdate makecache resolvedep \ - shell whatprovides' -- $cur ) ) - ;; - esac -} -complete -F _yum $filenames yum - -# yum-arch(8) completion -# -_yum_arch() -{ - local cur - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - case "$cur" in - -*) - COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) ) - ;; - *) - _filedir -d - ;; - esac - - return 0 - -} -complete -F _yum_arch $filenames yum-arch -} - # ImageMagick completion # have convert && { @@ -6901,29 +4505,6 @@ _aspell() complete -F _aspell $default aspell } -# xmms(1) completion -# -have xmms && -_xmms() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \ - -u --pause -s --stop -t --play-pause -f --fwd -e \ - --enqueue -m --show-main-window -i --sm-client-id \ - -v --version' -- $cur ) ) - else - _filedir '@(mp[23]|MP[23]|ogg|OGG|wav|WAV|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)' - - fi - -} && -complete -F _xmms $filenames xmms - # info(1) completion # have info && @@ -7005,1223 +4586,6 @@ have dhclient && _dhclient() } && complete -F _dhclient dhclient -# lvm(8) completion -# -have lvm && { -_volumegroups() -{ - COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \ - sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- $cur ) ) -} - -_physicalvolumes() -{ - COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \ - sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- $cur ) ) -} - -_logicalvolumes() -{ - COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \ - sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- $cur ) ) -} - -_units() -{ - COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- $cur ) ) -} - -_sizes() -{ - COMPREPLY=( $( compgen -W 'k K m M g G t T' -- $cur ) ) -} - -_args() -{ - args=0 - if [[ "${COMP_WORDS[0]}" == lvm ]]; then - offset=2 - else - offset=1 - fi - for (( i=$offset; i < COMP_CWORD; i++ )); do - if [[ "${COMP_WORDS[i]}" != -* ]]; then - args=$(($args + 1)) - fi - done -} - -_lvmdiskscan() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -h -? --help -l \ - --lvmpartition -v --verbose --version' -- $cur ) ) - fi -} -complete -F _lvmdiskscan lvmdiskscan - -_pvscan() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -e \ - --exported -n --novolumegroup -h -? \ - --help --ignorelockingfailure -P \ - --partial -s --short -u --uuid -v \ - --verbose --version' -- $cur ) ) - fi -} -complete -F _pvscan pvscan - -_pvs() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(o|O|-options|-sort)) - COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \ - pv_size pv_free pv_used pv_name \ - pv_attr pv_pe_count \ - pv_pe_alloc_count' -- $cur ) ) - return 0 - ;; - --units) - _units - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--aligned -a --all -d --debug \ - -h -? --help --ignorelockingfailure --noheadings \ - --nosuffix -o --options -O --sort \ - --separator --unbuffered --units \ - -v --verbose --version' -- $cur ) ) - else - _physicalvolumes - fi -} -complete -F _pvs pvs - -_pvdisplay() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - --units) - _units - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \ - -v --verbose -d --debug -h --help --version' -- $cur ) ) - else - _physicalvolumes - fi -} -complete -F _pvdisplay pvdisplay - -_pvchange() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|x|-autobackup|--allocatable)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-a --all -A --autobackup \ - -d --debug -h --help -t --test -u --uuid -x \ - --allocatable -v --verbose --addtag --deltag \ - --version' -- $cur ) ) - else - _physicalvolumes - fi -} -complete -F _pvchange pvchange - -_pvcreate() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - --restorefile) - _filedir - return 0 - ;; - -@(M|-metadatatype)) - COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) - return 0 - ;; - --metadatacopies) - COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) ) - return 0 - ;; - --@(metadatasize|setphysicalvolumesize)) - _sizes - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--restorefile -d --debug -f \ - --force -h -? --help --labelsector -M --metadatatype \ - --metadatacopies --metadatasize \ - --setphysicalvolumesize -t --test -u --uuid uuid -v \ - --verbose -y --yes --version' -- $cur ) ) - else - _physicalvolumes - fi -} -complete -F _pvcreate pvcreate - -_pvmove() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - -@(n|-name)) - _logicalvolumes - return 0 - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--abort -A --autobackup \ - -b --background -d --debug -f --force -h -? \ - --help -i --interval -t --test -v --verbose \ - --version -n --name' -- $cur ) ) - else - _physicalvolumes - fi -} -complete -F _pvmove pvmove - -_pvremove() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -f --force -h -? \ - --help -y --yes -t --test -v --verbose \ - --version' -- $cur ) ) - else - _physicalvolumes - fi -} -complete -F _pvremove pvremove - -_vgscan() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -h --help \ - --ignorelockingfailure --mknodes -P \ - --partial -v --verbose --version' -- $cur ) ) - fi -} -complete -F _vgscan vgscan - -_vgs() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(o|O|-options|-sort)) - COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name \ - vg_attr vg_size vg_free vg_sysid \ - vg_extent_size vg_extent_count vg_free_count \ - max_lv max_pv pv_count lv_count snap_count \ - vg_seqno' -- $cur ) ) - return 0 - ;; - --units) - _units - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--aligned -d --debug \ - -h --help --ignorelockingfailure --noheadings \ - --nosuffix -o --options -O --sort -P --partial \ - --separator --unbuffered --units \ - -v --verbose --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgs vgs - -_vgdisplay() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - --units) - _units - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \ - -P --partial -A --activevolumegroups -v --verbose \ - -d --debug -h --help --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgdisplay vgdisplay - -_vgchange() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(a|A|x|-available|-autobackup|-resizeable)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup --alloc -P \ - --partial -d --debug -h --help --ignorelockingfailure \ - -t --test -u --uuid -v --verbose --version -a \ - --available -x --resizeable -l --logicalvolume \ - --addtag --deltag' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgchange vgchange - -_vgcreate() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - -@(M|-metadatatype)) - COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) - return 0 - ;; - -@(s|-physicalextentsize)) - _sizes - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup --addtag \ - --alloc -d --debug -h --help -l --maxlogicalvolumes \ - -M --metadatatype -p --maxphysicalvolumes -s \ - --physicalextentsize -t --test -v --verbose \ - --version' -- $cur ) ) - else - _args - if [ $args -eq 0 ]; then - _volumegroups - else - _physicalvolumes - fi - fi -} -complete -F _vgcreate vgcreate - -_vgremove() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -h --help -t --test \ - -v --verbose --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgremove vgremove - -_vgrename() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \ - -? --help -t --test -v --verbose --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgrename vgrename - -_vgreduce() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-a --all -A --autobackup -d \ - --debug -h --help --removemissing -t --test -v \ - --verbose --version' -- $cur ) ) - - else - _args - if [ $args -eq 0 ]; then - _volumegroups - else - _physicalvolumes - fi - fi -} -complete -F _vgreduce vgreduce - -_vgextend() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - -@(L|-size)) - _sizes - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \ - -? --help -t --test -v --verbose --version' -- $cur ) ) - else - _args - if [ $args -eq 0 ]; then - _volumegroups - else - _physicalvolumes - fi - fi -} -complete -F _vgextend vgextend - -_vgport() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-a --all -d --debug -h \ - -? --help -v --verbose --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgport vgimport vgexport - -_vgck() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -h \ - -? --help -v --verbose --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgck vgck - -_vgconvert() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(M|-metadatatype)) - COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) - return 0 - ;; - --metadatacopies) - COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) ) - return 0 - ;; - --metadatasize) - _sizes - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -h --help --labelsector \ - -M --metadatatype --metadatacopies --metadatasize \ - -t --test -v --verbose --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgconvert vgconvert - -_vgcfgbackup() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(f|-file)) - _filedir - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -f --file -h --help \ - --ignorelockingfailure -P --partial -v --verbose \ - --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgcfgbackup vgcfgbackup - -_vgcfgrestore() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(f|-file)) - _filedir - return 0 - ;; - -@(M|-metadatatype)) - COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) - return 0 - ;; - -@(n|-name)) - _volumegroups - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -f --file -l --list \ - -h --help -M --Metadatatype -n --name -t --test \ - -v --verbose --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgcfgrestore vgcfgrestore - -_vgmerge() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \ - -h --help -l --list -t --test -v --verbose \ - --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgmerge vgmerge - -_vgsplit() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - -@(M|-metadatatype)) - COMPREPLY=( $( compgen -W '1 2' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \ - -h --help -l --list -M --metadatatype -t --test \ - -v --verbose --version' -- $cur ) ) - else - _args - if [ $args -eq 0 -o $args -eq 1 ]; then - _volumegroups - else - _physicalvolumes - fi - fi -} -complete -F _vgsplit vgsplit - -_vgmknodes() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-d --debug -h --help -v --verbose \ - --version' -- $cur ) ) - else - _volumegroups - fi -} -complete -F _vgmknodes vgmknodes - -_lvscan() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-b --blockdevice -d --debug \ - -h -? --help --ignorelockingfailure -P \ - --partial -v --verbose --version' -- $cur ) ) - fi -} -complete -F _lvscan lvscan - -_lvs() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(o|O|-options|-sort)) - COMPREPLY=( $( compgen -W 'lv_uuid lv_name \ - lv_attr lv_minor lv_size seg_count \ - origin snap_percent segtype stripes \ - stripesize chunksize seg_start \ - seg_size' -- $cur ) ) - return 0 - ;; - --units) - _units - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--aligned -d --debug \ - -h --help --ignorelockingfailure --noheadings \ - --nosuffix -o --options -O --sort -P --partial \ - --segments --separator --unbuffered --units \ - -v --verbose --version' -- $cur ) ) - else - _logicalvolumes - fi -} -complete -F _lvs lvs - -_lvdisplay() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - --units) - _units - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \ - -P --partial -m --maps -v --verbose -d --debug -h \ - --help --version' -- $cur ) ) - else - _logicalvolumes - fi -} -complete -F _lvdisplay lvdisplay - -_lvchange() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(a|A|C|M|-available|-autobackup|-continguous|-persistent)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - -@(p|-permission)) - COMPREPLY=( $( compgen -W 'r rw' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup -a --available \ - --addtag --alloc -C --contiguous -d --debug --deltag \ - -f --force -h --help --ignorelockingfailure -M \ - --persistent --major major --minor minor -P --partial \ - -p --permission -r --readahead --refresh -t --test \ - -v --verbose --version' -- $cur ) ) - else - _logicalvolumes - fi -} -complete -F _lvchange lvchange - -_lvcreate() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - -@(L|-size)) - _sizes - return 0 - ;; - -@(p|-permission)) - COMPREPLY=( $( compgen -W 'r rw' -- $cur ) ) - return 0 - ;; - -@(n|-name)) - _logicalvolumes - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc \ - -C --contiguous -d --debug -h -? --help -i --stripes \ - -I --stripesize -l --extents -L --size -M --persistent \ - --major --minor -n --name -p --permission -r \ - --readahead -t --test --type -v --verbose -Z --zero \ - --version' -- $cur ) ) - else - _args - if [ $args -eq 0 ]; then - _volumegroups - else - _physicalvolumes - fi - fi -} -complete -F _lvcreate lvcreate - -_lvremove() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -f \ - --force -h -? --help -t --test -v --verbose \ - --version' -- $cur ) ) - else - _logicalvolumes - fi -} -complete -F _lvremove lvremove - -_lvrename() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \ - -? --help -t --test -v --verbose --version' -- $cur ) ) - else - _logicalvolumes - fi -} -complete -F _lvrename lvrename - -_lvreduce() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - -@(L|-size)) - _sizes - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup -d \ - --debug -f --force -h --help -l --extents \ - -L --size -n --nofsck -r --resizefs -t --test \ - -v --verbose --version' -- $cur ) ) - else - _logicalvolumes - fi -} -complete -F _lvreduce lvreduce - -_lvresize() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - -@(L|-size)) - _sizes - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \ - --debug -h --help -i --stripes -I --stripesize \ - -l --extents -L --size -n --nofsck -r --resizefs \ - -t --test --type -v --verbose --version' -- $cur ) ) - else - _args - if [ $args -eq 0 ]; then - _logicalvolumes - else - _physicalvolumes - fi - fi -} -complete -F _lvresize lvresize - -_lvextend() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - case "$prev" in - -@(A|-autobackup)) - COMPREPLY=( $( compgen -W 'y n' -- $cur ) ) - return 0 - ;; - -@(L|-size)) - _sizes - return 0 - ;; - esac - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \ - --debug -h --help -i --stripes -I --stripesize \ - -l --extents -L --size -n --nofsck -r --resizefs \ - -t --test --type -v --verbose --version' -- $cur ) ) - else - _args - if [ $args -eq 0 ]; then - _logicalvolumes - else - _physicalvolumes - fi - fi -} -complete -F _lvextend lvextend - -_lvm() -{ - local prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [ $COMP_CWORD -eq 1 ]; then - COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \ - lvcreate lvdisplay lvextend lvmchange \ - lvmdiskscan lvmsadc lvmsar lvreduce \ - lvremove lvrename lvresize lvs lvscan \ - pvchange pvcreate pvdata pvdisplay pvmove \ - pvremove pvresize pvs pvscan vgcfgbackup \ - vgcfgrestore vgchange vgck vgconvert \ - vgcreate vgdisplay vgexport vgextend \ - vgimport vgmerge vgmknodes vgreduce \ - vgremove vgrename vgs vgscan vgsplit \ - version' -- $cur ) ) - else - case ${COMP_WORDS[1]} in - pvchange) - _pvchange - ;; - pvcreate) - _pvcreate - ;; - pvdisplay) - _pvdisplay - ;; - pvmove) - _pvmove - ;; - pvremove) - _pvremove - ;; - pvresize) - _pvresize - ;; - pvs) - _pvs - ;; - pvscan) - _pvscan - ;; - vgcfgbackup) - _vgcfgbackup - ;; - vgcfgrestore) - _vgcfgrestore - ;; - vgchange) - _vgchange - ;; - vgck) - _vgck - ;; - vgconvert) - _vgconvert - ;; - vgcreate) - _vgcreate - ;; - vgdisplay) - _vgdisplay - ;; - vgexport) - _vgexport - ;; - vgextend) - _vgextend - ;; - vgimport) - _vgimport - ;; - vgmerge) - _vgmerge - ;; - vgmknodes) - _vgmknodes - ;; - vgreduce) - _vgreduce - ;; - vgremove) - _vgremove - ;; - vgrename) - _vgrename - ;; - vgs) - _vgs - ;; - vgscan) - _vgscan - ;; - vgsplit) - _vgsplit - ;; - lvchange) - _lvchange - ;; - lvcreate) - _lvcreate - ;; - lvdisplay) - _lvdisplay - ;; - lvextend) - _lvextend - ;; - lvreduce) - _lvreduce - ;; - lvremove) - _lvremove - ;; - lvrename) - _lvrename - ;; - lvresize) - _lvresize - ;; - lvs) - _lvs - ;; - lvscan) - _lvscan - ;; - esac - fi -} -complete -F _lvm lvm -} - -# mkinitrd(8) completion -# -have mkinitrd && -_mkinitrd() -{ - local cur args - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - # --name value style option - case "$prev" in - --preload) - _modules - return 0 - ;; - esac - - # --name=value style option - if [[ "$cur" == *=* ]]; then - prev=${cur/=*/} - cur=${cur/*=/} - case "$prev" in - --@(with|builtin)) - _modules - return 0 - ;; - --@(fstab|dsdt)) - _filedir - return 0 - ;; - --tmpdir) - _filedir -d - return 0 - ;; - esac - fi - - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--version -v -f --preload \ - --with= --omit-scsi-modules --omit-raid-modules \ - --images-version --fstab= --nocompress --builtin= \ - --nopivot --noudev --allow-missing --tmpdir= \ - --initrdfs= --dsdt= --lvm-version= --froce-usb' \ - -- $cur ) ) - else - _count_args - - case $args in - 1) - _filedir - ;; - 2) - COMPREPLY=( $( command ls /lib/modules | grep "^$cur" ) ) - ;; - esac - fi - -} && -complete -F _mkinitrd mkinitrd - -# pkgconfig(1) completion -# -have pkg-config && -_pkg_config() -{ - local cur - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - - if [[ "$cur" == -* ]]; then - # return list of available options - COMPREPLY=( $( compgen -W '-version --modversion \ - --atleast-pkgconfig-version= --libs --libs-only-l \ - --libs-only-other --libs-only-L --cflags \ - --cflags-only-I --cflags-only-othee --variable= \ - --define-variable= --exists --uninstalled \ - --atleast-version= --exact-version= --max-version= \ - --list-all --debug --print-errors --silence-errors \ - --errors-to-stdout -? --help --usage' -- $cur)) - else - COMPREPLY=( $( pkg-config --list-all 2>/dev/null | \ - awk '{print $1}' | grep "^$cur" ) ) - fi -} && -complete -F _pkg_config pkg-config - - # cpio(1) completion # have cpio && { @@ -8427,198 +4791,6 @@ _ntpdate() } && complete -F _ntpdate ntpdate -# smartctl(8) completion -# -have smartctl && { -_smartctl_quietmode() -{ - COMPREPLY=( $( compgen -W 'errorsonly silent' -- $cur ) ) -} -_smartctl_device() -{ - COMPREPLY=( $( compgen -W 'ata scsi 3ware' -- $cur ) ) -} -_smartctl_tolerance() -{ - COMPREPLY=( $( compgen -W 'warn exit ignore' -- $cur ) ) -} -_smartctl_badsum() -{ - COMPREPLY=( $( compgen -W 'normal conservative permissive verypermissive' -- $cur ) ) -} -_smartctl_report() -{ - COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- $cur ) ) -} -_smartctl_feature() -{ - COMPREPLY=( $( compgen -W 'on off' -- $cur ) ) -} -_smartctl_log() -{ - COMPREPLY=( $( compgen -W 'error selftest selective directory' -- $cur ) ) -} -_smartctl_vendorattribute() -{ - COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \ - 9,temp 192,emergencyretractcyclect 193,loadunload \ - 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \ - 200,writeerrorcount 201,detectedtacount 220,temp' -- $cur ) ) -} -_smartctl_firmwarebug() -{ - COMPREPLY=( $( compgen -W 'none samsung samsung2' -- $cur ) ) -} -_smartctl_presets() -{ - COMPREPLY=( $( compgen -W 'use ignore show showall' -- $cur ) ) -} -_smartctl_test() -{ - COMPREPLY=( $( compgen -W 'offline short long conveyance select afterselect,on afterselect,off pending' -- $cur ) ) -} - -_smartctl() -{ - local cur prev - - COMPREPLY=() - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - # --name value style option - case "$prev" in - -q) - _smartctl_quietmode - ;; - -d) - _smartctl_device - return 0 - ;; - -t) - _smartctl_tolerance - return 0 - ;; - -b) - _smartctl_badsum - return 0 - ;; - -r) - _smartctl_report - return 0 - ;; - -s) - _smartctl_feature - return 0 - ;; - -o) - _smartctl_feature - return 0 - ;; - -S) - _smartctl_feature - return 0 - ;; - -l) - _smartctl_log - return 0 - ;; - -v) - _smartctl_vendorattribute - return 0 - ;; - -F) - _smartctl_firmwarebug - return 0 - ;; - -P) - _smartctl_presets - return 0 - ;; - -t) - _smartctl_test - return 0 - ;; - esac - - # --name=value style option - if [[ "$cur" == *=* ]]; then - prev=${cur/=*/} - cur=${cur/*=/} - case "$prev" in - --quietmode) - _smartctl_quietmode - return 0 - ;; - --device) - _smartctl_device - return 0 - ;; - --tolerance) - _smartctl_tolerance - return 0 - ;; - --badsum) - _smartctl_badsum - return 0 - ;; - --report) - _smartctl_report - return 0 - ;; - --smart) - _smartctl_feature - return 0 - ;; - --offlineauto) - _smartctl_feature - return 0 - ;; - --saveauto) - _smartctl_feature - return 0 - ;; - --log) - _smartctl_log - return 0 - ;; - --vendorattribute) - _smartctl_vendorattribute - return 0 - ;; - --firmwarebug) - _smartctl_firmwarebug - return 0 - ;; - --presets) - _smartctl_presets - return 0 - ;; - --test) - _smartctl_test - return 0 - ;; - esac - fi - - - if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-h --help --usage -V --version \ - --copyright --license-i --info -a --all -q \ - --quietmode= -d --device= -T --tolerance= -b --badsum= \ - -r --report= -s --smart= -o --offlineauto= -S \ - --saveauto= -H --health -c --capabilities -A \ - --attributes -l --log= -v --vendorattribute= -F \ - --firmwarebug= -P --presets= -t --test= -C \ - --captive -X --abort' -- $cur ) ) - else - cur=${cur:=/dev/} - _filedir - fi -} -complete -F _smartctl smartctl -} - # vncviewer(1) completion # have vncviewer && @@ -8664,113 +4836,6 @@ _sysctl() } && complete -F _sysctl sysctl -# update-rc.d(8) completion -# -# Copyright (C) 2004 Servilio Afre Puentes -# -have update-rc.d && -_update_rc_d() -{ - local cur prev sysvdir services options valid_options - - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \ - || sysvdir=/etc/init.d - - services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm*)) ) - services=( ${services[@]#$sysvdir/} ) - options=( -f -n ) - - if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then - valid_options=( $( \ - echo "${COMP_WORDS[@]} ${options[@]}" \ - | tr " " "\n" \ - | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" \ - | sort | uniq -u \ - ) ) - COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \ - -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- $cur ) ) - elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then - COMPREPLY=( $( compgen -W 'remove defaults start stop' -- $cur ) ) - elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then - COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 ) - elif [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then - COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 ) - elif [[ "$prev" == defaults && -z "$cur" ]]; then - COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 s k ) - elif [[ "$prev" == ?(start|stop) ]]; then - if [[ "$cur" == [0-9] || -z "$cur" ]]; then - COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 ) - elif [[ "$cur" == [0-9][0-9] ]]; then - COMPREPLY=( $cur ) - else - COMPREPLY=() - fi - elif [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then - if [[ -z "$cur" ]]; then - if [[ $prev == [0-9][0-9] ]]; then - COMPREPLY=( 0 1 2 3 4 5 6 S ) - else - COMPREPLY=( 0 1 2 3 4 5 6 S . ) - fi - elif [[ "$cur" == [0-6S.] ]]; then - COMPREPLY=( $cur ) - else - COMPREPLY=() - fi - elif [[ "$prev" == "." ]]; then - COMPREPLY=( $(compgen -W "start stop" -- $cur) ) - else - COMPREPLY=() - fi - - return 0 -} && -complete -F _update_rc_d update-rc.d - -# invoke-rc.d(8) completion -# -# Copyright (C) 2004 Servilio Afre Puentes -# -have invoke-rc.d && -_invoke_rc_d() -{ - local cur prev sysvdir services options valid_options - - cur=${COMP_WORDS[COMP_CWORD]} - prev=${COMP_WORDS[COMP_CWORD-1]} - - [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \ - || sysvdir=/etc/init.d - - services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm*)) ) - services=( ${services[@]#$sysvdir/} ) - options=( --help --quiet --force --try-anyway --disclose-deny --query --no-fallback ) - - if [[ ($COMP_CWORD -eq 1) || ("$prev" == --* ) ]]; then - valid_options=( $( \ - echo ${COMP_WORDS[@]} ${options[@]} \ - | tr " " "\n" \ - | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" \ - | sort | uniq -u \ - ) ) - COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- \ - $cur ) ) - elif [ -x $sysvdir/$prev ]; then - COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \ - s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ - $sysvdir/$prev`' -- \ - $cur ) ) - else - COMPREPLY=() - fi - - return 0 -} && -complete -F _invoke_rc_d invoke-rc.d - # minicom(1) completion # have minicom &&