110N/A#
110N/A# This file contains an example set of shell completions that can be used with
110N/A# bash(1). These completions allow a user to complete filenames, commands
110N/A# name, command line options, and command line arguments using the [tab] key.
110N/A# The completions defined here are specific to the GNU command set, as a result
110N/A# they will provide the choice of GNU command line options in response to the
110N/A# [tab] key. For the completed options to match the command implementation,
110N/A# you may have to have /usr/gnu/bin at the head of your PATH.
110N/A#
110N/A# These completions are not included in the default bash(1) environment. To
110N/A# include them in the default environment, it is recommended that this file be
110N/A# copied to /etc/bash/bash_completion and be sourced from either a system wide
110N/A# bashrc in /etc/bash/bashrc or individual bashrcs in ~/.bashrc via
110N/A# [ -f /etc/bash/bash_completion ] && . /etc/bash/bash_completion
110N/A#
110N/A
110N/A# bash_completion - programmable completion functions for bash 3.x
110N/A# (backwards compatible with bash 2.05b)
110N/A#
110N/A# $Id: bash_completion,v 1.872 2006/03/01 16:20:18 ianmacd Exp $
110N/A#
110N/A# Copyright (C) Ian Macdonald <ian@caliban.org>
110N/A#
110N/A# This program is free software; you can redistribute it and/or modify
110N/A# it under the terms of the GNU General Public License as published by
110N/A# the Free Software Foundation; either version 2, or (at your option)
110N/A# any later version.
110N/A#
110N/A# This program is distributed in the hope that it will be useful,
110N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of
110N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110N/A# GNU General Public License for more details.
110N/A#
110N/A# You should have received a copy of the GNU General Public License
110N/A# along with this program; if not, write to the Free Software Foundation,
110N/A# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
110N/A#
110N/A# The latest version of this software can be obtained here:
110N/A#
110N/A# http://www.caliban.org/bash/index.shtml#completion
110N/A#
110N/A# RELEASE: 20060301
110N/A
110N/Aif [[ $- == *v* ]]; then
110N/A BASH_COMPLETION_ORIGINAL_V_VALUE="-v"
110N/Aelse
110N/A BASH_COMPLETION_ORIGINAL_V_VALUE="+v"
110N/Afi
110N/A
110N/Aif [[ -n $BASH_COMPLETION_DEBUG ]]; then
110N/A set -v
110N/Aelse
110N/A set +v
110N/Afi
110N/A
110N/A# Alter the following to reflect the location of this file.
110N/A#
110N/A[ -n "$BASH_COMPLETION" ] || BASH_COMPLETION=/etc/bash/bash_completion
110N/A[ -n "$BASH_COMPLETION_DIR" ] || BASH_COMPLETION_DIR=/etc/bash/bash_completion.d
110N/Areadonly BASH_COMPLETION BASH_COMPLETION_DIR
110N/A
110N/A# Set a couple of useful vars
110N/A#
110N/AUNAME=$( uname -s )
110N/A# strip OS type and version under Cygwin (e.g. CYGWIN_NT-5.1 => Cygwin)
110N/AUNAME=${UNAME/CYGWIN_*/Cygwin}
110N/ARELEASE=$( uname -r )
110N/A
110N/A# features supported by bash 2.05 and higher
110N/Aif [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} > 04 ]] ||
110N/A [ ${BASH_VERSINFO[0]} -gt 2 ]; then
110N/A declare -r bash205=$BASH_VERSION 2>/dev/null || :
110N/A default="-o default"
110N/A dirnames="-o dirnames"
110N/A filenames="-o filenames"
110N/Afi
110N/A# features supported by bash 2.05b and higher
110N/Aif [ ${BASH_VERSINFO[0]} -eq 2 ] && [[ ${BASH_VERSINFO[1]} = "05b" ]] ||
110N/A [ ${BASH_VERSINFO[0]} -gt 2 ]; then
110N/A declare -r bash205b=$BASH_VERSION 2>/dev/null || :
110N/A nospace="-o nospace"
110N/Afi
110N/A# features supported by bash 3.0 and higher
110N/Aif [ ${BASH_VERSINFO[0]} -gt 2 ]; then
110N/A declare -r bash3=$BASH_VERSION 2>/dev/null || :
110N/A bashdefault="-o bashdefault"
110N/A plusdirs="-o plusdirs"
110N/Afi
110N/A
110N/A# Turn on extended globbing and programmable completion
110N/Ashopt -s extglob progcomp
110N/A
110N/A# A lot of the following one-liners were taken directly from the
110N/A# completion examples provided with the bash 2.04 source distribution
110N/A
110N/A# Make directory commands see only directories
110N/Acomplete -d pushd
110N/A
110N/A# The following section lists completions that are redefined later
110N/A# Do NOT break these over multiple lines.
110N/A#
110N/A# START exclude -- do NOT remove this line
110N/Acomplete -f -X '!*.?(t)bz?(2)' bunzip2 bzcat bzcmp bzdiff bzegrep bzfgrep bzgrep
110N/Acomplete -f -X '!*.@(zip|ZIP|jar|JAR|exe|EXE|pk3|war|wsz|ear|zargo|xpi|sxw|ott)' unzip zipinfo
110N/Acomplete -f -X '*.Z' compress znew
110N/Acomplete -f -X '!*.@(Z|gz|tgz|Gz|dz)' gunzip zcmp zdiff zcat zegrep zfgrep zgrep zless zmore
110N/Acomplete -f -X '!*.Z' uncompress
110N/Acomplete -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
110N/Acomplete -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
110N/Acomplete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ|.bz2|.BZ2|.Z))' gv ggv kghostview
110N/Acomplete -f -X '!*.@(dvi|DVI)?(.@(gz|Z|bz2))' xdvi
110N/Acomplete -f -X '!*.@(dvi|DVI)?(.@(gz|bz2))' kdvi
110N/Acomplete -f -X '!*.@(dvi|DVI)' dvips dviselect dvitype dvipdf advi dvipdfm dvipdfmx
110N/Acomplete -f -X '!*.@(pdf|PDF)' acroread gpdf xpdf
110N/Acomplete -f -X '!*.@(?(e)ps|?(E)PS|pdf|PDF)' kpdf
110N/Acomplete -f -X '!*.@(@(?(e)ps|?(E)PS|pdf|PDF)?(.gz|.GZ)|cb(r|z)|CB(R|Z)|djv?(u)|DJV?(U)||dvi|DVI|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
110N/Acomplete -f -X '!*.@(?(e)ps|?(E)PS)' ps2pdf
110N/Acomplete -f -X '!*.texi*' makeinfo texi2html
110N/Acomplete -f -X '!*.@(?(la)tex|?(LA)TEX|texi|TEXI|dtx|DTX|ins|INS)' tex latex slitex jadetex pdfjadetex pdftex pdflatex texi2dvi
110N/Acomplete -f -X '!*.@(mp3|MP3)' mpg123 mpg321 madplay
110N/Acomplete -f -X '!*.@(mp?(e)g|MP?(E)G|wma|avi|AVI|asf|vob|VOB|bin|dat|divx|DIVX|vcd|ps|pes|fli|flv|FLV|viv|rm|ram|yuv|mov|MOV|qt|QT|wmv|mp3|MP3|m4v|M4V|ogg|OGG|ogm|OGM|mp4|MP4|wav|WAV|asx|ASX|mng|MNG|srt)' xine aaxine fbxine kaffeine
110N/Acomplete -f -X '!*.@(avi|asf|wmv)' aviplay
110N/Acomplete -f -X '!*.@(rm?(j)|ra?(m)|smi?(l))' realplay
110N/Acomplete -f -X '!*.@(mpg|mpeg|avi|mov|qt)' xanim
110N/Acomplete -f -X '!*.@(ogg|OGG|m3u|flac|spx)' ogg123
110N/Acomplete -f -X '!*.@(mp3|MP3|ogg|OGG|pls|m3u)' gqmpeg freeamp
110N/Acomplete -f -X '!*.fig' xfig
110N/Acomplete -f -X '!*.@(mid?(i)|MID?(I))' playmidi
110N/Acomplete -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
110N/Acomplete -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)' vi vim gvim rvim view rview rgvim rgview gview
110N/Acomplete -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
110N/Acomplete -f -X '!*.@(exe|EXE|com|COM|scr|SCR|exe.so)' wine
110N/Acomplete -f -X '!*.@(zip|ZIP|z|Z|gz|GZ|tgz|TGZ)' bzme
110N/Acomplete -f -X '!*.@(?([xX]|[sS])[hH][tT][mM]?([lL]))' netscape mozilla lynx opera galeon curl dillo elinks amaya
110N/Acomplete -f -X '!*.@(sxw|stw|sxg|sgl|doc|dot|rtf|txt|htm|html|odt|ott|odm)' oowriter
110N/Acomplete -f -X '!*.@(sxi|sti|pps|ppt|pot|odp|otp)' ooimpress
110N/Acomplete -f -X '!*.@(sxc|stc|xls|xlw|xlt|csv|ods|ots)' oocalc
110N/Acomplete -f -X '!*.@(sxd|std|sda|sdd|odg|otg)' oodraw
110N/Acomplete -f -X '!*.@(sxm|smf|mml|odf)' oomath
110N/Acomplete -f -X '!*.odb' oobase
110N/Acomplete -f -X '!*.rpm' rpm2cpio
110N/A# FINISH exclude -- do not remove this line
110N/A
110N/A# start of section containing compspecs that can be handled within bash
110N/A
110N/A# user commands see only users
110N/Acomplete -u su usermod userdel passwd chage write chfn groups slay w sux
110N/A
110N/A# group commands see only groups
110N/A[ -n "$bash205" ] && complete -g groupmod groupdel newgrp 2>/dev/null
110N/A
110N/A# bg completes with stopped jobs
110N/Acomplete -A stopped -P '%' bg
110N/A
110N/A# other job commands
110N/Acomplete -j -P '%' fg jobs disown
110N/A
110N/A# readonly and unset complete with shell variables
110N/Acomplete -v readonly unset
110N/A
110N/A# set completes with set options
110N/Acomplete -A setopt set
110N/A
110N/A# shopt completes with shopt options
110N/Acomplete -A shopt shopt
110N/A
110N/A# helptopics
110N/Acomplete -A helptopic help
110N/A
110N/A# unalias completes with aliases
110N/Acomplete -a unalias
110N/A
110N/A# bind completes with readline bindings (make this more intelligent)
110N/Acomplete -A binding bind
110N/A
110N/A# type and which complete on commands
110N/Acomplete -c command type which
110N/A
110N/A# builtin completes on builtins
110N/Acomplete -b builtin
110N/A
110N/A# start of section containing completion functions called by other functions
110N/A
110N/A# This function checks whether we have a given program on the system.
110N/A# No need for bulky functions in memory if we don't.
110N/A#
110N/Ahave()
110N/A{
110N/A unset -v have
110N/A PATH=/usr/gnu/bin:$PATH:/sbin:/usr/sbin type $1 &>/dev/null &&
110N/A have="yes"
110N/A}
110N/A
110N/A# use GNU sed if we have it, since its extensions are still used in our code
110N/A#
110N/A[ $UNAME != Linux ] && have gsed && alias sed=gsed
110N/A
110N/A# This function checks whether a given readline variable
110N/A# is `on'.
110N/A#
110N/A_rl_enabled()
110N/A{
110N/A [[ "$( bind -v )" = *$1+([[:space:]])on* ]]
110N/A}
110N/A
110N/A# This function shell-quotes the argument
110N/Aquote()
110N/A{
110N/A echo \'${1//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
110N/A}
110N/A
110N/A# This function quotes the argument in a way so that readline dequoting
110N/A# results in the original argument
110N/Aquote_readline()
110N/A{
110N/A local t="${1//\\/\\\\}"
110N/A echo \'${t//\'/\'\\\'\'}\' #'# Help vim syntax highlighting
110N/A}
110N/A
110N/A# This function shell-dequotes the argument
110N/Adequote()
110N/A{
110N/A eval echo "$1"
110N/A}
110N/A
110N/A
110N/A# Get the word to complete
110N/A# This is nicer than ${COMP_WORDS[$COMP_CWORD]}, since it handles cases
110N/A# where the user is completing in the middle of a word.
110N/A# (For example, if the line is "ls foobar",
110N/A# and the cursor is here --------> ^
110N/A# it will complete just "foo", not "foobar", which is what the user wants.)
110N/A_get_cword()
110N/A{
110N/A if [[ "${#COMP_WORDS[COMP_CWORD]}" -eq 0 ]] || [[ "$COMP_POINT" == "${#COMP_LINE}" ]]; then
110N/A echo "${COMP_WORDS[COMP_CWORD]}"
110N/A else
110N/A local i
110N/A local cur="$COMP_LINE"
110N/A local index="$COMP_POINT"
110N/A for (( i = 0; i <= COMP_CWORD; ++i )); do
110N/A while [[ "${#cur}" -ge ${#COMP_WORDS[i]} ]] && [[ "${cur:0:${#COMP_WORDS[i]}}" != "${COMP_WORDS[i]}" ]]; do
110N/A cur="${cur:1}"
110N/A index="$(( index - 1 ))"
110N/A done
110N/A if [[ "$i" -lt "$COMP_CWORD" ]]; then
110N/A local old_size="${#cur}"
110N/A cur="${cur#${COMP_WORDS[i]}}"
110N/A local new_size="${#cur}"
110N/A index="$(( index - old_size + new_size ))"
110N/A fi
110N/A done
110N/A
110N/A if [[ "${COMP_WORDS[COMP_CWORD]:0:${#cur}}" != "$cur" ]]; then
110N/A # We messed up! At least return the whole word so things keep working
110N/A echo "${COMP_WORDS[COMP_CWORD]}"
110N/A else
110N/A echo "${cur:0:$index}"
110N/A fi
110N/A fi
110N/A}
110N/A
110N/A
110N/A# This function performs file and directory completion. It's better than
110N/A# simply using 'compgen -f', because it honours spaces in filenames.
110N/A# If passed -d, it completes only on directories. If passed anything else,
110N/A# it's assumed to be a file glob to complete on.
110N/A#
110N/A_filedir()
110N/A{
110N/A local IFS=$'\t\n' xspec
110N/A
110N/A _expand || return 0
110N/A
110N/A local toks=( ) tmp
110N/A while read -r tmp; do
110N/A [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
110N/A done < <( compgen -d -- "$(quote_readline "$cur")" )
110N/A
110N/A if [[ "$1" != -d ]]; then
110N/A xspec=${1:+"!*.$1"}
110N/A while read -r tmp; do
110N/A [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
110N/A done < <( compgen -f -X "$xspec" -- "$(quote_readline "$cur")" )
110N/A fi
110N/A
110N/A COMPREPLY=( "${COMPREPLY[@]}" "${toks[@]}" )
110N/A}
110N/A
110N/A# This function completes on signal names
110N/A#
110N/A_signals()
110N/A{
110N/A local i
110N/A
110N/A # standard signal completion is rather braindead, so we need
110N/A # to hack around to get what we want here, which is to
110N/A # complete on a dash, followed by the signal name minus
110N/A # the SIG prefix
110N/A COMPREPLY=( $( compgen -A signal SIG${cur#-} ))
110N/A for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
110N/A COMPREPLY[i]=-${COMPREPLY[i]#SIG}
110N/A done
110N/A}
110N/A
110N/A# This function completes on configured network interfaces
110N/A#
110N/A_configured_interfaces()
110N/A{
110N/A if [ -f /etc/debian_version ]; then
110N/A # Debian system
110N/A COMPREPLY=( $( sed -ne 's|^iface \([^ ]\+\).*$|\1|p' \
110N/A /etc/network/interfaces ) )
110N/A elif [ -f /etc/SuSE-release ]; then
110N/A # SuSE system
110N/A COMPREPLY=( $( command ls \
110N/A /etc/sysconfig/network/ifcfg-* | \
110N/A sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
110N/A elif [ -f /etc/pld-release ]; then
110N/A # PLD Linux
110N/A COMPREPLY=( $( command ls -B \
110N/A /etc/sysconfig/interfaces | \
110N/A sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
110N/A else
110N/A # Assume Red Hat
110N/A COMPREPLY=( $( command ls \
110N/A /etc/sysconfig/network-scripts/ifcfg-* | \
110N/A sed -ne 's|.*ifcfg-\('$cur'.*\)|\1|p' ) )
110N/A fi
110N/A}
110N/A
110N/A# This function completes on all available network interfaces
110N/A# -a: restrict to active interfaces only
110N/A# -w: restrict to wireless interfaces only
110N/A#
110N/A_available_interfaces()
110N/A{
110N/A local cmd
110N/A
110N/A if [ "${1:-}" = -w ]; then
110N/A cmd="iwconfig"
110N/A elif [ "${1:-}" = -a ]; then
110N/A cmd="ifconfig"
110N/A else
110N/A cmd="ifconfig -a"
110N/A fi
110N/A
110N/A COMPREPLY=( $( eval $cmd 2>/dev/null | \
110N/A sed -ne 's|^\('$cur'[^[:space:][:punct:]]\{1,\}\).*$|\1|p') )
110N/A}
110N/A
110N/A# This function expands tildes in pathnames
110N/A#
110N/A_expand()
110N/A{
110N/A # FIXME: Why was this here?
110N/A # [ "$cur" != "${cur%\\}" ] && cur="$cur\\"
110N/A
110N/A # expand ~username type directory specifications
110N/A if [[ "$cur" == \~*/* ]]; then
110N/A eval cur=$cur
110N/A elif [[ "$cur" == \~* ]]; then
110N/A cur=${cur#\~}
110N/A COMPREPLY=( $( compgen -P '~' -u $cur ) )
110N/A return ${#COMPREPLY[@]}
110N/A fi
110N/A}
110N/A
110N/A# This function completes on process IDs.
110N/A# AIX and Solaris ps prefers X/Open syntax.
110N/A[ $UNAME = SunOS -o $UNAME = AIX ] &&
110N/A_pids()
110N/A{
110N/A COMPREPLY=( $( compgen -W '$( command ps -efo pid | sed 1d )' -- $cur ))
110N/A} ||
110N/A_pids()
110N/A{
110N/A COMPREPLY=( $( compgen -W '$( command ps axo pid | sed 1d )' -- $cur ) )
110N/A}
110N/A
110N/A# This function completes on process group IDs.
110N/A# AIX and SunOS prefer X/Open, all else should be BSD.
110N/A[ $UNAME = SunOS -o $UNAME = AIX ] &&
110N/A_pgids()
110N/A{
110N/A COMPREPLY=( $( compgen -W '$( command ps -efo pgid | sed 1d )' -- $cur ))
110N/A} ||
110N/A_pgids()
110N/A{
110N/A COMPREPLY=( $( compgen -W '$( command ps axo pgid | sed 1d )' -- $cur ))
110N/A}
110N/A
110N/A# This function completes on user IDs
110N/A#
110N/A_uids()
110N/A{
110N/A if type getent &>/dev/null; then
110N/A COMPREPLY=( $( getent passwd | \
110N/A awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
110N/A elif type perl &>/dev/null; then
110N/A COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($uid) = (getpwent)[2]) { print $uid . "\n" }'"'"' )' -- $cur ) )
110N/A else
110N/A # make do with /etc/passwd
110N/A COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
110N/A /etc/passwd ) )
110N/A fi
110N/A}
110N/A
110N/A# This function completes on group IDs
110N/A#
110N/A_gids()
110N/A{
110N/A if type getent &>/dev/null; then
110N/A COMPREPLY=( $( getent group | \
110N/A awk -F: '{if ($3 ~ /^'$cur'/) print $3}' ) )
110N/A elif type perl &>/dev/null; then
110N/A COMPREPLY=( $( compgen -W '$( perl -e '"'"'while (($gid) = (getgrent)[2]) { print $gid . "\n" }'"'"' )' -- $cur ) )
110N/A else
110N/A # make do with /etc/group
110N/A COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($3 ~ /^'$cur'/) print $3}'\
110N/A /etc/group ) )
110N/A fi
110N/A}
110N/A
110N/A# This function completes on services
110N/A#
110N/A_services()
110N/A{
110N/A local sysvdir famdir
110N/A [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
110N/A famdir=/etc/xinetd.d
110N/A COMPREPLY=( $( builtin echo $sysvdir/!(*.rpmsave|*.rpmorig|*~|functions)) )
110N/A
110N/A if [ -d $famdir ]; then
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( builtin echo $famdir/!(*.rpmsave|*.rpmorig|*~)) )
110N/A fi
110N/A
110N/A COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- $cur ) )
110N/A}
110N/A
110N/A# This function complete on modules
110N/A#
110N/A_modules()
110N/A{
110N/A local modpath
110N/A modpath=/lib/modules/$1
110N/A COMPREPLY=( $( command ls -R $modpath | \
110N/A sed -ne 's/^\('$cur'.*\)\.k\?o\(\|.gz\)$/\1/p') )
110N/A}
110N/A
110N/A# this function complete on user:group format
110N/A#
110N/A_usergroup()
110N/A{
110N/A local IFS=$'\n'
110N/A cur=${cur//\\\\ / }
110N/A if [[ $cur = *@(\\:|.)* ]] && [ -n "$bash205" ]; then
110N/A user=${cur%%*([^:.])}
110N/A COMPREPLY=( $(compgen -P ${user/\\\\} -g -- ${cur##*[.:]}) )
110N/A elif [[ $cur = *:* ]] && [ -n "$bash205" ]; then
110N/A COMPREPLY=( $( compgen -g -- ${cur##*[.:]} ) )
110N/A else
110N/A COMPREPLY=( $( compgen -S : -u -- $cur ) )
110N/A fi
110N/A}
110N/A
110N/A# this function count the number of mandatory args
110N/A#
110N/A_count_args()
110N/A{
110N/A args=1
110N/A for (( i=1; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" != -* ]]; then
110N/A args=$(($args+1))
110N/A fi
110N/A done
110N/A}
110N/A
110N/A# start of section containing completion functions for bash built-ins
110N/A
110N/A# bash alias completion
110N/A#
110N/A_alias()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=${COMP_WORDS[$COMP_CWORD]}
110N/A
110N/A case "$COMP_LINE" in
110N/A *[^=])
110N/A COMPREPLY=( $( compgen -A alias -S '=' -- $cur ) )
110N/A ;;
110N/A *=)
110N/A COMPREPLY=( "$( alias ${cur%=} 2>/dev/null | \
110N/A sed -e 's|^alias '$cur'\(.*\)$|\1|' )" )
110N/A ;;
110N/A esac
110N/A}
110N/Acomplete -F _alias $nospace alias
110N/A
110N/A# bash export completion
110N/A#
110N/A_export()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=${COMP_WORDS[$COMP_CWORD]}
110N/A
110N/A case "$COMP_LINE" in
110N/A *=\$*)
110N/A COMPREPLY=( $( compgen -v -P '$' -- ${cur#*=\$} ) )
110N/A ;;
110N/A *[^=])
110N/A COMPREPLY=( $( compgen -v -S '=' -- $cur ) )
110N/A ;;
110N/A *=)
110N/A COMPREPLY=( "$( eval echo -n \"$`echo ${cur%=}`\" |
110N/A ( echo -n \'
110N/A sed -e 's/'\''/'\''\\\'\'''\''/g'
110N/A echo -n \' ) )" )
110N/A ;;
110N/A esac
110N/A}
110N/Acomplete -F _export $default $nospace export
110N/A
110N/A# bash shell function completion
110N/A#
110N/A_function()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [[ $1 == @(declare|typeset) ]]; then
110N/A if [ "$prev" = -f ]; then
110N/A COMPREPLY=( $( compgen -A function -- $cur ) )
110N/A elif [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \
110N/A $cur ) )
110N/A fi
110N/A elif [ $COMP_CWORD -eq 1 ]; then
110N/A COMPREPLY=( $( compgen -A function -- $cur ) )
110N/A else
110N/A COMPREPLY=( "() $( type -- ${COMP_WORDS[1]} | sed -e 1,2d )" )
110N/A fi
110N/A}
110N/Acomplete -F _function function declare typeset
110N/A
110N/A# bash complete completion
110N/A#
110N/A_complete()
110N/A{
110N/A local cur prev options
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case $prev in
110N/A -o)
110N/A options="default dirnames filenames"
110N/A [ -n "$bash205b" ] && options="$options nospace"
110N/A [ -n "$bash3" ] && options="$options bashdefault plusdirs"
110N/A COMPREPLY=( $( compgen -W "$options" -- $cur ) )
110N/A return 0
110N/A ;;
110N/A
110N/A -A)
110N/A COMPREPLY=( $( compgen -W 'alias arrayvar binding \
110N/A builtin command directory disabled enabled \
110N/A export file function group helptopic hostname \
110N/A job keyword running service setopt shopt \
110N/A signal stopped user variable' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A
110N/A -C)
110N/A COMPREPLY=( $( compgen -A command -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -F)
110N/A COMPREPLY=( $( compgen -A function -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(p|r))
110N/A COMPREPLY=( $( complete -p | sed -e 's|.* ||' | \
110N/A grep "^$cur" ) )
110N/A return 0
110N/A ;;
110N/A
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # relevant options completion
110N/A options="-a -b -c -d -e -f -g -j -k -s -v -u -A -G -W -P -S -X -F -C"
110N/A [ -n "$bash205" ] && options="$options -o"
110N/A COMPREPLY=( $( compgen -W "$options" -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -A command -- $cur ) )
110N/A fi
110N/A}
110N/Acomplete -F _complete complete
110N/A
110N/A# start of section containing completion functions for external programs
110N/A
110N/A# a little help for FreeBSD ports users
110N/A[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \
110N/A extract patch configure build install reinstall \
110N/A deinstall clean clean-depends kernel buildworld' make
110N/A
110N/A# This completes on a list of all available service scripts for the
110N/A# 'service' command and/or the SysV init.d directory, followed by
110N/A# that script's available commands
110N/A#
110N/A{ have service || [ -d /etc/init.d/ ]; } &&
110N/A_service()
110N/A{
110N/A local cur sysvdir
110N/A
110N/A COMPREPLY=()
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A cur=`_get_cword`
110N/A
110N/A # don't complete for things like killall, ssh and mysql if it's
110N/A # the standalone command, rather than the init script
110N/A [[ ${COMP_WORDS[0]} != @(*init.d/!(functions|~)|service) ]] && return 0
110N/A
110N/A # don't complete past 2nd token
110N/A [ $COMP_CWORD -gt 2 ] && return 0
110N/A
110N/A [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
110N/A || sysvdir=/etc/init.d
110N/A
110N/A if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
110N/A _services
110N/A else
110N/A COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
110N/A s/^.*Usage.*{\(.*\)}.*$/\1/p" \
110N/A $sysvdir/${prev##*/} 2>/dev/null`' -- $cur ) )
110N/A fi
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _service service
110N/A[ -d /etc/init.d/ ] && complete -F _service $default \
110N/A $(for i in /etc/init.d/*; do echo ${i##*/}; done)
110N/A
110N/A# chown(1) completion
110N/A#
110N/A_chown()
110N/A{
110N/A local cur
110N/A cur=`_get_cword`
110N/A
110N/A # options completion
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
110N/A --dereference --no-dereference --from= --silent --quiet \
110N/A --reference= --recursive --verbose --help --version' -- $cur ) )
110N/A else
110N/A _count_args
110N/A
110N/A case $args in
110N/A 1)
110N/A _usergroup
110N/A ;;
110N/A *)
110N/A _filedir
110N/A ;;
110N/A esac
110N/A fi
110N/A}
110N/Acomplete -F _chown $filenames chown
110N/A
110N/A# chgrp(1) completion
110N/A#
110N/A_chgrp()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A cur=${cur//\\\\/}
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A # options completion
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-c -h -f -R -v --changes \
110N/A --dereference --no-dereference --silent --quiet \
110N/A --reference= --recursive --verbose --help --version' -- $cur ) )
110N/A return 0
110N/A fi
110N/A
110N/A # first parameter on line or first since an option?
110N/A if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
110N/A [[ "$prev" == -* ]] && [ -n "$bash205" ]; then
110N/A local IFS=$'\n'
110N/A COMPREPLY=( $( compgen -g $cur 2>/dev/null ) )
110N/A else
110N/A _filedir || return 0
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _chgrp $filenames chgrp
110N/A
110N/A# umount(8) completion. This relies on the mount point being the third
110N/A# space-delimited field in the output of mount(8)
110N/A#
110N/A_umount()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A OLDIFS="$IFS"
110N/A IFS="\n"
110N/A COMPREPLY=( $( compgen -W '$( mount | cut -d" " -f 3 )' -- $cur ) )
110N/A IFS="$OLDIFS"
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _umount $dirnames umount
110N/A
110N/A# mount(8) completion. This will pull a list of possible mounts out of
110N/A# /etc/{,v}fstab, unless the word being completed contains a ':', which
110N/A# would indicate the specification of an NFS server. In that case, we
110N/A# query the server for a list of all available exports and complete on
110N/A# that instead.
110N/A#
110N/A_mount()
110N/A{ local cur i sm host
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A [[ "$cur" == \\ ]] && cur="/"
110N/A
110N/A for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
110N/A
110N/A if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then
110N/A COMPREPLY=( $( $sm -e ${cur%%:*} | sed 1d | \
110N/A grep ^${cur#*:} | awk '{print $1}' ) )
110N/A elif [[ "$cur" == //* ]]; then
110N/A host=${cur#//}
110N/A host=${host%%/*}
110N/A if [ -n "$host" ]; then
110N/A COMPREPLY=( $( compgen -W "$( echo $( smbclient -d 0 -NL $host 2>/dev/null|
110N/A sed -ne '/^['"$'\t '"']*Sharename/,/^$/p' |
110N/A sed -ne '3,$s|^[^A-Za-z]*\([^'"$'\t '"']*\).*$|//'$host'/\1|p' ) )" -- "$cur" ) )
110N/A fi
110N/A elif [ -r /etc/vfstab ]; then
110N/A # Solaris
110N/A COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
110N/A /etc/vfstab | grep "^$cur" ) )
110N/A elif [ ! -e /etc/fstab ]; then
110N/A # probably Cygwin
110N/A COMPREPLY=( $( mount | awk '! /^[ \t]*#/ {if ($3 ~ /\//) print $3}' \
110N/A | grep "^$cur" ) )
110N/A else
110N/A # probably Linux
110N/A COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' \
110N/A /etc/fstab | grep "^$cur" ) )
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _mount $default $filenames mount
110N/A
110N/A# Linux rmmod(8) completion. This completes on a list of all currently
110N/A# installed kernel modules.
110N/A#
110N/Ahave rmmod && {
110N/A_rmmod()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A COMPREPLY=( $( /sbin/lsmod | \
110N/A awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' 2>/dev/null ))
110N/A return 0
110N/A}
110N/Acomplete -F _rmmod rmmod
110N/A
110N/A# Linux insmod(8), modprobe(8) and modinfo(8) completion. This completes on a
110N/A# list of all available modules for the version of the kernel currently
110N/A# running.
110N/A#
110N/A_insmod()
110N/A{
110N/A local cur prev modpath
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A # behave like lsmod for modprobe -r
110N/A if [ $1 = "modprobe" ] &&
110N/A [ "${COMP_WORDS[1]}" = "-r" ]; then
110N/A COMPREPLY=( $( /sbin/lsmod | \
110N/A awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) )
110N/A return 0
110N/A fi
110N/A
110N/A # do filename completion if we're giving a path to a module
110N/A if [[ "$cur" == */* ]]; then
110N/A _filedir '@(?(k)o?(.gz))'
110N/A return 0
110N/A fi
110N/A
110N/A if [ $COMP_CWORD -gt 1 ] &&
110N/A [[ "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then
110N/A # do module parameter completion
110N/A COMPREPLY=( $( /sbin/modinfo -p ${COMP_WORDS[1]} 2>/dev/null | \
110N/A awk '{if ($1 ~ /^parm:/ && $2 ~ /^'$cur'/) { print $2 } \
110N/A else if ($1 !~ /:/ && $1 ~ /^'$cur'/) { print $1 }}' ) )
110N/A else
110N/A _modules $(uname -r)
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _insmod $filenames insmod modprobe modinfo
110N/A}
110N/A
110N/A# man(1) completion
110N/A#
110N/A[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \
110N/A -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
110N/A -o $UNAME = OpenBSD ] &&
110N/A_man()
110N/A{
110N/A local cur prev sect manpath UNAME
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A _expand || return 0
110N/A
110N/A # default completion if parameter contains /
110N/A if [[ "$cur" == */* ]]; then
110N/A _filedir
110N/A return 0
110N/A fi
110N/A
110N/A UNAME=$( uname -s )
110N/A # strip OS type and version under Cygwin
110N/A UNAME=${UNAME/CYGWIN_*/Cygwin}
110N/A if [ $UNAME = GNU -o $UNAME = Linux -o $UNAME = FreeBSD \
110N/A -o $UNAME = Cygwin ]; then
110N/A manpath=$( manpath 2>/dev/null || command man --path )
110N/A else
110N/A manpath=$MANPATH
110N/A fi
110N/A
110N/A if [ -z "$manpath" ]; then
110N/A COMPREPLY=( $( compgen -c -- $cur ) )
110N/A return 0
110N/A fi
110N/A
110N/A # determine manual section to search
110N/A [[ "$prev" == [0-9ln] ]] && sect=$prev || sect='*'
110N/A
110N/A manpath=$manpath:
110N/A if [ -n "$cur" ]; then
110N/A manpath="${manpath//://*man$sect/$cur* } ${manpath//://*cat$sect/$cur* }"
110N/A else
110N/A manpath="${manpath//://*man$sect/ } ${manpath//://*cat$sect/ }"
110N/A fi
110N/A
110N/A # redirect stderr for when path doesn't exist
110N/A COMPREPLY=( $( eval command ls "$manpath" 2>/dev/null ) )
110N/A # weed out directory path names and paths to man pages
110N/A COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
110N/A # strip suffix from man pages
110N/A COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2)} )
110N/A COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
110N/A
110N/A [[ "$prev" != [0-9ln] ]] && _filedir '[0-9ln]'
110N/A
110N/A return 0
110N/A}
110N/A[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \
110N/A -o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \
110N/A -o $UNAME = OpenBSD ] && \
110N/Acomplete -F _man $filenames man apropos whatis
110N/A
110N/A# renice(8) completion
110N/A#
110N/A_renice()
110N/A{
110N/A local command cur curopt i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A command=$1
110N/A
110N/A i=0
110N/A # walk back through command line and find last option
110N/A while [ $i -le $COMP_CWORD -a ${#COMPREPLY[@]} -eq 0 ]; do
110N/A curopt=${COMP_WORDS[COMP_CWORD-$i]}
110N/A case "$curopt" in
110N/A -u)
110N/A COMPREPLY=( $( compgen -u -- $cur ) )
110N/A ;;
110N/A -g)
110N/A _pgids
110N/A ;;
110N/A -p|$command)
110N/A _pids
110N/A ;;
110N/A esac
110N/A i=$(( ++i ))
110N/A done
110N/A}
110N/Acomplete -F _renice renice
110N/A
110N/A# kill(1) completion
110N/A#
110N/A_kill()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
110N/A # return list of available signals
110N/A _signals
110N/A else
110N/A # return list of available PIDs
110N/A _pids
110N/A fi
110N/A}
110N/Acomplete -F _kill kill
110N/A
110N/A# Linux and FreeBSD killall(1) completion.
110N/A#
110N/A[ $UNAME = Linux -o $UNAME = FreeBSD ] &&
110N/A_killall()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
110N/A _signals
110N/A else
110N/A COMPREPLY=( $( compgen -W '$( command ps axo command | \
110N/A sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | \
110N/A sed -e "s/.*\///" )' -- $cur ) )
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/A[ $UNAME = Linux -o $UNAME = FreeBSD ] && complete -F _killall killall pkill
110N/A
110N/A# Linux and FreeBSD pgrep(1) completion.
110N/A#
110N/A[ $UNAME = Linux -o $UNAME = FreeBSD ] &&
110N/A_pgrep()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A COMPREPLY=( $( compgen -W '$( command ps axo command | \
110N/A sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | \
110N/A sed -e "s/.*\///" )' -- $cur ) )
110N/A
110N/A return 0
110N/A}
110N/A[ $UNAME = Linux -o $UNAME = FreeBSD ] && complete -F _pgrep pgrep
110N/A# Linux pidof(8) completion.
110N/A[ $UNAME = Linux ] && complete -F _pgrep pidof
110N/A
110N/A# GNU find(1) completion. This makes heavy use of ksh style extended
110N/A# globs and contains Linux specific code for completing the parameter
110N/A# to the -fstype option.
110N/A#
110N/A_find()
110N/A{
110N/A local cur prev i exprfound onlyonce
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(max|min)depth)
110N/A COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -?(a|c)newer|-fls|-fprint?(0|f)|-?(i)?(l)name|-?(i)wholename)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -fstype)
110N/A # this is highly non-portable
110N/A [ -e /proc/filesystems ] &&
110N/A COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | \
110N/A grep "^$cur" ) )
110N/A return 0
110N/A ;;
110N/A -gid)
110N/A _gids
110N/A return 0
110N/A ;;
110N/A -group)
110N/A if [ -n "$bash205" ]; then
110N/A COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
110N/A fi
110N/A return 0
110N/A ;;
110N/A -?(x)type)
110N/A COMPREPLY=( $( compgen -W 'b c d p f l s' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -uid)
110N/A _uids
110N/A return 0
110N/A ;;
110N/A -user)
110N/A COMPREPLY=( $( compgen -u -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -exec|-ok)
110N/A COMP_WORDS=(COMP_WORDS[0] $cur)
110N/A COMP_CWORD=1
110N/A _command
110N/A return 0
110N/A ;;
110N/A -[acm]min|-[acm]time|-?(i)?(l)name|-inum|-?(i)path|-?(i)regex| \
110N/A -links|-perm|-size|-used|-printf)
110N/A # do nothing, just wait for a parameter to be given
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A _expand || return 0
110N/A
110N/A # set exprfound to 1 if there is already an expression present
110N/A for i in ${COMP_WORDS[@]}; do
110N/A [[ "$i" = [-\(\),\!]* ]] && exprfound=1 && break
110N/A done
110N/A
110N/A # handle case where first parameter is not a dash option
110N/A if [ "$exprfound" != 1 ] && [[ "$cur" != [-\(\),\!]* ]]; then
110N/A _filedir -d
110N/A return 0
110N/A fi
110N/A
110N/A # complete using basic options
110N/A COMPREPLY=( $( compgen -W '-daystart -depth -follow -help -maxdepth \
110N/A -mindepth -mount -noleaf -version -xdev -amin -anewer \
110N/A -atime -cmin -cnewer -ctime -empty -false -fstype \
110N/A -gid -group -ilname -iname -inum -ipath -iregex \
110N/A -wholename \
110N/A -links -lname -mmin -mtime -name -newer -nouser \
110N/A -nogroup -perm -regex -size -true -type -uid -used \
110N/A -user -xtype -exec -fls -fprint -fprint0 -fprintf -ok \
110N/A -print -print0 -printf -prune -ls' -- $cur ) )
110N/A
110N/A # this removes any options from the list of completions that have
110N/A # already been specified somewhere on the command line, as long as
110N/A # these options can only be used once (in a word, "options", in
110N/A # opposition to "tests" and "actions", as in the find(1) manpage).
110N/A onlyonce=' -daystart -depth -follow -help -maxdepth -mindepth -mount \
110N/A -noleaf -version -xdev '
110N/A COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \
110N/A (while read -d ' ' i; do
110N/A [ "$i" == "" ] ||
110N/A [ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] &&
110N/A continue
110N/A # flatten array with spaces on either side,
110N/A # otherwise we cannot grep on word boundaries of
110N/A # first and last word
110N/A COMPREPLY=" ${COMPREPLY[@]} "
110N/A # remove word from list of completions
110N/A COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
110N/A done
110N/A echo "${COMPREPLY[@]}")
110N/A ) )
110N/A
110N/A _filedir
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _find $filenames find
110N/A
110N/A# Linux iwconfig(8) completion
110N/A#
110N/A[ $UNAME = Linux ] && have iwconfig &&
110N/A_iwconfig()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case $prev in
110N/A mode)
110N/A COMPREPLY=( $( compgen -W 'managed ad-hoc master \
110N/A repeater secondary monitor' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A essid)
110N/A COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
110N/A if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
110N/A COMPREPLY=( "${COMPREPLY[@]}" \
110N/A $( iwlist ${COMP_WORDS[1]} scan | \
110N/A awk -F '"' '/ESSID/ {print $2}' | \
110N/A grep "^$cur" ))
110N/A fi
110N/A return 0
110N/A ;;
110N/A nwid)
110N/A COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A channel)
110N/A COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
110N/A awk '/^[[:space:]]*Channel/ {print $2}' | \
110N/A grep "^$cur" ) )
110N/A return 0
110N/A ;;
110N/A
110N/A freq)
110N/A COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
110N/A awk '/^[[:space:]]*Channel/ {print $4"G"}' | \
110N/A grep "^$cur" ) )
110N/A return 0
110N/A ;;
110N/A ap)
110N/A COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
110N/A if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
110N/A COMPREPLY=( "${COMPREPLY[@]}" \
110N/A $( iwlist ${COMP_WORDS[1]} scan | \
110N/A awk -F ': ' '/Address/ {print $2}' | \
110N/A grep "^$cur" ) )
110N/A fi
110N/A return 0
110N/A ;;
110N/A rate)
110N/A COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) )
110N/A COMPREPLY=( "${COMPREPLY[@]}" \
110N/A $( iwlist ${COMP_WORDS[1]} rate | \
110N/A awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \
110N/A grep "^$cur" ) )
110N/A return 0
110N/A ;;
110N/A rts)
110N/A COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A frag)
110N/A COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A key)
110N/A COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A enc)
110N/A COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A power)
110N/A COMPREPLY=( $( compgen -W 'period timeout off on' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A txpower)
110N/A COMPREPLY=( $( compgen -W 'off on auto' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A retry)
110N/A COMPREPLY=( $( compgen -W 'limit lifetime' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
110N/A else
110N/A _available_interfaces -w
110N/A fi
110N/A else
110N/A COMPREPLY=( $( compgen -W 'essid nwid mode freq channel sens mode \
110N/A ap nick rate rts frag enc key power txpower commit' -- $cur ) )
110N/A fi
110N/A
110N/A} &&
110N/Acomplete -F _iwconfig iwconfig
110N/A
110N/A# Linux iwlist(8) completion
110N/A#
110N/A[ $UNAME = Linux ] && have iwlist &&
110N/A_iwlist()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
110N/A else
110N/A _available_interfaces -w
110N/A fi
110N/A else
110N/A COMPREPLY=( $( compgen -W 'scan scanning freq frequency \
110N/A channel rate bit bitrate key enc encryption power \
110N/A txpower retry ap accesspoint peers event' -- $cur ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _iwlist iwlist
110N/A
110N/A# Linux iwspy(8) completion
110N/A#
110N/A[ $UNAME = Linux ] && have iwspy &&
110N/A_iwspy()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
110N/A else
110N/A _available_interfaces -w
110N/A fi
110N/A else
110N/A COMPREPLY=( $( compgen -W 'setthr getthr off' -- $cur ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _iwspy iwspy
110N/A
110N/A# Linux iwpriv(8) completion
110N/A#
110N/A[ $UNAME = Linux ] && have iwpriv &&
110N/A_iwpriv()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A roam)
110N/A COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A port)
110N/A COMPREPLY=( $( compgen -W 'ad-hoc managed' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--help --version' -- $cur ) )
110N/A else
110N/A _available_interfaces -w
110N/A fi
110N/A else
110N/A COMPREPLY=( $( compgen -W '--all roam port' -- $cur ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _iwpriv iwpriv
110N/A
110N/A# RedHat & Debian GNU/Linux if{up,down} completion
110N/A#
110N/A[ $UNAME = Linux ] && { have ifup || have ifdown; } &&
110N/A_ifupdown()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A _configured_interfaces
110N/A COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- "$cur") )
110N/A fi
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _ifupdown ifup ifdown
110N/A[ $UNAME = Linux ] && have ifstatus && complete -F _ifupdown ifstatus
110N/A
110N/A# Linux ipsec(8) completion (for FreeS/WAN)
110N/A#
110N/A[ $UNAME = Linux ] && have ipsec &&
110N/A_ipsec()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look \
110N/A manual pluto ranbits rsasigkey \
110N/A setup showdefaults showhostkey spi \
110N/A spigrp tncfg whack' -- $cur ) )
110N/A return 0
110N/A fi
110N/A
110N/A case ${COMP_WORDS[1]} in
110N/A auto)
110N/A COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
110N/A --replace --down --route --unroute \
110N/A --ready --status --rereadsecrets' \
110N/A -- $cur ) )
110N/A ;;
110N/A manual)
110N/A COMPREPLY=( $( compgen -W '--up --down --route --unroute \
110N/A --union' -- $cur ) )
110N/A ;;
110N/A ranbits)
110N/A COMPREPLY=( $( compgen -W '--quick --continuous --bytes' \
110N/A -- $cur ) )
110N/A ;;
110N/A setup)
110N/A COMPREPLY=( $( compgen -W '--start --stop --restart' -- $cur ) )
110N/A ;;
110N/A
110N/A *)
110N/A ;;
110N/A esac
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _ipsec ipsec
110N/A
110N/A# Postfix completion.
110N/A#
110N/Ahave postfix && {
110N/A# postfix(1)
110N/A#
110N/A_postfix()
110N/A{
110N/A local cur prev
110N/A
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [[ $cur == '-' ]]; then
110N/A COMPREPLY=(-c -D -v)
110N/A return 0
110N/A fi
110N/A if [[ $prev == '-c' ]]; then
110N/A _filedir -d
110N/A return 0
110N/A fi
110N/A if [[ $prev == '-D' ]]; then
110N/A COMPREPLY=( $( compgen -W 'start' -- "`get_cword`" ) )
110N/A return 0
110N/A fi
110N/A COMPREPLY=( $( compgen -W 'start stop reload abort flush check' -- \
110N/A "`get_cword`" ) )
110N/A}
110N/Acomplete -F _postfix postfix
110N/A
110N/A# postalias(1) and postmap(1)
110N/A#
110N/A_postmap()
110N/A{
110N/A local cur prev len idx
110N/A
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [[ $cur == '-' ]]; then
110N/A COMPREPLY=(-N -f -i -n -o -p -r -v -w -c -d -q)
110N/A return 0
110N/A fi
110N/A if [[ $prev == '-c' ]]; then
110N/A _filedir -d
110N/A return 0
110N/A fi
110N/A if [[ $prev == -[dq] ]]; then
110N/A return 0
110N/A fi
110N/A
110N/A if [[ "$cur" == *:* ]]; then
110N/A COMPREPLY=( $( compgen -f -- ${cur#*:} ) )
110N/A else
110N/A len=${#cur}
110N/A idx=0
110N/A for pval in $( /usr/sbin/postconf -m ); do
110N/A if [[ "$cur" == "${pval:0:$len}" ]]; then
110N/A COMPREPLY[$idx]="$pval:"
110N/A idx=$(($idx+1))
110N/A fi
110N/A done
110N/A if [[ $idx -eq 0 ]]; then
110N/A COMPREPLY=( $( compgen -f -- "$cur" ) )
110N/A fi
110N/A fi
110N/A return 0
110N/A}
110N/Acomplete -F _postmap postmap postalias
110N/A
110N/A# postcat(1)
110N/A#
110N/A_postcat()
110N/A{
110N/A local cur prev pval len idx qfile
110N/A
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [[ $cur == '-' ]]; then
110N/A COMPREPLY=(-c -q -v)
110N/A return 0
110N/A fi
110N/A if [[ $prev == '-c' ]]; then
110N/A _filedir -d
110N/A return 0
110N/A fi
110N/A
110N/A qfile=0
110N/A for idx in "${COMP_WORDS[@]}"; do
110N/A [[ "$idx" = -q ]] && qfile=1 && break
110N/A done
110N/A if [[ $qfile == 1 ]]; then
110N/A len=${#cur}
110N/A idx=0
110N/A for pval in $( mailq | \
110N/A sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
110N/A if [[ "$cur" == "${pval:0:$len}" ]]; then
110N/A COMPREPLY[$idx]=$pval
110N/A idx=$(($idx+1))
110N/A fi
110N/A done
110N/A return 0
110N/A else
110N/A _filedir
110N/A return 0
110N/A fi
110N/A}
110N/Acomplete -F _postcat postcat
110N/A
110N/A# postconf(1)
110N/A#
110N/A_postconf()
110N/A{
110N/A local cur prev pval len idx eqext
110N/A
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A if [[ $cur == '-' ]]; then
110N/A COMPREPLY=(-c -d -e -h -m -l -n -v)
110N/A return 0
110N/A fi
110N/A if [[ $prev == '-c' ]]; then
110N/A _filedir -d
110N/A return 0
110N/A fi
110N/A if [[ $prev == '-e' ]]; then
110N/A cur=${cur#[\"\']}
110N/A eqext='='
110N/A fi
110N/A len=${#cur}
110N/A idx=0
110N/A for pval in $( /usr/sbin/postconf | cut -d ' ' -f 1 ); do
110N/A if [[ "$cur" == "${pval:0:$len}" ]]; then
110N/A COMPREPLY[$idx]="$pval$eqext"
110N/A idx=$(($idx+1))
110N/A fi
110N/A done
110N/A return 0
110N/A}
110N/Acomplete -F _postconf postconf
110N/A
110N/A# postsuper(1)
110N/A#
110N/A_postsuper()
110N/A{
110N/A local cur prev pval len idx
110N/A
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [[ $cur == '-' ]]; then
110N/A COMPREPLY=(-c -d -h -H -p -r -s -v)
110N/A return 0
110N/A fi
110N/A case $prev in
110N/A -[dr])
110N/A len=${#cur}
110N/A idx=0
110N/A for pval in $( echo ALL; mailq | \
110N/A sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* !].*$//' ); do
110N/A if [[ "$cur" == "${pval:0:$len}" ]]; then
110N/A COMPREPLY[$idx]=$pval
110N/A idx=$(($idx+1))
110N/A fi
110N/A done
110N/A return 0
110N/A ;;
110N/A -h)
110N/A len=${#cur}
110N/A idx=0
110N/A for pval in $( echo ALL; mailq | \
110N/A sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; s/[* ].*$//; /!$/d' ); do
110N/A if [[ "$cur" == "${pval:0:$len}" ]]; then
110N/A COMPREPLY[$idx]=$pval
110N/A idx=$(($idx+1))
110N/A fi
110N/A done
110N/A return 0
110N/A ;;
110N/A -H)
110N/A len=${#cur}
110N/A idx=0
110N/A for pval in $( echo ALL; mailq | \
110N/A sed -e '1d; $d; /^[^0-9A-Z]\|^$/d; /^[0-9A-Z]*[* ]/d; s/!.*$//' ); do
110N/A if [[ "$cur" == "${pval:0:$len}" ]]; then
110N/A COMPREPLY[$idx]=$pval
110N/A idx=$(($idx+1))
110N/A fi
110N/A done
110N/A return 0
110N/A ;;
110N/A esac
110N/A COMPREPLY=( $( compgen -W 'hold incoming active deferred' -- $cur ) )
110N/A return 0
110N/A}
110N/Acomplete -F _postsuper postsuper
110N/A}
110N/A
110N/A# cvs(1) completion
110N/A#
110N/Ahave cvs && {
110N/Aset_prefix()
110N/A{
110N/A [ -z ${prefix:-} ] || prefix=${cur%/*}/
110N/A [ -r ${prefix:-}CVS/Entries ] || prefix=""
110N/A}
110N/A
110N/Aget_entries()
110N/A{
110N/A local IFS=$'\n'
110N/A [ -r ${prefix:-}CVS/Entries ] && \
110N/A entries=$(cut -d/ -f2 -s ${prefix:-}CVS/Entries)
110N/A}
110N/A
110N/Aget_modules()
110N/A{
110N/A if [ -n "$prefix" ]; then
110N/A COMPREPLY=( $( command ls -d ${cvsroot}/${prefix}/!(CVSROOT) ) )
110N/A else
110N/A COMPREPLY=( $( command ls -d ${cvsroot}/!(CVSROOT) ) )
110N/A fi
110N/A}
110N/A
110N/A_cvs()
110N/A{
110N/A local cur count mode i cvsroot cvsroots pwd
110N/A local -a flags miss files entries changed newremoved
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A count=0
110N/A for i in "${COMP_WORDS[@]}"; do
110N/A [ $count -eq $COMP_CWORD ] && break
110N/A # Last parameter was the CVSROOT, now go back to mode selection
110N/A if [ "${COMP_WORDS[((count))]}" == "$cvsroot" -a "$mode" == "cvsroot" ]; then
110N/A mode=""
110N/A fi
110N/A if [ -z "$mode" ]; then
110N/A case $i in
110N/A -d)
110N/A mode=cvsroot
110N/A cvsroot=${COMP_WORDS[((count+1))]}
110N/A ;;
110N/A @(ad?(d)|new))
110N/A mode=add
110N/A ;;
110N/A @(adm?(in)|rcs))
110N/A mode=admin
110N/A ;;
110N/A ann?(notate))
110N/A mode=annotate
110N/A ;;
110N/A @(checkout|co|get))
110N/A mode=checkout
110N/A ;;
110N/A @(com?(mit)|ci))
110N/A mode=commit
110N/A ;;
110N/A di?(f?(f)))
110N/A mode=diff
110N/A ;;
110N/A ex?(p?(ort)))
110N/A mode=export
110N/A ;;
110N/A ?(un)edit)
110N/A mode=$i
110N/A ;;
110N/A hi?(s?(tory)))
110N/A mode=history
110N/A ;;
110N/A im?(p?(ort)))
110N/A mode=import
110N/A ;;
110N/A re?(l?(ease)))
110N/A mode=release
110N/A ;;
110N/A ?(r)log)
110N/A mode=log
110N/A ;;
110N/A @(rdiff|patch))
110N/A mode=rdiff
110N/A ;;
110N/A @(remove|rm|delete))
110N/A mode=remove
110N/A ;;
110N/A @(rtag|rfreeze))
110N/A mode=rtag
110N/A ;;
110N/A st?(at?(us)))
110N/A mode=status
110N/A ;;
110N/A @(tag|freeze))
110N/A mode=tag
110N/A ;;
110N/A up?(d?(ate)))
110N/A mode=update
110N/A ;;
110N/A *)
110N/A ;;
110N/A esac
110N/A elif [[ "$i" = -* ]]; then
110N/A flags=( "${flags[@]}" $i )
110N/A fi
110N/A count=$((++count))
110N/A done
110N/A
110N/A case "$mode" in
110N/A add)
110N/A if [[ "$cur" != -* ]]; then
110N/A set_prefix
110N/A if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
110N/A get_entries
110N/A [ -z "$cur" ] && \
110N/A files=$( command ls -Ad !(CVS) ) || \
110N/A files=$( command ls -d ${cur}* 2>/dev/null )
110N/A for i in "${entries[@]}"; do
110N/A files=( ${files[@]/#$i//} )
110N/A done
110N/A COMPREPLY=( $( compgen -W '${files[@]}' -- \
110N/A $cur ) )
110N/A fi
110N/A else
110N/A COMPREPLY=( $( compgen -W '-k -m' -- $cur ) )
110N/A fi
110N/A ;;
110N/A admin)
110N/A if [[ "$cur" = -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-i -a -A -e -b -c -k -l -u \
110N/A -L -U -m -M -n -N -o -q -I \
110N/A -s -t -t- -T -V -x -z' -- \
110N/A $cur ) )
110N/A fi
110N/A ;;
110N/A annotate)
110N/A if [[ "$cur" = -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-D -F -f -l -R -r' -- $cur ) )
110N/A else
110N/A get_entries
110N/A COMPREPLY=( $( compgen -W '${entries[@]}' -- $cur ) )
110N/A fi
110N/A ;;
110N/A checkout)
110N/A if [[ "$cur" != -* ]]; then
110N/A [ -z "$cvsroot" ] && cvsroot=$CVSROOT
110N/A COMPREPLY=( $( cvs -d "$cvsroot" co -c 2> /dev/null | \
110N/A awk '{print $1}' ) )
110N/A COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W '-A -N -P -R -c -f -l -n -p \
110N/A -s -r -D -d -k -j' -- $cur ) )
110N/A fi
110N/A ;;
110N/A commit)
110N/A set_prefix
110N/A
110N/A if [[ "$cur" != -* ]] && [ -r ${prefix:-}CVS/Entries ]; then
110N/A # if $COMP_CVS_REMOTE is not null, 'cvs commit' will
110N/A # complete on remotely checked-out files (requires
110N/A # passwordless access to the remote repository
110N/A if [ -n "${COMP_CVS_REMOTE:-}" ]; then
110N/A # this is the least computationally intensive
110N/A # way found so far, but other changes
110N/A # (something other than changed/removed/new)
110N/A # may be missing
110N/A changed=( $( cvs -q diff --brief 2>&1 | \
110N/A sed -ne 's/^Files [^ ]* and \([^ ]*\) differ$/\1/p' ) )
110N/A newremoved=( $( cvs -q diff --brief 2>&1 | \
110N/A sed -ne 's/^cvs diff: \([^ ]*\) .*, no comparison available$/\1/p' ) )
110N/A COMPREPLY=( $( compgen -W '${changed[@]:-} \
110N/A ${newremoved[@]:-}' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A else
110N/A COMPREPLY=( $( compgen -W '-n -R -l -f -F -m -r' -- \
110N/A $cur ) )
110N/A fi
110N/A ;;
110N/A cvsroot)
110N/A if [ -r ~/.cvspass ]; then
110N/A # Ugly escaping because of bash treating ':' specially
110N/A cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass )
110N/A COMPREPLY=( $( compgen -W '$cvsroots' -- $cur ) )
110N/A fi
110N/A ;;
110N/A export)
110N/A if [[ "$cur" != -* ]]; then
110N/A [ -z "$cvsroot" ] && cvsroot=$CVSROOT
110N/A COMPREPLY=( $( cvs -d "$cvsroot" co -c | awk '{print $1}' ) )
110N/A COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W '-N -f -l -R -n \
110N/A -r -D -d -k' -- $cur ) )
110N/A fi
110N/A ;;
110N/A diff)
110N/A if [[ "$cur" == -* ]]; then
110N/A _longopt diff
110N/A else
110N/A get_entries
110N/A COMPREPLY=( $( compgen -W '${entries[@]:-}' -- $cur ) )
110N/A fi
110N/A ;;
110N/A remove)
110N/A if [[ "$cur" != -* ]]; then
110N/A set_prefix
110N/A if [ $COMP_CWORD -gt 1 -a -r ${prefix:-}CVS/Entries ]; then
110N/A get_entries
110N/A # find out what files are missing
110N/A for i in "${entries[@]}"; do
110N/A [ ! -r "$i" ] && miss=( "${miss[@]}" $i )
110N/A done
110N/A COMPREPLY=( $(compgen -W '${miss[@]:-}' -- $cur) )
110N/A fi
110N/A else
110N/A COMPREPLY=( $( compgen -W '-f -l -R' -- $cur ) )
110N/A fi
110N/A ;;
110N/A import)
110N/A if [[ "$cur" != -* ]]; then
110N/A # starts with same algorithm as checkout
110N/A [ -z "$cvsroot" ] && cvsroot=$CVSROOT
110N/A prefix=${cur%/*}
110N/A if [ -r ${cvsroot}/${prefix} ]; then
110N/A get_modules
110N/A COMPREPLY=( ${COMPREPLY[@]#$cvsroot} )
110N/A COMPREPLY=( ${COMPREPLY[@]#\/} )
110N/A fi
110N/A pwd=$( pwd )
110N/A pwd=${pwd##*/}
110N/A COMPREPLY=( $( compgen -W '${COMPREPLY[@]} $pwd' -- \
110N/A $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W '-d -k -I -b -m -W' -- $cur ))
110N/A fi
110N/A ;;
110N/A update)
110N/A if [[ "$cur" = -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A -P -C -d -f -l -R -p \
110N/A -k -r -D -j -I -W' -- \
110N/A $cur ) )
110N/A fi
110N/A ;;
110N/A "")
110N/A COMPREPLY=( $( compgen -W 'add admin annotate checkout ci co \
110N/A commit diff delete edit export \
110N/A freeze get history import log new \
110N/A patch rcs rdiff release remove \
110N/A rfreeze rlog rm rtag stat status \
110N/A tag unedit up update -H -Q -q -b \
110N/A -d -e -f -l -n -t -r -v -w -x -z \
110N/A --help --version' -- $cur ) )
110N/A ;;
110N/A *)
110N/A ;;
110N/A esac
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _cvs $default cvs
110N/A}
110N/A
110N/Ahave rpm && {
110N/A# helper functions for rpm completion
110N/A#
110N/A_rpm_installed_packages()
110N/A{
110N/A local ver nodig nosig
110N/A
110N/A if [ -r /var/log/rpmpkgs -a \
110N/A /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
110N/A # using RHL 7.2 or later - this is quicker than querying the DB
110N/A COMPREPLY=( $( sed -ne \
110N/A 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+.*\.rpm$|\1|p' \
110N/A /var/log/rpmpkgs ) )
110N/A else
110N/A nodig=""
110N/A nosig=""
110N/A ver=$(rpm --version)
110N/A ver=${ver##* }
110N/A
110N/A if [[ "$ver" > "4.0.4" ]]; then
110N/A nodig="--nodigest"
110N/A fi
110N/A if [[ "$ver" > "4.0.99" ]]; then
110N/A nosig="--nosignature"
110N/A fi
110N/A
110N/A COMPREPLY=( $( rpm -qa $nodig $nosig | sed -ne \
110N/A 's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+$|\1|p' ) )
110N/A fi
110N/A}
110N/A
110N/A_rpm_groups()
110N/A{
110N/A local IFS=$'\t'
110N/A # remove trailing backslash, or grep will complain
110N/A cur=${cur%"\\"}
110N/A COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat '%{group}\n' | \
110N/A grep "^$cur" ) )
110N/A # backslash escape spaces and translate newlines to tabs
110N/A COMPREPLY=( $( echo "${COMPREPLY[@]}" | sed 's/ /\\ /g' | tr '\n' '\t' ) )
110N/A}
110N/A
110N/A# rpm(8) completion
110N/A#
110N/A_rpm()
110N/A{
110N/A local cur prev ver nodig nosig
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A nodig=""
110N/A nosig=""
110N/A ver=$(rpm --version); ver=${ver##* }
110N/A
110N/A if [[ "$ver" > "4.0.4" ]]; then
110N/A nodig="--nodigest"
110N/A fi
110N/A if [[ "$ver" > "4.0.99" ]]; then
110N/A nosig="--nosignature"
110N/A fi
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A # first parameter on line
110N/A case "$cur" in
110N/A -b*)
110N/A COMPREPLY=( $( compgen -W '-ba -bb -bc -bi -bl -bp -bs'\
110N/A -- $cur ) )
110N/A ;;
110N/A -t*)
110N/A COMPREPLY=( $( compgen -W '-ta -tb -tc -ti -tl -tp -ts'\
110N/A -- $cur ) )
110N/A ;;
110N/A --*)
110N/A COMPREPLY=( $( compgen -W '--help --version --initdb \
110N/A --checksig --recompile --rebuild --resign --addsign \
110N/A --rebuilddb --showrc --setperms --setugids --tarbuild \
110N/A --eval --install --upgrade --query --freshen --erase \
110N/A --verify --querytags --rmsource --rmspec --clean \
110N/A --import' -- $cur ) )
110N/A ;;
110N/A *)
110N/A COMPREPLY=( $( compgen -W '-b -e -F -i -q -t -U -V' \
110N/A -- $cur ) )
110N/A ;;
110N/A esac
110N/A
110N/A return 0
110N/A fi
110N/A
110N/A case "$prev" in
110N/A --@(@(db|exclude)path|prefix|relocate|root))
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A --eval)
110N/A # get a list of macros
110N/A COMPREPLY=( $( sed -ne 's|^\(%'${cur#\%}'[^ '$'\t'']*\).*$|\1|p' \
110N/A /usr/lib/rpm/macros ) )
110N/A return 0
110N/A ;;
110N/A --pipe)
110N/A COMPREPLY=( $( compgen -c -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --rcfile)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A --specfile)
110N/A # complete on .spec files
110N/A _filedir spec
110N/A return 0
110N/A ;;
110N/A --whatprovides)
110N/A if [[ "$cur" == */* ]]; then
110N/A _filedir
110N/A else
110N/A # complete on capabilities
110N/A COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
110N/A '%{providename}\n' | grep "^$cur" ) )
110N/A fi
110N/A return 0
110N/A ;;
110N/A --whatrequires)
110N/A # complete on capabilities
110N/A COMPREPLY=( $( rpm -qa $nodig $nosig --queryformat \
110N/A '%{requirename}\n' | grep "^$cur" ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A case "${COMP_WORDS[1]}" in
110N/A -@([iFU]*|-install|-freshen|-upgrade))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--percent --force --test \
110N/A --replacepkgs --replacefiles --root --excludedocs \
110N/A --includedocs --noscripts --rcfile --ignorearch \
110N/A --dbpath --prefix --ignoreos --nodeps --allfiles \
110N/A --ftpproxy --ftpport --justdb --httpproxy --httpport \
110N/A --noorder --relocate --badreloc --notriggers \
110N/A --excludepath --ignoresize --oldpackage --define \
110N/A --eval --pipe --queryformat --repackage --nosuggests \
110N/A --nodigest --nosignature' -- $cur ) )
110N/A else
110N/A _filedir 'rpm'
110N/A fi
110N/A ;;
110N/A -@(e|-erase))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--allmatches --noscripts \
110N/A --notriggers --nodeps --test --repackage' -- $cur ) )
110N/A else
110N/A _rpm_installed_packages
110N/A fi
110N/A ;;
110N/A -@(q*|-query))
110N/A # check whether we're doing file completion
110N/A if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--scripts --root \
110N/A --rcfile --requires --ftpport --ftpproxy \
110N/A --httpproxy --httpport --provides --triggers \
110N/A --dump --changelog --dbpath \
110N/A --last --filesbypkg \
110N/A --info --list --state \
110N/A --docfiles --configfiles --queryformat \
110N/A --conflicts --obsoletes \
110N/A --nodigest --nosignature \
110N/A --triggerscripts' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
110N/A _rpm_groups
110N/A elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
110N/A # uninstalled package completion
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--scripts --root \
110N/A --rcfile --whatprovides --whatrequires \
110N/A --requires --triggeredby --ftpport --ftpproxy \
110N/A --httpproxy --httpport --provides --triggers \
110N/A --dump --changelog --dbpath --filesbypkg \
110N/A --define --eval --pipe --showrc --info --list \
110N/A --state --docfiles --configfiles --queryformat\
110N/A --conflicts --obsoletes --nodigest \
110N/A --nosignature' -- $cur ) )
110N/A else
110N/A _filedir 'rpm'
110N/A fi
110N/A else
110N/A # installed package completion
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--scripts --root \
110N/A --rcfile --whatprovides --whatrequires \
110N/A --requires --triggeredby --ftpport --ftpproxy \
110N/A --httpproxy --httpport --provides --triggers \
110N/A --dump --changelog --dbpath --specfile \
110N/A --querybynumber --last --filesbypkg --define \
110N/A --eval --pipe --showrc --info --list --state \
110N/A --docfiles --configfiles --queryformat \
110N/A --conflicts --obsoletes --pkgid --hdrid \
110N/A --fileid --tid --nodigest --nosignature \
110N/A --triggerscripts' -- $cur ) )
110N/A elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then
110N/A _rpm_installed_packages
110N/A fi
110N/A fi
110N/A ;;
110N/A -@(K*|-checksig))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--nopgp --nogpg --nomd5 \
110N/A --nodigest --nosignature' -- $cur ) )
110N/A else
110N/A _filedir 'rpm'
110N/A fi
110N/A ;;
110N/A -@([Vy]*|-verify))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--root --rcfile --dbpath \
110N/A --nodeps --nogroup --nolinkto --nomode --nomtime \
110N/A --nordev --nouser --nofiles --noscripts --nomd5 \
110N/A --querytags --specfile --whatrequires --whatprovides \
110N/A --nodigest --nosignature' -- $cur ) )
110N/A # check whether we're doing file completion
110N/A elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then
110N/A _filedir
110N/A elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then
110N/A _rpm_groups
110N/A elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then
110N/A _filedir 'rpm'
110N/A else
110N/A _rpm_installed_packages
110N/A fi
110N/A ;;
110N/A -[bt]*)
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--short-circuit --timecheck \
110N/A --clean --rmsource --rmspec --test --sign --buildroot \
110N/A --target -- buildarch --buildos --nobuild --nodeps \
110N/A --nodirtokens' -- $cur ) )
110N/A elif [[ ${COMP_WORDS[1]} == -b* ]]; then
110N/A _filedir 'spec'
110N/A else
110N/A _filedir '@(tgz|tar.@(gz|bz2))'
110N/A fi
110N/A ;;
110N/A --re@(build|compile))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--nodeps --rmsource \
110N/A --rmspec --sign --nodirtokens --target' -- $cur ) )
110N/A else
110N/A _filedir '?(no)src.rpm'
110N/A fi
110N/A ;;
110N/A --tarbuild)
110N/A _filedir '@(tgz|tar.@(gz|bz2))'
110N/A ;;
110N/A --@(re|add)sign)
110N/A _filedir 'rpm'
110N/A ;;
110N/A --set@(perms|gids))
110N/A _rpm_installed_packages
110N/A ;;
110N/A --@(clean|rms@(ource|pec)))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--clean --rmsource \
110N/A --rmspec' -- $cur ) )
110N/A else
110N/A _filedir 'spec'
110N/A fi
110N/A ;;
110N/A --@(import|dbpath|root))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--import --dbpath --root' \
110N/A -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A ;;
110N/A esac
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _rpm $filenames rpm rpmbuild
110N/A}
110N/A
110N/A# Debian apt-get(8) completion.
110N/A#
110N/Ahave apt-get &&
110N/A_apt_get()
110N/A{
110N/A local cur prev special i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
110N/A if [[ ${COMP_WORDS[i]} == @(install|remove|purge|source|build-dep) ]]; then
110N/A special=${COMP_WORDS[i]}
110N/A fi
110N/A done
110N/A
110N/A if [ -n "$special" ]; then
110N/A case $special in
110N/A remove|purge)
110N/A if [ -f /etc/debian_version ]; then
110N/A # Debian system
110N/A COMPREPLY=( $( _comp_dpkg_installed_packages \
110N/A $cur ) )
110N/A else
110N/A # assume RPM based
110N/A _rpm_installed_packages
110N/A fi
110N/A return 0
110N/A ;;
110N/A *)
110N/A COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
110N/A return 0
110N/A ;;
110N/A
110N/A esac
110N/A fi
110N/A
110N/A case "$prev" in
110N/A -@(c|-config-file))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A
110N/A -@(t|-target-release|-default-release))
110N/A COMPREPLY=( $( apt-cache policy | \
110N/A grep "release.o=Debian,a=$cur" | \
110N/A sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null) )
110N/A return 0
110N/A ;;
110N/A
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A
110N/A COMPREPLY=( $( compgen -W '-d -f -h -v -m -q -s -y \
110N/A -u -t -b -c -o --download-only --fix-broken \
110N/A --help --version --ignore-missing \
110N/A --fix-missing --no-download --quiet --simulate \
110N/A --just-print --dry-run --recon --no-act --yes \
110N/A --assume-yes --show-upgraded --only-source \
110N/A --compile --build --ignore-hold \
110N/A --target-release --no-upgrade --force-yes \
110N/A --print-uris --purge --reinstall \
110N/A --list-cleanup --default-release \
110N/A --trivial-only --no-remove --diff-only \
110N/A --tar-only --config-file --option --auto-remove' -- $cur ) )
110N/A else
110N/A
110N/A COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
110N/A dist-upgrade install remove purge source \
110N/A build-dep check clean autoclean autoremove' \
110N/A -- $cur ) )
110N/A
110N/A fi
110N/A
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _apt_get $filenames apt-get
110N/A
110N/A# Debian apt-cache(8) completion.
110N/A#
110N/Ahave apt-cache &&
110N/A_apt_cache()
110N/A{
110N/A local cur prev special i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A
110N/A if [ "$cur" != show ]; then
110N/A for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
110N/A if [[ ${COMP_WORDS[i]} == @(add|depends|dotty|policy|rdepends|madison|show?(pkg|src|)) ]]; then
110N/A special=${COMP_WORDS[i]}
110N/A fi
110N/A done
110N/A fi
110N/A
110N/A
110N/A if [ -n "$special" ]; then
110N/A case $special in
110N/A add)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A
110N/A *)
110N/A COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
110N/A return 0
110N/A ;;
110N/A
110N/A esac
110N/A fi
110N/A
110N/A
110N/A case "$prev" in
110N/A -@(c|p|s|-config-file|-@(pkg|src)-cache))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A search)
110N/A if [[ "$cur" != -* ]]; then
110N/A return 0
110N/A fi
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A
110N/A COMPREPLY=( $( compgen -W '-h -v -p -s -q -i -f -a -g -c \
110N/A -o --help --version --pkg-cache --src-cache \
110N/A --quiet --important --full --all-versions \
110N/A --no-all-versions --generate --no-generate \
110N/A --names-only --all-names --recurse \
110N/A --config-file --option' -- $cur ) )
110N/A else
110N/A
110N/A COMPREPLY=( $( compgen -W 'add gencaches show showpkg showsrc \
110N/A stats dump dumpavail unmet search search \
110N/A depends rdepends pkgnames dotty xvcg \
110N/A policy madison' -- $cur ) )
110N/A
110N/A fi
110N/A
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _apt_cache $filenames apt-cache
110N/A
110N/A
110N/A# Debian aptitude(1) completion
110N/A#
110N/Ahave aptitude && {
110N/Ahave grep-status && {
110N/A_comp_dpkg_hold_packages()
110N/A{
110N/A grep-status -P -e "^$1" -a -FStatus 'hold' -n -s Package
110N/A}
110N/A} || {
110N/A_comp_dpkg_hold_packages()
110N/A{
110N/A grep -B 2 'hold' /var/lib/dpkg/status | grep "Package: $1" \
110N/A | cut -d\ -f2
110N/A}
110N/A}
110N/A
110N/A_aptitude()
110N/A{
110N/A local cur dashoptions prev special i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A
110N/A dashoptions='-S -u -i -h --help --version -s --simulate -d \
110N/A --download-only -P --prompt -y --assume-yes -F \
110N/A --display-format -O --sort -w --width -f -r -g \
110N/A --with-recommends --with-suggests -R -G \
110N/A --without-recommends --without-suggests -t \
110N/A --target-release -V --show-versions -D --show-deps\
110N/A -Z -v --verbose --purge-unused'
110N/A
110N/A for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
110N/A if [[ ${COMP_WORDS[i]} == @(install|reinstall|hold|unhold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|forbid-version|purge|remove|changelog|why|why-not|keep|keep-all) ]]; then
110N/A special=${COMP_WORDS[i]}
110N/A fi
110N/A #exclude some mutually exclusive options
110N/A [[ ${COMP_WORDS[i]} == '-u' ]] && dashoptions=${dashoptions/-i}
110N/A [[ ${COMP_WORDS[i]} == '-i' ]] && dashoptions=${dashoptions/-u}
110N/A done
110N/A
110N/A if [[ -n "$special" ]]; then
110N/A case $special in
110N/A @(install|hold|markauto|unmarkauto|dist-upgrade|full-upgrade|download|show|changelog|why|why-not))
110N/A COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
110N/A return 0
110N/A ;;
110N/A @(purge|remove|reinstall|forbid-version))
110N/A COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
110N/A return 0
110N/A ;;
110N/A unhold)
110N/A COMPREPLY=( $( _comp_dpkg_hold_packages $cur ) )
110N/A return 0
110N/A ;;
110N/A
110N/A esac
110N/A fi
110N/A
110N/A case $prev in
110N/A # don't complete anything if these options are found
110N/A @(autoclean|clean|forget-new|search|upgrade|safe-upgrade|update|keep-all))
110N/A return 0
110N/A ;;
110N/A
110N/A -S)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A
110N/A -@(t|-target-release|-default-release))
110N/A COMPREPLY=( $( apt-cache policy | \
110N/A grep "release.o=Debian,a=$cur" | \
110N/A sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2> /dev/null ) )
110N/A return 0
110N/A ;;
110N/A
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W "$dashoptions" -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W 'update upgrade safe-upgrade forget-new clean \
110N/A autoclean install reinstall remove \
110N/A hold unhold purge markauto unmarkauto why why-not \
110N/A dist-upgrade full-upgrade download search show \
110N/A forbid-version changelog keep-all' -- $cur ) )
110N/A fi
110N/A
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _aptitude $default aptitude
110N/A}
110N/A
110N/A# Debian apt-build(1) completion.
110N/A#
110N/Ahave apt-build &&
110N/A_apt_build()
110N/A{
110N/A local cur prev special i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
110N/A if [[ ${COMP_WORDS[i]} == @(install|remove|source|info|clean) ]]; then
110N/A special=${COMP_WORDS[i]}
110N/A fi
110N/A done
110N/A
110N/A if [ -n "$special" ]; then
110N/A case $special in
110N/A @(install|source|info))
110N/A COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
110N/A return 0
110N/A ;;
110N/A remove)
110N/A COMPREPLY=( $( _comp_dpkg_installed_packages \
110N/A $cur ) )
110N/A return 0
110N/A ;;
110N/A *)
110N/A return 0
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A case "$prev" in
110N/A
110N/A --@(patch|build-dir|repository-dir))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A
110N/A -@(h|-help))
110N/A return 0
110N/A ;;
110N/A
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--help --show-upgraded -u --build-dir \
110N/A --repository-dir --build-only \
110N/A --build-command --reinstall --rebuild \
110N/A --remove-builddep --no-wrapper --purge \
110N/A --patch --patch-strip -p --yes -y \
110N/A --version -v --no-source' -- $cur ) )
110N/A
110N/A else
110N/A COMPREPLY=( $( compgen -W 'update upgrade install remove \
110N/A source dist-upgrade world clean info \
110N/A clean-build update-repository ' -- $cur ) )
110N/A fi
110N/A
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _apt_build $filenames apt-build
110N/A
110N/A# chsh(1) completion
110N/A#
110N/A_chsh()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [ "$prev" = "-s" ]; then
110N/A if [ -f /etc/debian_version ]; then
110N/A COMPREPLY=( $( </etc/shells ) )
110N/A else
110N/A COMPREPLY=( $( chsh -l | grep "^$cur" ) )
110N/A fi
110N/A else
110N/A COMPREPLY=( $( compgen -u -- $cur ) )
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _chsh chsh
110N/A
110N/A# chkconfig(8) completion
110N/A#
110N/Ahave chkconfig &&
110N/A_chkconfig()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A @([1-6]|--@(list|add|del)))
110N/A _services
110N/A return 0
110N/A ;;
110N/A --level)
110N/A COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--list --add --del --level' -- $cur ) )
110N/A else
110N/A if [ $COMP_CWORD -eq 2 -o $COMP_CWORD -eq 4 ]; then
110N/A COMPREPLY=( $( compgen -W 'on off reset' -- $cur ) )
110N/A else
110N/A _services
110N/A fi
110N/A fi
110N/A} &&
110N/Acomplete -F _chkconfig chkconfig
110N/A
110N/A# This function provides simple user@host completion
110N/A#
110N/A_user_at_host() {
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ $cur == *@* ]]; then
110N/A _known_hosts
110N/A else
110N/A COMPREPLY=( $( compgen -u -- "$cur" ) )
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Ashopt -u hostcomplete && complete -F _user_at_host $nospace talk ytalk finger
110N/A
110N/A# This function performs host completion based on ssh's known_hosts files,
110N/A# defaulting to standard host completion if they don't exist.
110N/A#
110N/A_known_hosts()
110N/A{
110N/A local cur curd ocur user suffix aliases global_kh user_kh hosts i host
110N/A local -a kh khd config
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A ocur=$cur
110N/A
110N/A [ "$1" = -a ] || [ "$2" = -a ] && aliases='yes'
110N/A [ "$1" = -c ] || [ "$2" = -c ] && suffix=':'
110N/A [[ $cur == *@* ]] && user=${cur%@*}@ && cur=${cur#*@}
110N/A kh=()
110N/A
110N/A # ssh config files
110N/A [ -r /etc/ssh/ssh_config ] &&
110N/A config=( "${config[@]}" "/etc/ssh/ssh_config" )
110N/A [ -r "${HOME}/.ssh/config" ] &&
110N/A config=( "${config[@]}" "${HOME}/.ssh/config" )
110N/A [ -r "${HOME}/.ssh2/config" ] &&
110N/A config=( "${config[@]}" "${HOME}/.ssh2/config" )
110N/A
110N/A if [ ${#config[@]} -gt 0 ]; then
110N/A # expand path (if present) to global known hosts file
110N/A global_kh=$( eval echo $( sed -ne 's/^[ \t]*[Gg][Ll][Oo][Bb][Aa][Ll][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
110N/A # expand path (if present) to user known hosts file
110N/A user_kh=$( eval echo $( sed -ne 's/^[ \t]*[Uu][Ss][Ee][Rr][Kk][Nn][Oo][Ww][Nn][Hh][Oo][Ss][Tt][Ss][Ff][Ii][Ll][Ee]['"$'\t '"']*\(.*\)$/\1/p' "${config[@]}" ) )
110N/A fi
110N/A
110N/A # Global known_hosts files
110N/A [ -r "$global_kh" ] &&
110N/A kh=( "${kh[@]}" "$global_kh" )
110N/A [ -r /etc/ssh/ssh_known_hosts ] &&
110N/A kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts )
110N/A [ -r /etc/ssh/ssh_known_hosts2 ] &&
110N/A kh=( "${kh[@]}" /etc/ssh/ssh_known_hosts2 )
110N/A [ -r /etc/known_hosts ] &&
110N/A kh=( "${kh[@]}" /etc/known_hosts )
110N/A [ -r /etc/known_hosts2 ] &&
110N/A kh=( "${kh[@]}" /etc/known_hosts2 )
110N/A [ -d /etc/ssh2/knownhosts ] &&
110N/A khd=( "${khd[@]}" /etc/ssh2/knownhosts/*pub )
110N/A
110N/A # User known_hosts files
110N/A [ -r "$user_kh" ] &&
110N/A kh=( "${kh[@]}" "$user_kh" )
110N/A [ -r ~/.ssh/known_hosts ] &&
110N/A kh=( "${kh[@]}" ~/.ssh/known_hosts )
110N/A [ -r ~/.ssh/known_hosts2 ] &&
110N/A kh=( "${kh[@]}" ~/.ssh/known_hosts2 )
110N/A [ -d ~/.ssh2/hostkeys ] &&
110N/A khd=( "${khd[@]}" ~/.ssh2/hostkeys/*pub )
110N/A
110N/A # If we have known_hosts files to use
110N/A if [ ${#kh[@]} -gt 0 -o ${#khd[@]} -gt 0 ]; then
110N/A # Escape slashes and dots in paths for awk
110N/A cur=${cur//\//\\\/}
110N/A cur=${cur//\./\\\.}
110N/A curd=$cur
110N/A
110N/A if [[ "$cur" == [0-9]*.* ]]; then
110N/A # Digits followed by a dot - just search for that
110N/A cur="^$cur.*"
110N/A elif [[ "$cur" == [0-9]* ]]; then
110N/A # Digits followed by no dot - search for digits followed
110N/A # by a dot
110N/A cur="^$cur.*\."
110N/A elif [ -z "$cur" ]; then
110N/A # A blank - search for a dot or an alpha character
110N/A cur="[a-z.]"
110N/A else
110N/A cur="^$cur"
110N/A fi
110N/A
110N/A if [ ${#kh[@]} -gt 0 ]; then
110N/A
110N/A # FS needs to look for a comma separated list
110N/A COMPREPLY=( $( awk 'BEGIN {FS=","}
110N/A /^[^|]/ {for (i=1; i<=2; ++i) { \
110N/A gsub(" .*$", "", $i); \
110N/A if ($i ~ /'$cur'/) {print $i} \
110N/A }}' "${kh[@]}" 2>/dev/null ) )
110N/A fi
110N/A if [ ${#khd[@]} -gt 0 ]; then
110N/A # Needs to look for files called
110N/A # .../.ssh2/key_22_<hostname>.pub
110N/A # dont fork any processes, because in a cluster environment,
110N/A # there can be hundreds of hostkeys
110N/A for i in "${khd[@]}" ; do
110N/A if [[ "$i" == *key_22_$curd*.pub ]] && [ -r "$i" ] ; then
110N/A host=${i/#*key_22_/}
110N/A host=${host/%.pub/}
110N/A COMPREPLY=( "${COMPREPLY[@]}" $host )
110N/A fi
110N/A done
110N/A fi
110N/A
110N/A # append any available aliases from config files
110N/A if [ ${#config[@]} -gt 0 ] && [ -n "$aliases" ]; then
110N/A local host_aliases=$( sed -ne 's/^[Hh][Oo][Ss][Tt]\([Nn][Aa][Mm][Ee]\)\?['"$'\t '"']\+\([^*?]*\)$/\2/p' "${config[@]}" )
110N/A hosts=$( compgen -W "$host_aliases" -- $ocur )
110N/A COMPREPLY=( "${COMPREPLY[@]}" $hosts )
110N/A fi
110N/A
110N/A # Now add results of normal hostname completion
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( compgen -A hostname -- $ocur ) )
110N/A
110N/A # apply suffix
110N/A for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
110N/A COMPREPLY[i]=$user${COMPREPLY[i]}$suffix
110N/A done
110N/A else
110N/A # Just do normal hostname completion
110N/A COMPREPLY=( $( compgen -A hostname -S "$suffix" -- $cur ) )
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
110N/A ping ping6 fping fping6 telnet host nslookup rsh rlogin ftp dig ssh-installkeys mtr
110N/A
110N/A# ssh(1) completion
110N/A#
110N/Ahave ssh && {
110N/A_ssh()
110N/A{
110N/A local cur prev
110N/A local -a config
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -*c)
110N/A COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
110N/A arcfour cast128-cbc' -- $cur ) )
110N/A ;;
110N/A -*i)
110N/A _filedir
110N/A ;;
110N/A -*l)
110N/A COMPREPLY=( $( compgen -u -- $cur ) )
110N/A ;;
110N/A *)
110N/A _known_hosts -a
110N/A
110N/A [ $COMP_CWORD -eq 1 ] || \
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
110N/A esac
110N/A
110N/A return 0
110N/A}
110N/Ashopt -u hostcomplete && complete -F _ssh ssh slogin sftp xhost autossh
110N/A
110N/A# scp(1) completion
110N/A#
110N/A_scp()
110N/A{
110N/A local cur userhost path
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _expand || return 0
110N/A
110N/A if [[ "$cur" == *:* ]]; then
110N/A local IFS=$'\t\n'
110N/A # remove backslash escape from :
110N/A cur=${cur/\\:/:}
110N/A userhost=${cur%%?(\\):*}
110N/A path=${cur#*:}
110N/A # unescape spaces
110N/A path=${path//\\\\\\\\ / }
110N/A if [ -z "$path" ]; then
110N/A # default to home dir of specified user on remote host
110N/A path=$(ssh -o 'Batchmode yes' $userhost pwd 2>/dev/null)
110N/A fi
110N/A # escape spaces; remove executables, aliases, pipes and sockets;
110N/A # add space at end of file names
110N/A COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
110N/A command ls -aF1d "$path*" 2>/dev/null | \
110N/A sed -e "s/[][(){}<>\",:;^&!$&=?\`|\\ ']/\\\\\\\\\\\\&/g" \
110N/A -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
110N/A return 0
110N/A fi
110N/A
110N/A [[ "$cur" == */* ]] || _known_hosts -c -a
110N/A local IFS=$'\t\n'
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( command ls -aF1d $cur* \
110N/A 2>/dev/null | sed \
110N/A -e "s/[][(){}<>\",:;^&!$&=?\`|\\ ']/\\\\&/g" \
110N/A -e 's/[*@|=]$//g' -e 's/[^\/]$/& /g' ) )
110N/A return 0
110N/A}
110N/Acomplete -F _scp $nospace scp
110N/A}
110N/A
110N/A# rsync(1) completion
110N/A#
110N/Ahave rsync &&
110N/A_rsync()
110N/A{
110N/A local cur prev shell i userhost path
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A _expand || return 0
110N/A
110N/A case "$prev" in
110N/A --@(config|password-file|include-from|exclude-from))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -@(T|-temp-dir|-compare-dest))
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A -@(e|-rsh))
110N/A COMPREPLY=( $( compgen -W 'rsh ssh' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A case "$cur" in
110N/A -*)
110N/A COMPREPLY=( $( compgen -W '-v -q -c -a -r -R -b -u -l -L -H \
110N/A -p -o -g -D -t -S -n -W -x -B -e -C -I -T -P \
110N/A -z -h -4 -6 --verbose --quiet --checksum \
110N/A --archive --recursive --relative --backup \
110N/A --backup-dir --suffix= --update --links \
110N/A --copy-links --copy-unsafe-links --safe-links \
110N/A --hard-links --perms --owner --group --devices\
110N/A --times --sparse --dry-run --whole-file \
110N/A --no-whole-file --one-file-system \
110N/A --block-size= --rsh= --rsync-path= \
110N/A --cvs-exclude --existing --ignore-existing \
110N/A --delete --delete-excluded --delete-after \
110N/A --ignore-errors --max-delete= --partial \
110N/A --force --numeric-ids --timeout= \
110N/A --ignore-times --size-only --modify-window= \
110N/A --temp-dir= --compare-dest= --compress \
110N/A --exclude= --exclude-from= --include= \
110N/A --include-from= --version --daemon --no-detach\
110N/A --address= --config= --port= --blocking-io \
110N/A --no-blocking-io --stats --progress \
110N/A --log-format= --password-file= --bwlimit= \
110N/A --write-batch= --read-batch= --help' -- $cur ))
110N/A ;;
110N/A *:*)
110N/A # find which remote shell is used
110N/A shell=rsh
110N/A for (( i=1; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" == -@(e|-rsh) ]]; then
110N/A shell=${COMP_WORDS[i+1]}
110N/A break
110N/A fi
110N/A done
110N/A if [[ "$shell" == ssh ]]; then
110N/A # remove backslash escape from :
110N/A cur=${cur/\\:/:}
110N/A userhost=${cur%%?(\\):*}
110N/A path=${cur#*:}
110N/A # unescape spaces
110N/A path=${path//\\\\\\\\ / }
110N/A if [ -z "$path" ]; then
110N/A # default to home dir of specified
110N/A # user on remote host
110N/A path=$(ssh -o 'Batchmode yes' \
110N/A $userhost pwd 2>/dev/null)
110N/A fi
110N/A # escape spaces; remove executables, aliases, pipes
110N/A # and sockets; add space at end of file names
110N/A COMPREPLY=( $( ssh -o 'Batchmode yes' $userhost \
110N/A command ls -aF1d "$path*" 2>/dev/null | \
110N/A sed -e 's/ /\\\\\\\ /g' -e 's/[*@|=]$//g' \
110N/A -e 's/[^\/]$/& /g' ) )
110N/A fi
110N/A ;;
110N/A *)
110N/A _known_hosts -c -a
110N/A _filedir
110N/A ;;
110N/A esac
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _rsync $nospace $filenames rsync
110N/A
110N/A# Linux route(8) completion
110N/A#
110N/A[ $UNAME = Linux ] &&
110N/A_route()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [ "$prev" = dev ]; then
110N/A COMPREPLY=( $( ifconfig -a | sed -ne 's|^\('$cur'[^ ]*\).*$|\1|p' ))
110N/A return 0
110N/A fi
110N/A
110N/A COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
110N/A window irtt reject mod dyn reinstate dev \
110N/A default gw' -- $cur ) )
110N/A
110N/A COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
110N/A (while read -d ' ' i; do
110N/A [ "$i" == "" ] && continue
110N/A # flatten array with spaces on either side,
110N/A # otherwise we cannot grep on word
110N/A # boundaries of first and last word
110N/A COMPREPLY=" ${COMPREPLY[@]} "
110N/A # remove word from list of completions
110N/A COMPREPLY=( ${COMPREPLY/ $i / } )
110N/A done
110N/A echo "${COMPREPLY[@]}")
110N/A ) )
110N/A return 0
110N/A}
110N/A[ $UNAME = Linux ] && complete -F _route route
110N/A
110N/A# GNU make(1) completion
110N/A#
110N/Ahave make || have gmake || have gnumake || have pmake &&
110N/A_make()
110N/A{
110N/A local file makef makef_dir="." makef_inc cur prev i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A # --name value style option
110N/A case $prev in
110N/A -@(f|o|W))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -@(I|C))
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A # --name=value style option
110N/A if [[ "$cur" == *=* ]]; then
110N/A prev=${cur/=*/}
110N/A cur=${cur/*=/}
110N/A case "$prev" in
110N/A --@(file|makefile))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A --@(directory|include-dir))
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-b -m -B -C -d -e -f -h -i -I\
110N/A -j -l -k -n -o -p -q -r -R - s -S -t -v -w -W \
110N/A --always-make --directory= --debug \
110N/A --environment-overrides --file= --makefile= --help \
110N/A --ignore-errors --include-dir= --jobs --load-average \
110N/A --max-load --keep-going --just-print --dry-run \
110N/A --recon --old-file= --assume-old= --print-data-base \
110N/A --question --no-builtin-rules --no-builtin-variables \
110N/A --silent --quiet --no-keep-goind --stop --touch \
110N/A --version --print-directory --no-print-directory \
110N/A --what-if= --new-file= --assume-new= \
110N/A --warn-undefined-variables' -- $cur ) )
110N/A else
110N/A # before we check for makefiles, see if a path was specified
110N/A # with -C
110N/A for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
110N/A if [[ ${COMP_WORDS[i]} == -C ]]; then
110N/A # eval for tilde expansion
110N/A eval makef_dir=${COMP_WORDS[i+1]}
110N/A break
110N/A fi
110N/A done
110N/A
110N/A # make reads `GNUmakefile', then `makefile', then `Makefile'
110N/A if [ -f ${makef_dir}/GNUmakefile ]; then
110N/A makef=${makef_dir}/GNUmakefile
110N/A elif [ -f ${makef_dir}/makefile ]; then
110N/A makef=${makef_dir}/makefile
110N/A elif [ -f ${makef_dir}/Makefile ]; then
110N/A makef=${makef_dir}/Makefile
110N/A else
110N/A makef=${makef_dir}/*.mk # local convention
110N/A fi
110N/A
110N/A # before we scan for targets, see if a Makefile name was
110N/A # specified with -f
110N/A for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
110N/A if [[ ${COMP_WORDS[i]} == -f ]]; then
110N/A # eval for tilde expansion
110N/A eval makef=${COMP_WORDS[i+1]}
110N/A break
110N/A fi
110N/A done
110N/A
110N/A [ ! -f $makef ] && return 0
110N/A
110N/A # deal with included Makefiles
110N/A makef_inc=$( grep -E '^-?include' $makef | sed -e "s,^.* ,"$makef_dir"/," )
110N/A
110N/A for file in $makef_inc; do
110N/A [ -f $file ] && makef="$makef $file"
110N/A done
110N/A
110N/A COMPREPLY=( $( awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ \
110N/A {split($1,A,/ /);for(i in A)print A[i]}' \
110N/A $makef 2>/dev/null | command grep "^$cur" ))
110N/A fi
110N/A} &&
110N/Acomplete -f -F _make $filenames make gmake gnumake pmake
110N/A
110N/A# GNU tar(1) completion
110N/A#
110N/A_tar()
110N/A{
110N/A local cur ext regex tar untar
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A COMPREPLY=( $( compgen -W 'c t x u r d A' -- $cur ) )
110N/A return 0
110N/A fi
110N/A
110N/A case "${COMP_WORDS[1]}" in
110N/A ?(-)[cr]*f)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A +([^IZzjy])f)
110N/A ext='t@(ar?(.@(Z|gz|bz?(2)))|gz|bz?(2))'
110N/A regex='t\(ar\(\.\(Z\|gz\|bz2\?\)\)\?\|gz\|bz2\?\)'
110N/A ;;
110N/A *[Zz]*f)
110N/A ext='t?(ar.)@(gz|Z)'
110N/A regex='t\(ar\.\)\?\(gz\|Z\)'
110N/A ;;
110N/A *[Ijy]*f)
110N/A ext='t?(ar.)bz?(2)'
110N/A regex='t\(ar\.\)\?bz2\?'
110N/A ;;
110N/A *)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A
110N/A esac
110N/A
110N/A if [[ "$COMP_LINE" == *$ext' ' ]]; then
110N/A # complete on files in tar file
110N/A #
110N/A # get name of tar file from command line
110N/A tar=$( echo "$COMP_LINE" | \
110N/A sed -e 's/^.* \([^ ]*'$regex'\) .*$/\1/' )
110N/A # devise how to untar and list it
110N/A untar=t${COMP_WORDS[1]//[^Izjyf]/}
110N/A
110N/A COMPREPLY=( $( compgen -W "$( echo $( tar $untar $tar \
110N/A 2>/dev/null ) )" -- "$cur" ) )
110N/A return 0
110N/A fi
110N/A
110N/A # file completion on relevant files
110N/A _filedir "$ext"
110N/A
110N/A return 0
110N/A}
110N/A[ -n "${COMP_TAR_INTERNAL_PATHS:-}" ] && complete -F _tar $dirnames tar ||
110N/A complete -F _tar $filenames tar
110N/A
110N/A# jar(1) completion
110N/A#
110N/Ahave jar &&
110N/A_jar()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD = 1 ]; then
110N/A COMPREPLY=( $( compgen -W 'c t x u' -- $cur ) )
110N/A return 0
110N/A fi
110N/A
110N/A case "${COMP_WORDS[1]}" in
110N/A *c*f)
110N/A _filedir
110N/A ;;
110N/A *f)
110N/A _filedir '?(e|j|w)ar'
110N/A ;;
110N/A *)
110N/A _filedir
110N/A ;;
110N/A esac
110N/A} &&
110N/Acomplete -F _jar $filenames jar
110N/A
110N/A# Linux iptables(8) completion
110N/A#
110N/Ahave iptables &&
110N/A_iptables()
110N/A{
110N/A local cur prev table chain
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A chain='s/^Chain \([^ ]\+\).*$/\1/p'
110N/A
110N/A if [[ $COMP_LINE == *-t\ *filter* ]]; then
110N/A table="-t filter"
110N/A elif [[ $COMP_LINE == *-t\ *nat* ]]; then
110N/A table="-t nat"
110N/A elif [[ $COMP_LINE == *-t\ *mangle* ]]; then
110N/A table="-t mangle"
110N/A fi
110N/A
110N/A case "$prev" in
110N/A -*[AIDRPFXLZ])
110N/A COMPREPLY=( $( compgen -W '`iptables $table -nL | \
110N/A sed -ne "s/^Chain \([^ ]\+\).*$/\1/p"`' -- $cur ) )
110N/A ;;
110N/A -*t)
110N/A COMPREPLY=( $( compgen -W 'nat filter mangle' -- $cur ) )
110N/A ;;
110N/A -j)
110N/A if [ "$table" = "-t filter" -o "$table" = "" ]; then
110N/A COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
110N/A `iptables $table -nL | sed -ne "$chain" \
110N/A -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
110N/A $cur ) )
110N/A elif [ "$table" = "-t nat" ]; then
110N/A COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
110N/A MIRROR SNAT DNAT MASQUERADE `iptables $table -nL | \
110N/A sed -ne "$chain" -e "s/OUTPUT|PREROUTING|POSTROUTING//"`' \
110N/A -- $cur ) )
110N/A elif [ "$table" = "-t mangle" ]; then
110N/A COMPREPLY=( $( compgen -W 'ACCEPT DROP LOG ULOG REJECT \
110N/A MARK TOS `iptables $table -nL | sed -ne "$chain" \
110N/A -e "s/INPUT|OUTPUT|FORWARD|PREROUTING|POSTROUTING//"`' -- \
110N/A $cur ) )
110N/A fi
110N/A ;;
110N/A *)
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-i -o -s -d -p -f -m --append \
110N/A --delete --insert --replace --list --flush --zero --new \
110N/A --delete-chain --policy --rename-chain --proto --source \
110N/A --destination --in-interface --jump --match --numeric \
110N/A --out-interface --table --verbose --line-numbers --exact \
110N/A --fragment --modprobe= --set-counters --version' -- "$cur") )
110N/A fi
110N/A ;;
110N/A esac
110N/A
110N/A} &&
110N/Acomplete -F _iptables iptables
110N/A
110N/A# tcpdump(8) completion
110N/A#
110N/Ahave tcpdump &&
110N/A_tcpdump()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(r|w|F))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -i)
110N/A _available_interfaces -a
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-a -d -e -f -l -n -N -O -p \
110N/A -q -R -S -t -u -v -x -C -F -i -m -r -s -T -w \
110N/A -E' -- $cur ) )
110N/A fi
110N/A
110N/A} &&
110N/Acomplete -F _tcpdump tcpdump
110N/A
110N/A# autorpm(8) completion
110N/A#
110N/Ahave autorpm &&
110N/A_autorpm()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A COMPREPLY=( $( compgen -W '--notty --debug --help --version \
110N/A auto add fullinfo info help install list \
110N/A remove set' -- $cur ) )
110N/A
110N/A} &&
110N/Acomplete -F _autorpm autorpm
110N/A
110N/A# This meta-cd function observes the CDPATH variable, so that cd additionally
110N/A# completes on directories under those specified in CDPATH.
110N/A#
110N/A_cd()
110N/A{
110N/A local IFS=$'\t\n' cur=`_get_cword` i j k
110N/A
110N/A # try to allow variable completion
110N/A if [[ "$cur" == ?(\\)\$* ]]; then
110N/A COMPREPLY=( $( compgen -v -P '$' -- "${cur#?(\\)$}" ) )
110N/A return 0
110N/A fi
110N/A
110N/A # Use standard dir completion if no CDPATH or parameter starts with /,
110N/A # ./ or ../
110N/A if [ -z "${CDPATH:-}" ] || [[ "$cur" == ?(.)?(.)/* ]]; then
110N/A _filedir -d
110N/A return 0
110N/A fi
110N/A
110N/A local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
110N/A local -r mark_symdirs=$(_rl_enabled mark-symlinked-directories && echo y)
110N/A
110N/A # we have a CDPATH, so loop on its contents
110N/A for i in ${CDPATH//:/$'\t'}; do
110N/A # create an array of matched subdirs
110N/A k="${#COMPREPLY[@]}"
110N/A for j in $( compgen -d $i/$cur ); do
110N/A if [[ ( $mark_symdirs && -h $j || $mark_dirs && ! -h $j ) && ! -d ${j#$i/} ]]; then
110N/A j="${j}/"
110N/A fi
110N/A COMPREPLY[k++]=${j#$i/}
110N/A done
110N/A done
110N/A
110N/A _filedir -d
110N/A
110N/A if [[ ${#COMPREPLY[@]} -eq 1 ]]; then
110N/A i=${COMPREPLY[0]}
110N/A if [ "$i" == "$cur" ] && [[ $i != "*/" ]]; then
110N/A COMPREPLY[0]="${i}/"
110N/A fi
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Aif shopt -q cdable_vars; then
110N/A complete -v -F _cd $nospace $filenames cd
110N/Aelse
110N/A complete -F _cd $nospace $filenames cd
110N/Afi
110N/A
110N/A_remove_comp_word()
110N/A{
110N/A if [[ COMP_CWORD -eq 0 ]]; then
110N/A return
110N/A elif [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
110N/A local old_cw0="${COMP_WORDS[0]}"
110N/A local new_cw0="${COMP_WORDS[1]}"
110N/A local old_length="${#COMP_LINE}"
110N/A COMP_LINE=${COMP_LINE#${old_cw0}}
110N/A local head=${COMP_LINE:0:${#new_cw0}}
110N/A local i=1
110N/A while [[ $head != $new_cw0 ]]; do
110N/A COMP_LINE=${COMP_LINE:1}
110N/A head=${COMP_LINE:0:${#new_cw0}}
110N/A if (( ++i > 10 )); then
110N/A break
110N/A fi
110N/A done
110N/A local new_length="${#COMP_LINE}"
110N/A COMP_POINT=$(( COMP_POINT + new_length - old_length))
110N/A
110N/A COMP_CWORD=$(( COMP_CWORD - 1 ))
110N/A for (( i=0; i < ${#COMP_WORDS[@]} - 1; ++i )); do
110N/A COMP_WORDS[i]="${COMP_WORDS[i+1]}"
110N/A done
110N/A unset COMP_WORDS[${#COMP_WORDS[@]}-1]
110N/A else
110N/A return
110N/A fi
110N/A}
110N/A
110N/A# A meta-command completion function for commands like sudo(8), which need to
110N/A# first complete on a command, then complete according to that command's own
110N/A# completion definition - currently not quite foolproof (e.g. mount and umount
110N/A# don't work properly), but still quite useful.
110N/A#
110N/A_command()
110N/A{
110N/A local cur func cline cspec noglob cmd done i \
110N/A _COMMAND_FUNC _COMMAND_FUNC_ARGS
110N/A
110N/A _remove_comp_word
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A # If the the first arguments following our meta-command-invoker are
110N/A # switches, get rid of them. Most definitely not foolproof.
110N/A done=
110N/A while [ -z $done ] ; do
110N/A cmd=${COMP_WORDS[0]}
110N/A if [[ "$cmd" == -* ]] && [ $COMP_CWORD -ge 1 ]; then
110N/A _remove_comp_word
110N/A elif [[ "$cmd" == -* ]] && [[ $COMP_CWORD -eq 0 ]]; then
110N/A return
110N/A else
110N/A done=1
110N/A fi
110N/A done
110N/A
110N/A if [ $COMP_CWORD -eq 0 ]; then
110N/A COMPREPLY=( $( compgen -c -- $cur ) )
110N/A elif complete -p $cmd &>/dev/null; then
110N/A cspec=$( complete -p $cmd )
110N/A if [ "${cspec#* -F }" != "$cspec" ]; then
110N/A # COMP_CWORD and COMP_WORDS() are not read-only,
110N/A # so we can set them before handing off to regular
110N/A # completion routine
110N/A
110N/A # get function name
110N/A func=${cspec#*-F }
110N/A func=${func%% *}
110N/A
110N/A if [[ ${#COMP_WORDS[@]} -ge 2 ]]; then
110N/A $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}" "${COMP_WORDS[${#COMP_WORDS[@]}-2]}"
110N/A else
110N/A $func $cmd "${COMP_WORDS[${#COMP_WORDS[@]}-1]}"
110N/A fi
110N/A
110N/A # remove any \: generated by a command that doesn't
110N/A # default to filenames or dirnames (e.g. sudo chown)
110N/A # FIXME: I'm pretty sure this does not work!
110N/A if [ "${cspec#*-o }" != "$cspec" ]; then
110N/A cspec=${cspec#*-o }
110N/A cspec=${cspec%% *}
110N/A if [[ "$cspec" != @(dir|file)names ]]; then
110N/A COMPREPLY=("${COMPREPLY[@]//\\\\:/:}")
110N/A fi
110N/A fi
110N/A elif [ -n "$cspec" ]; then
110N/A cspec=${cspec#complete};
110N/A cspec=${cspec%%$cmd};
110N/A COMPREPLY=( $( eval compgen "$cspec" -- "$cur" ) );
110N/A fi
110N/A fi
110N/A
110N/A [ ${#COMPREPLY[@]} -eq 0 ] && _filedir
110N/A}
110N/Acomplete -F _command $filenames nohup exec nice eval strace time ltrace then \
110N/A else do vsound command xargs
110N/A
110N/A_root_command()
110N/A{
110N/A PATH=/usr/gnu/bin:$PATH:/sbin:/usr/sbin _command $1 $2 $3
110N/A}
110N/Acomplete -F _root_command $filenames sudo fakeroot really
110N/A
110N/A# ant(1) completion
110N/A#
110N/Ahave ant && {
110N/A_ant()
110N/A{
110N/A local cur prev buildfile i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -buildfile|-f)
110N/A _filedir 'xml'
110N/A return 0
110N/A ;;
110N/A -logfile)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # relevant options completion
110N/A COMPREPLY=( $( compgen -W '-help -projecthelp -version -quiet \
110N/A -verbose -debug -emacs -logfile -logger \
110N/A -listener -buildfile -f -D -find' -- $cur ) )
110N/A else
110N/A # available targets completion
110N/A # find which buildfile to use
110N/A buildfile=build.xml
110N/A for (( i=1; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" == -buildfile ]]; then
110N/A buildfile=${COMP_WORDS[i+1]}
110N/A break
110N/A fi
110N/A done
110N/A [ ! -f $buildfile ] && return 0
110N/A
110N/A # parse buildfile for targets
110N/A COMPREPLY=( $( awk -F'"' '/<target name="/ {print $2}' \
110N/A $buildfile | grep "^$cur" )
110N/A $( awk -F"'" "/<target name='/ "'{print $2}' \
110N/A $buildfile | grep "^$cur" )
110N/A $( awk -F'"' '/<target [^n]/ {if ($1 ~ /name=/) { print $2 } else if ($3 ~ /name=/) {print $4} else if ($5 ~ /name=/) {print $6}}' \
110N/A $buildfile | grep "^$cur" ) )
110N/A fi
110N/A}
110N/Ahave complete-ant-cmd.pl && \
110N/A complete -C complete-ant-cmd.pl -F _ant $filenames ant || \
110N/A complete -F _ant $filenames ant
110N/A}
110N/A
110N/Ahave nslookup &&
110N/A_nslookup()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=${COMP_WORDS[COMP_CWORD]#-}
110N/A
110N/A COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= \
110N/A srchlist= defname search port= querytype= \
110N/A type= recurse retry root timeout vc \
110N/A ignoretc' -- $cur ) )
110N/A} &&
110N/Acomplete -F _nslookup nslookup
110N/A
110N/A# mysqladmin(1) completion
110N/A#
110N/Ahave mysqladmin &&
110N/A_mysqladmin()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -u)
110N/A COMPREPLY=( $( compgen -u -- $cur ) )
110N/A return 0
110N/A ;;
110N/A *)
110N/A ;;
110N/A esac
110N/A
110N/A COMPREPLY=( $( compgen -W '-# -f -? -C -h -p -P -i -r -E -s -S -t -u \
110N/A -v -V -w' -- $cur ) )
110N/A
110N/A COMPREPLY=( "${COMPREPLY[@]}" \
110N/A $( compgen -W 'create drop extended-status flush-hosts \
110N/A flush-logs flush-status flush-tables \
110N/A flush-threads flush-privileges kill \
110N/A password ping processlist reload refresh \
110N/A shutdown status variables version' \
110N/A -- $cur ) )
110N/A} &&
110N/Acomplete -F _mysqladmin mysqladmin
110N/A
110N/A# gzip(1) completion
110N/A#
110N/Ahave gzip &&
110N/A_gzip()
110N/A{
110N/A local cur prev xspec IFS=$'\t\n'
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-c -d -f \
110N/A -h -l -L -n -N -q -r -S -t -v -V \
110N/A -1 -2 -3 -4 -5 -6 -7 -8 -9 \
110N/A --stdout --decompress --force --help --list \
110N/A --license --no-name --name --quiet --recursive \
110N/A --suffix --test --verbose --version --fast \
110N/A --best' -- $cur ) )
110N/A return 0
110N/A fi
110N/A
110N/A xspec="*.?(t)gz"
110N/A if [[ "$prev" == --* ]]; then
110N/A [[ "$prev" == --decompress || \
110N/A "$prev" == --list || \
110N/A "$prev" == --test ]] && xspec="!"$xspec
110N/A [[ "$prev" == --force ]] && xspec=
110N/A elif [[ "$prev" == -* ]]; then
110N/A [[ "$prev" == -*[dlt]* ]] && xspec="!"$xspec
110N/A [[ "$prev" == -*f* ]] && xspec=
110N/A elif [ "$prev" = '>' ]; then
110N/A xspec=
110N/A elif [ "$prev" = '<' ]; then
110N/A xspec=
110N/A fi
110N/A
110N/A _expand || return 0
110N/A
110N/A COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
110N/A $( compgen -d -- $cur ) )
110N/A} &&
110N/Acomplete -F _gzip $filenames gzip
110N/A
110N/A# bzip2(1) completion
110N/A#
110N/Ahave bzip2 &&
110N/A_bzip2()
110N/A{
110N/A local cur prev xspec IFS=$'\t\n'
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
110N/A -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
110N/A --help --decompress --compress --keep --force \
110N/A --test --stdout --quiet --verbose --license \
110N/A --version --small --fast --best' -- $cur ) )
110N/A return 0
110N/A fi
110N/A
110N/A xspec="*.bz2"
110N/A if [[ "$prev" == --* ]]; then
110N/A [[ "$prev" == --decompress || \
110N/A "$prev" == --list || \
110N/A "$prev" == --test ]] && xspec="!"$xspec
110N/A [[ "$prev" == --compress ]] && xspec=
110N/A elif [[ "$prev" == -* ]]; then
110N/A [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
110N/A [[ "$prev" == -*z* ]] && xspec=
110N/A fi
110N/A
110N/A _expand || return 0
110N/A
110N/A COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
110N/A $( compgen -d -- $cur ) )
110N/A} &&
110N/Acomplete -F _bzip2 $filenames bzip2
110N/A
110N/A# openssl(1) completion
110N/A#
110N/Ahave openssl && {
110N/A_openssl_sections()
110N/A{
110N/A local config
110N/A
110N/A config=/etc/ssl/openssl.cnf
110N/A [ ! -f $config ] && config=/usr/share/ssl/openssl.cnf
110N/A for (( i=2; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" == -config ]]; then
110N/A config=${COMP_WORDS[i+1]}
110N/A break
110N/A fi
110N/A done
110N/A [ ! -f $config ] && return 0
110N/A
110N/A COMPREPLY=( $( awk '/\[.*\]/ {print $2} ' $config | grep "^$cur" ) )
110N/A}
110N/A
110N/A_openssl()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A COMPREPLY=( $( compgen -W 'asn1parse ca ciphers crl crl2pkcs7 \
110N/A dgst dh dhparam dsa dsaparam enc errstr gendh gendsa \
110N/A genrsa nseq passwd pkcs12 pkcs7 pkcs8 rand req rsa \
110N/A rsautl s_client s_server s_time sess_id smime speed \
110N/A spkac verify version x509 md2 md4 md5 mdc2 rmd160 sha \
110N/A sha1 base64 bf bf-cbc bf-cfb bf-ecb bf-ofb cast \
110N/A cast-cbc cast5-cbc cast5-cfb cast5-ecb cast5-ofb des \
110N/A des-cbc des-cfb des-ecb des-ede des-ede-cbc \
110N/A des-ede-cfb des-ede-ofb des-ede3 des-ede3-cbc \
110N/A des-ede3-cfb des-ede3-ofb des-ofb des3 desx rc2 \
110N/A rc2-40-cbc rc2-64-cbc rc2-cbc rc2-cfb rc2-ecb rc2-ofb \
110N/A rc4 rc4-40' -- $cur ) )
110N/A else
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A case ${COMP_WORDS[1]} in
110N/A asn1parse)
110N/A case $prev in
110N/A -inform)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out|oid))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -in -out -noout -offset \
110N/A -length -i -oid -strparse' -- $cur ) )
110N/A fi
110N/A ;;
110N/A ca)
110N/A case $prev in
110N/A -@(config|revoke|cert|in|out|spkac|ss_cert))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -outdir)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A -@(name|crlexts|extensions))
110N/A _openssl_sections
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-verbose -config -name \
110N/A -gencrl -revoke -crldays -crlhours -crlexts \
110N/A -startdate -enddate -days -md -policy -keyfile \
110N/A -key -passin -cert -in -out -notext -outdir \
110N/A -infiles -spkac -ss_cert -preserveDN -batch \
110N/A -msie_hack -extensions' -- $cur ) )
110N/A fi
110N/A ;;
110N/A ciphers)
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-v -ssl2 -ssl3 -tls1' -- $cur ) )
110N/A fi
110N/A ;;
110N/A crl)
110N/A case $prev in
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out|CAfile))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -CAPath)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform -text -in -out -noout \
110N/A -hash -issuer -lastupdate -nextupdate -CAfile -CApath' -- $cur ) )
110N/A fi
110N/A ;;
110N/A crl2pkcs7)
110N/A case $prev in
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs' -- $cur ) )
110N/A fi
110N/A ;;
110N/A dgst)
110N/A case $prev in
110N/A -@(out|sign|verify|prvrify|signature))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-md5 -md4 -md2 -sha1 -sha -mdc2 -ripemd160 -dss1 \
110N/A -c -d -hex -binary -out -sign -verify -prverify -signature' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A ;;
110N/A dsa)
110N/A case $prev in
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout -des -des3 -idea -text -noout \
110N/A -modulus -pubin -pubout' -- $cur ) )
110N/A fi
110N/A ;;
110N/A dsaparam)
110N/A case $prev in
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out|rand))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform -in -out -noout \
110N/A -text -C -rand -genkey' -- $cur ) )
110N/A fi
110N/A ;;
110N/A enc)
110N/A case $prev in
110N/A -@(in|out|kfile))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-ciphername -in -out -pass \
110N/A -e -d -a -A -k -kfile -S -K -iv -p -P -bufsize -debug' -- $cur ) )
110N/A fi
110N/A ;;
110N/A dhparam)
110N/A case $prev in
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out|rand))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform -in -out -dsaparam -noout \
110N/A -text -C -2 -5 -rand' -- $cur ) )
110N/A fi
110N/A ;;
110N/A gendsa)
110N/A case $prev in
110N/A -@(out|rand))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-out -des -des3 -idea -rand' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A ;;
110N/A genrsa)
110N/A case $prev in
110N/A -@(out|rand))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-out -passout -des -des3 -idea -f4 -3 -rand' -- $cur ) )
110N/A fi
110N/A ;;
110N/A pkcs7)
110N/A case $prev in
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform -in -out -print_certs -text -noout' -- $cur ) )
110N/A fi
110N/A ;;
110N/A rand)
110N/A case $prev in
110N/A -@(out|rand))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-out -rand -base64' -- $cur ) )
110N/A fi
110N/A ;;
110N/A req)
110N/A case "$prev" in
110N/A -@(in|out|key)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A
110N/A -@(in|out|rand|key|keyout|config))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -extensions)
110N/A _openssl_sections
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform -in \
110N/A -passin -out -passout -text -noout -verify \
110N/A -modulus -new -rand -newkey -newkey -nodes \
110N/A -key -keyform -keyout -md5 -sha1 -md2 -mdc2 \
110N/A -config -x509 -days -asn1-kludge -newhdr \
110N/A -extensions -reqexts section' -- $cur ) )
110N/A fi
110N/A ;;
110N/A rsa)
110N/A case $prev in
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'DER NET PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform -in -passin -out -passout \
110N/A -sgckey -des -des3 -idea -text -noout -modulus -check -pubin \
110N/A -pubout -engine' -- $cur ) )
110N/A fi
110N/A ;;
110N/A rsautl)
110N/A case $prev in
110N/A -@(in|out|inkey))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-in -out -inkey -pubin -certin -sign -verify \
110N/A -encrypt -decrypt -pkcs -ssl -raw -hexdump -asn1parse' -- $cur ) )
110N/A fi
110N/A ;;
110N/A s_client)
110N/A case $prev in
110N/A -connect)
110N/A _known_hosts
110N/A return 0
110N/A ;;
110N/A -@(cert|key|CAfile|rand))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -CApath)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-connect -verify -cert -key -CApath -CAfile \
110N/A -reconnect -pause -showcerts -debug -msg -nbio_test -state -nbio \
110N/A -crlf -ign_eof -quiet -ssl2 -ssl3 -tls1 -no_ssl2 -no_ssl3 -no_tls1 \
110N/A -bugs -cipher -starttls -engine -rand' -- $cur ) )
110N/A fi
110N/A ;;
110N/A s_server)
110N/A case $prev in
110N/A -@(cert|key|dcert|dkey|dhparam|CAfile|rand))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -CApath)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-accept -context -verify -Verify -cert -key \
110N/A -dcert -dkey -dhparam -nbio -nbio_test -crlf -debug -msg -state -CApath \
110N/A -CAfile -nocert -cipher -quiet -no_tmp_rsa -ssl2 -ssl3 -tls1 -no_ssl2 \
110N/A -no_ssl3 -no_tls1 -no_dhe -bugs -hack -www -WWW -HTTP -engine -id_prefix \
110N/A -rand' -- $cur ) )
110N/A fi
110N/A ;;
110N/A s_time)
110N/A case $prev in
110N/A -connect)
110N/A _known_hosts
110N/A return 0
110N/A ;;
110N/A -@(cert|key|CAfile))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -CApath)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-connect -www -cert -key -CApath -CAfile -reuse \
110N/A -new -verify -nbio -time -ssl2 -ssl3 -bugs -cipher' -- $cur ) )
110N/A fi
110N/A ;;
110N/A
110N/A sess_id)
110N/A case $prev in
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform -in -out -text -noout \
110N/A -context ID' -- $cur ) )
110N/A fi
110N/A ;;
110N/A smime)
110N/A case $prev in
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'SMIME DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(in|out|certfile|signer|recip|inkey|content|rand))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-encrypt -decrypt -sign -verify -pk7out -des -des3 \
110N/A -rc2-40 -rc2-64 -rc2-128 -aes128 -aes192 -aes256 -in -certfile -signer \
110N/A -recip -inform -passin -inkey -out -outform -content -to -from -subject \
110N/A -text -rand' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A ;;
110N/A speed)
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-engine' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W 'md2 mdc2 md5 hmac sha1 rmd160 idea-cbc \
110N/A rc2-cbc rc5-cbc bf-cbc des-cbc des-ede3 rc4 rsa512 rsa1024 rsa2048 \
110N/A rsa4096 dsa512 dsa1024 dsa2048 idea rc2 des rsa blowfish' -- $cur ) )
110N/A fi
110N/A ;;
110N/A verify)
110N/A case $prev in
110N/A -@(CAfile|untrusted))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -CApath)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-CApath -CAfile -purpose -untrusted -help -issuer_checks \
110N/A -verbose -certificates' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A ;;
110N/A x509)
110N/A case "$prev" in
110N/A -@(in|out|CA|CAkey|CAserial|extfile))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -@(in|out)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM NET' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(key|CA|CAkey)form)
110N/A COMPREPLY=( $( compgen -W 'DER PEM' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -extensions)
110N/A _openssl_sections
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-inform -outform \
110N/A -keyform -CAform -CAkeyform -in -out \
110N/A -serial -hash -subject -issuer -nameopt \
110N/A -email -startdate -enddate -purpose \
110N/A -dates -modulus -fingerprint -alias \
110N/A -noout -trustout -clrtrust -clrreject \
110N/A -addtrust -addreject -setalias -days \
110N/A -set_serial -signkey -x509toreq -req \
110N/A -CA -CAkey -CAcreateserial -CAserial \
110N/A -text -C -md2 -md5 -sha1 -mdc2 -clrext \
110N/A -extfile -extensions -engine' -- $cur ) )
110N/A fi
110N/A ;;
110N/A @(md5|md4|md2|sha1|sha|mdc2|ripemd160))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-c -d' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _openssl $default openssl
110N/A}
110N/A
110N/A# screen(1) completion
110N/A#
110N/Ahave screen &&
110N/A_screen()
110N/A{
110N/A local cur prev preprev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A [ "$COMP_CWORD" -ge 2 ] && preprev=${COMP_WORDS[COMP_CWORD-2]}
110N/A
110N/A if [ "$preprev" = "-d" -o "$preprev" = "-D" -a "$prev" = "-r" -o \
110N/A "$prev" = "-R" ]; then
110N/A # list all
110N/A COMPREPLY=( $( command screen -ls | \
110N/A sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*$|\1|p' ) )
110N/A else
110N/A case "$prev" in
110N/A -[rR])
110N/A # list detached
110N/A COMPREPLY=( $( command screen -ls | \
110N/A sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Detached.*$|\1|p' ) )
110N/A ;;
110N/A -[dDx])
110N/A # list attached
110N/A COMPREPLY=( $( command screen -ls | \
110N/A sed -ne 's|^['$'\t'']\+\('$cur'[0-9]\+\.[^'$'\t'']\+\).*Attached.*$|\1|p' ) )
110N/A ;;
110N/A -s)
110N/A # shells
110N/A COMPREPLY=( $( grep ^${cur:-[^#]} /etc/shells ) )
110N/A ;;
110N/A *)
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _screen $default screen
110N/A
110N/A# lftp(1) bookmark completion
110N/A#
110N/Ahave lftp &&
110N/A_lftp()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ] && [ -f ~/.lftp/bookmarks ]; then
110N/A COMPREPLY=( $( compgen -W '$( sed -ne "s/^\(.*\)'$'\t''.*$/\1/p" \
110N/A ~/.lftp/bookmarks )' -- $cur ) )
110N/A fi
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _lftp $default lftp
110N/A
110N/A# ncftp(1) bookmark completion
110N/A#
110N/Ahave ncftp &&
110N/A_ncftp()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ] && [ -f ~/.ncftp/bookmarks ]; then
110N/A COMPREPLY=( $( compgen -W '$( sed -ne "s/^\([^,]\{1,\}\),.*$/\1/p" \
110N/A ~/.ncftp/bookmarks )' -- $cur ) )
110N/A fi
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _ncftp $default ncftp
110N/A
110N/A# gdb(1) completion
110N/A#
110N/Ahave gdb &&
110N/A_gdb()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A COMPREPLY=( $( compgen -c -- $cur ) )
110N/A elif [ $COMP_CWORD -eq 2 ]; then
110N/A prev=${prev##*/}
110N/A COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
110N/A awk '{if ($1 ~ /^'"$prev"'/) print $2}' ) )" \
110N/A -- "$cur" ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _gdb $filenames gdb
110N/A
110N/A# Postgresql completion
110N/A#
110N/Ahave psql && {
110N/A_pg_databases()
110N/A{
110N/A return
110N/A COMPREPLY=( $( psql -l 2>/dev/null | \
110N/A sed -e '1,/^-/d' -e '/^(/,$d' | \
110N/A awk '{print $1}' | grep "^$cur" ) )
110N/A}
110N/A
110N/A_pg_users()
110N/A{
110N/A #COMPREPLY=( $( psql -qtc 'select usename from pg_user' template1 2>/dev/null | \
110N/A # grep "^ $cur" ) )
110N/A #[ ${#COMPREPLY[@]} -eq 0 ] &&
110N/A COMPREPLY=( $( compgen -u -- $cur ) )
110N/A}
110N/A
110N/A# createdb(1) completion
110N/A#
110N/A_createdb()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(h|-host=))
110N/A _known_hosts
110N/A return 0
110N/A ;;
110N/A -@(U|-username=))
110N/A _pg_users
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-D -T -E -h -p -U -W -e -q \
110N/A --location= --template= --encoding= --host= --port= \
110N/A --username= --password --echo --quiet --help' -- $cur ))
110N/A else
110N/A _pg_databases
110N/A fi
110N/A}
110N/Acomplete -F _createdb $default createdb
110N/A
110N/A# dropdb(1) completion
110N/A#
110N/A_dropdb()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(h|-host=))
110N/A _known_hosts
110N/A return 0
110N/A ;;
110N/A -@(U|-username=))
110N/A _pg_users
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-h -p -U -W -e -q \
110N/A --host= --port= --username= --password \
110N/A --interactive --echo --quiet --help' -- $cur ) )
110N/A else
110N/A _pg_databases
110N/A fi
110N/A}
110N/Acomplete -F _dropdb $default dropdb
110N/A
110N/A# psql(1) completion
110N/A#
110N/A_psql()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -h|--host)
110N/A _known_hosts
110N/A return 0
110N/A ;;
110N/A -U|--username)
110N/A _pg_users
110N/A return 0
110N/A ;;
110N/A -d|--dbname)
110N/A _pg_databases
110N/A return 0
110N/A ;;
110N/A -@(o|f)|--output|--file)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # return list of available options
110N/A COMPREPLY=( $( compgen -W '-a --echo-all -A --no-align \
110N/A -c --command -d --dbname -e --echo-queries \
110N/A -E --echo-hidden -f --file -F --filed-separator \
110N/A -h --host -H --html -l --list -n -o --output \
110N/A -p --port -P --pset -q -R --record-separator \
110N/A -s --single-step -S --single-line -t --tuples-only \
110N/A -T --table-attr -U --username -v --variable \
110N/A -V --version -W --password -x --expanded -X --nopsqlrc \
110N/A -? --help ' -- $cur ) )
110N/A else
110N/A # return list of available databases
110N/A _pg_databases
110N/A fi
110N/A}
110N/Acomplete -F _psql $default psql
110N/A}
110N/A
110N/A_longopt()
110N/A{
110N/A local cur opt
110N/A
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == --*=* ]]; then
110N/A opt=${cur%%=*}
110N/A # cut backslash that gets inserted before '=' sign
110N/A opt=${opt%\\*}
110N/A cur=${cur#*=}
110N/A _filedir
110N/A COMPREPLY=( $( compgen -P "$opt=" -W '${COMPREPLY[@]}' -- $cur))
110N/A return 0
110N/A fi
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( $1 --help 2>&1 | sed -e '/--/!d' \
110N/A -e 's/.*\(--[-A-Za-z0-9]\+=\?\).*/\1/' | \
110N/A command grep "^$cur" | sort -u ) )
110N/A elif [[ "$1" == @(mk|rm)dir ]]; then
110N/A _filedir -d
110N/A else
110N/A _filedir
110N/A fi
110N/A}
110N/A# makeinfo and texi2dvi are defined elsewhere.
110N/Afor i in a2ps autoconf automake bc gprof ld nm objcopy objdump readelf strip \
110N/A bison cpio diff patch enscript cp df dir du ln ls mkfifo mknod mv rm \
110N/A touch vdir awk gperf grep grub indent less m4 sed shar date \
110N/A tee who texindex cat csplit cut expand fmt fold head \
110N/A md5sum nl od paste pr ptx sha1sum sort split tac tail tr unexpand \
110N/A uniq wc ldd bash id irb mkdir rmdir; do
110N/A have $i && complete -F _longopt $filenames $i
110N/Adone
110N/A
110N/A# These commands use filenames, so '-o filenames' is not needed.
110N/Afor i in env netstat seq uname units wget; do
110N/A have $i && complete -F _longopt $default $i
110N/Adone
110N/Aunset i
110N/A
110N/A# gcc(1) completion
110N/A#
110N/A# The only unusual feature is that we don't parse "gcc --help -v" output
110N/A# directly, because that would include the options of all the other backend
110N/A# tools (linker, assembler, preprocessor, etc) without any indication that
110N/A# you cannot feed such options to the gcc driver directly. (For example, the
110N/A# linker takes a -z option, but you must type -Wl,-z for gcc.) Instead, we
110N/A# ask the driver ("g++") for the name of the compiler ("cc1"), and parse the
110N/A# --help output of the compiler.
110N/A#
110N/Ahave gcc &&
110N/A_gcc()
110N/A{
110N/A local cur cc backend
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _expand || return 0
110N/A
110N/A case "$1" in
110N/A gcj)
110N/A backend=jc1
110N/A ;;
110N/A gpc)
110N/A backend=gpc1
110N/A ;;
110N/A *77)
110N/A backend=f771
110N/A ;;
110N/A *)
110N/A backend=cc1 # (near-)universal backend
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A cc=$( $1 -print-prog-name=$backend )
110N/A # sink stderr:
110N/A # for C/C++/ObjectiveC it's useless
110N/A # for FORTRAN/Java it's an error
110N/A COMPREPLY=( $( $cc --help 2>/dev/null | tr '\t' ' ' | \
110N/A sed -e '/^ *-/!d' -e 's/ *-\([^ ]*\).*/-\1/' | \
110N/A command grep "^$cur" | sort -u ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A} &&
110N/Acomplete $filenames -F _gcc gcc g++ c++ g77 gcj gpc
110N/A[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Cygwin ] && \
110N/A[ -n "${have:-}" ] && complete $filenames -F _gcc cc
110N/A
110N/A# Linux cardctl(8) completion
110N/A#
110N/Ahave cardctl &&
110N/A_cardctl()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A COMPREPLY=( $( compgen -W 'status config ident suspend \
110N/A resume reset eject insert scheme' \
110N/A -- $cur ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _cardctl cardctl
110N/A
110N/A# This function is required by _dpkg() and _dpkg-reconfigure()
110N/A#
110N/Ahave dpkg && {
110N/A_comp_dpkg_installed_packages()
110N/A{
110N/A grep -A 1 "Package: $1" /var/lib/dpkg/status | \
110N/A grep -B 1 -E "ok installed|half-installed|unpacked| \
110N/A half-configured|config-files" | \
110N/A grep "Package: $1" | cut -d\ -f2
110N/A}
110N/A
110N/A# Debian dpkg(8) completion
110N/A#
110N/A_dpkg()
110N/A{
110N/A local cur prev i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A i=$COMP_CWORD
110N/A
110N/A _expand || return 0
110N/A
110N/A # find the last option flag
110N/A if [[ $cur != -* ]]; then
110N/A while [[ $prev != -* && $i != 1 ]]; do
110N/A i=$((i-1))
110N/A prev=${COMP_WORDS[i-1]}
110N/A done
110N/A fi
110N/A
110N/A case "$prev" in
110N/A -@(c|i|A|I|f|e|x|X|-@(install|unpack|record-avail|contents|info|fsys-tarfile|field|control|extract)))
110N/A _filedir '?(u)deb'
110N/A return 0
110N/A ;;
110N/A -@(b|-build))
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A -@(s|p|l|-@(status|print-avail|list)))
110N/A COMPREPLY=( $( apt-cache pkgnames $cur 2>/dev/null ) )
110N/A return 0
110N/A ;;
110N/A -@(S|-search))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -@(r|L|P|-@(remove|purge|listfiles)))
110N/A COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
110N/A return 0
110N/A ;;
110N/A *)
110N/A
110N/A COMPREPLY=( $( compgen -W '-i --install --unpack -A --record-avail \
110N/A --configure -r --remove -P --purge --get-selections \
110N/A --set-selections --update-avail --merge-avail \
110N/A --clear-avail --command-fd --forget-old-unavail -s \
110N/A --status -p --print-avail -L --listfiles -l --list \
110N/A -S --search -C --audit --print-architecture \
110N/A --print-gnu-build-architecture \
110N/A --print-installation-architecture \
110N/A --compare-versions --help --version --force-help \
110N/A --force-all --force-auto-select --force-downgrade \
110N/A --force-configure-any --force-hold --force-bad-path \
110N/A --force-not-root --force-overwrite \
110N/A --force-overwrite-diverted --force-bad-verify \
110N/A --force-depends-version --force-depends \
110N/A --force-confnew --force-confold --force-confdef \
110N/A --force-confmiss --force-conflicts --force-architecture\
110N/A --force-overwrite-dir --force-remove-reinstreq \
110N/A --force-remove-essential -Dh \
110N/A --debug=help --licence --admindir= --root= --instdir= \
110N/A -O --selected-only -E --skip-same-version \
110N/A -G --refuse-downgrade -B --auto-deconfigure \
110N/A --no-debsig --no-act -D --debug= --status-fd \
110N/A -b --build -I --info -f --field -c --contents \
110N/A -x --extract -X --vextract --fsys-tarfile -e --control \
110N/A --ignore-depends= --abort-after' -- $cur ) )
110N/A ;;
110N/A esac
110N/A
110N/A
110N/A}
110N/Acomplete -F _dpkg $filenames dpkg dpkg-deb
110N/A}
110N/A
110N/A# Debian GNU dpkg-reconfigure(8) completion
110N/A#
110N/Ahave dpkg-reconfigure &&
110N/A_dpkg_reconfigure()
110N/A{
110N/A local cur prev opt
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A
110N/A case "$prev" in
110N/A -@(f|-frontend))
110N/A opt=( $( echo /usr/share/perl5/Debconf/FrontEnd/* ) )
110N/A opt=( ${opt[@]##*/} )
110N/A opt=( ${opt[@]%.pm} )
110N/A COMPREPLY=( $( compgen -W '${opt[@]}' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(p|-priority))
110N/A COMPREPLY=( $( compgen -W 'low medium high critical' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-f --frontend -p --priority -a --all \
110N/A -u --unseen-only -h --help -s --showold \
110N/A --force --terse' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _dpkg_reconfigure $default dpkg-reconfigure
110N/A
110N/A# Debian dpkg-source completion
110N/A#
110N/Ahave dpkg-source &&
110N/A_dpkg_source()
110N/A{
110N/A local cur prev options work i action packopts unpackopts
110N/A
110N/A packopts="-c -l -F -V -T -D -U -W -E -sa -i -I -sk -sp -su -sr -ss -sn -sA -sK -sP -sU -sR"
110N/A unpackopts="-sp -sn -su"
110N/A options=`echo "-x -b $packopts $unpackopts" | xargs echo | sort -u | xargs echo`
110N/A
110N/A COMPREPLY=()
110N/A if [ "$1" != "dpkg-source" ]; then
110N/A exit 1
110N/A fi
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A action="options"
110N/A for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
110N/A if [[ ${COMP_WORDS[$i]} == "-x" ]]; then
110N/A action=unpack
110N/A elif [[ ${COMP_WORDS[$i]} == "-b" ]]; then
110N/A action=pack
110N/A elif [[ ${COMP_WORDS[$i]} == "-h" ]]; then
110N/A action=help
110N/A fi
110N/A done
110N/A # if currently seeing a complete option, return just itself.
110N/A for i in $options; do
110N/A if [ "$cur" = "$i" ]; then
110N/A COMPREPLY=( "$cur" )
110N/A return 0
110N/A fi
110N/A done
110N/A case "$action" in
110N/A "unpack")
110N/A if [ "$cur" = "-" -o "$cur" = "-s" ]; then
110N/A COMPREPLY=( $unpackots )
110N/A return 0
110N/A fi
110N/A case "$prev" in
110N/A "-x")
110N/A COMPREPLY=( $( compgen -d -- "$cur" ) \
110N/A $( compgen -f -X '!*.dsc' -- "$cur" ) )
110N/A return 0
110N/A ;;
110N/A *)
110N/A COMPREPLY=( $unpackopts $(compgen -d -f -- "$cur" ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A return 0
110N/A ;;
110N/A "pack")
110N/A if [ "$cur" = "-" ]; then
110N/A COMPREPLY=( $packopts )
110N/A return 0
110N/A fi
110N/A if [ "$cur" = "-s" ]; then
110N/A COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
110N/A "-sA" "-sK" "-sP" "-sU" "-sR" )
110N/A return 0
110N/A fi
110N/A case "$prev" in
110N/A "-b")
110N/A COMPREPLY=( $( compgen -d -- "$cur" ) )
110N/A return 0
110N/A ;;
110N/A "-c"|"-l"|"-T"|"-i"|"-I")
110N/A # -c: get controlfile
110N/A # -l: get per-version info from this file
110N/A # -T: read variables here, not debian/substvars
110N/A # -i: <regexp> filter out files to ignore diffs of.
110N/A # -I: filter out files when building tarballs.
110N/A # return directory names and file names
110N/A COMPREPLY=( $( compgen -d -f ) )
110N/A return 0
110N/A ;;
110N/A "-F")
110N/A # -F: force change log format
110N/A COMPREPLY=( $( ( cd /usr/lib/dpkg/parsechangelog; compgen -f "$cur" ) ) )
110N/A return 0
110N/A ;;
110N/A "-V"|"-D")
110N/A # -V: set a substitution variable
110N/A # we don't know anything about possible variables or values
110N/A # so we don't try to suggest any completion.
110N/A COMPREPLY=()
110N/A return 0
110N/A ;;
110N/A "-D")
110N/A # -D: override or add a .dsc field and value
110N/A # if $cur doesn't contain a = yet, suggest variable names
110N/A if echo -- "$cur" | grep -q "="; then
110N/A # $cur contains a "="
110N/A COMPREPLY=()
110N/A return 0
110N/A else
110N/A COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
110N/A return 0
110N/A fi
110N/A ;;
110N/A "-U")
110N/A # -U: remove a field
110N/A # Suggest possible fieldnames
110N/A COMPREPLY=( Format Source Version Binary Maintainer Uploader Architecture Standards-Version Build-Depends Files )
110N/A return 0
110N/A ;;
110N/A *)
110N/A COMPREPLY=( $packopts )
110N/A return 0
110N/A ;;
110N/A esac
110N/A return 0
110N/A ;;
110N/A *)
110N/A # if seeing a partial option, return possible completions.
110N/A if [ "$cur" = "-s" ]; then
110N/A COMPREPLY=( "-sa" "-sk" "-sp" "-su" "-sr" "-ss" "-sn" \
110N/A "-sA" "-sK" "-sP" "-sU" "-sR" )
110N/A return 0
110N/A fi
110N/A # else return all possible options.
110N/A COMPREPLY=( $options )
110N/A return 0
110N/A ;;
110N/A esac
110N/A} &&
110N/Acomplete -F _dpkg_source dpkg-source
110N/A
110N/A# Debian Linux dselect(8) completion.
110N/A#
110N/Ahave dselect &&
110N/A_dselect()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A --admindir)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A
110N/A -@(D|debug))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--admindir --help --version --licence \
110N/A --license --expert --debug' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W 'access update select install config \
110N/A remove quit' -- $cur ) )
110N/A fi
110N/A
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _dselect $filenames dselect
110N/A
110N/A# Java completion
110N/A#
110N/A
110N/A# available path elements completion
110N/Ahave java && {
110N/A_java_path()
110N/A{
110N/A cur=${cur##*:}
110N/A _filedir '@(jar|zip)'
110N/A}
110N/A
110N/A# exact classpath determination
110N/A_java_find_classpath()
110N/A{
110N/A local i
110N/A
110N/A # search first in current options
110N/A for (( i=1; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" == -@(cp|classpath) ]]; then
110N/A classpath=${COMP_WORDS[i+1]}
110N/A break
110N/A fi
110N/A done
110N/A
110N/A # default to environment
110N/A [ -z "$classpath" ] && classpath=$CLASSPATH
110N/A
110N/A # default to current directory
110N/A [ -z "$classpath" ] && classpath=.
110N/A}
110N/A
110N/A# exact sourcepath determination
110N/A_java_find_sourcepath()
110N/A{
110N/A local i
110N/A
110N/A # search first in current options
110N/A for (( i=1; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" == -sourcepath ]]; then
110N/A sourcepath=${COMP_WORDS[i+1]}
110N/A break
110N/A fi
110N/A done
110N/A
110N/A # default to classpath
110N/A [ -z "$sourcepath" ] && _java_find_classpath
110N/A sourcepath=$classpath
110N/A}
110N/A
110N/A# available classes completion
110N/A_java_classes()
110N/A{
110N/A local classpath i
110N/A
110N/A # find which classpath to use
110N/A _java_find_classpath
110N/A
110N/A # convert package syntax to path syntax
110N/A cur=${cur//.//}
110N/A # parse each classpath element for classes
110N/A for i in ${classpath//:/ }; do
110N/A if [ -r $i ] && [[ "$i" == *.@(jar|zip) ]]; then
110N/A if type zipinfo &> /dev/null; then
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( zipinfo -1 \
110N/A "$i" | grep "^$cur" | grep '\.class$' | \
110N/A grep -v "\\$" ) )
110N/A else
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( jar tf "$i" \
110N/A "$cur" | grep "\.class$" | grep -v "\\$" ) )
110N/A fi
110N/A
110N/A elif [ -d $i ]; then
110N/A i=${i%/}
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( find "$i" -type f \
110N/A -path "$i/$cur*.class" 2>/dev/null | \
110N/A grep -v "\\$" | sed -e "s|^$i/||" ) )
110N/A fi
110N/A done
110N/A
110N/A # remove class extension
110N/A COMPREPLY=( ${COMPREPLY[@]%.class} )
110N/A # convert path syntax to package syntax
110N/A COMPREPLY=( ${COMPREPLY[@]//\//.} )
110N/A}
110N/A
110N/A# available packages completion
110N/A_java_packages()
110N/A{
110N/A local sourcepath i
110N/A
110N/A # find wich sourcepath to use
110N/A _java_find_sourcepath
110N/A
110N/A # convert package syntax to path syntax
110N/A cur=${cur//.//}
110N/A # parse each sourcepath element for packages
110N/A for i in ${sourcepath//:/ }; do
110N/A if [ -d $i ]; then
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( command ls -F -d \
110N/A $i/$cur* 2>/dev/null | sed -e 's|^'$i'/||' ) )
110N/A fi
110N/A done
110N/A # keep only packages
110N/A COMPREPLY=( $( echo "${COMPREPLY[@]}" | tr " " "\n" | grep "/$" ) )
110N/A # remove packages extension
110N/A COMPREPLY=( ${COMPREPLY[@]%/} )
110N/A # convert path syntax to package syntax
110N/A cur=${COMPREPLY[@]//\//.}
110N/A}
110N/A
110N/A# java completion
110N/A#
110N/A_java()
110N/A{
110N/A local cur prev i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A for ((i=1; i < $COMP_CWORD; i++)); do
110N/A case ${COMP_WORDS[$i]} in
110N/A -cp|-classpath)
110N/A ((i++)) # skip the classpath string.
110N/A ;;
110N/A -*)
110N/A # this is an option, not a class/jarfile name.
110N/A ;;
110N/A *)
110N/A # once we've seen a class, just do filename completion
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A done
110N/A
110N/A case $prev in
110N/A -@(cp|classpath))
110N/A _java_path
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # relevant options completion
110N/A COMPREPLY=( $( compgen -W '-client -hotspot -server -classic \
110N/A -cp -classpath -D -verbose -verbose:class \
110N/A -verbose:gc -version:jni -version \
110N/A -showversion -? -help -X -jar \
110N/A -ea -enableassertions -da -disableassertions \
110N/A -esa -enablesystemassertions \
110N/A -dsa -disablesystemassertions ' -- $cur ) )
110N/A else
110N/A if [[ "$prev" == -jar ]]; then
110N/A # jar file completion
110N/A _filedir jar
110N/A else
110N/A # classes completion
110N/A _java_classes
110N/A fi
110N/A fi
110N/A}
110N/Acomplete -F _java $filenames java
110N/A}
110N/A
110N/A# javadoc completion
110N/A#
110N/Ahave javadoc &&
110N/A_javadoc()
110N/A{
110N/A COMPREPLY=()
110N/A local cur prev
110N/A
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case $prev in
110N/A -@(overview|helpfile|stylesheetfile))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -d)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A -@(classpath|bootclasspath|docletpath|sourcepath|extdirs))
110N/A _java_path
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # relevant options completion
110N/A COMPREPLY=( $( compgen -W '-overview -public -protected \
110N/A -package -private -help -doclet -docletpath \
110N/A -sourcepath -classpath -exclude -subpackages \
110N/A -breakiterator -bootclasspath -source -extdirs \
110N/A -verbose -locale -encoding -J -d -use -version \
110N/A -author -docfilessubdirs -splitindex \
110N/A -windowtitle -doctitle -header -footer -bottom \
110N/A -link -linkoffline -excludedocfilessubdir \
110N/A -group -nocomment -nodeprecated -noqualifier \
110N/A -nosince -nodeprecatedlist -notree -noindex \
110N/A -nohelp -nonavbar -quiet -serialwarn -tag \
110N/A -taglet -tagletpath -charset -helpfile \
110N/A -linksource -stylesheetfile -docencoding' -- \
110N/A $cur ) )
110N/A else
110N/A # source files completion
110N/A _filedir java
110N/A # packages completion
110N/A _java_packages
110N/A fi
110N/A} &&
110N/Acomplete -F _javadoc $filenames javadoc
110N/A
110N/A# javac completion
110N/A#
110N/Ahave javac &&
110N/A_javac()
110N/A{
110N/A COMPREPLY=()
110N/A local cur prev
110N/A
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case $prev in
110N/A -d)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A -@(classpath|bootclasspath|sourcepath|extdirs))
110N/A _java_path
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # relevant options completion
110N/A COMPREPLY=( $( compgen -W '-g -g:none -g:lines -g:vars\
110N/A -g:source -O -nowarn -verbose -deprecation -classpath\
110N/A -sourcepath -bootclasspath -extdirs -d -encoding -source\
110N/A -target -help' -- $cur ) )
110N/A else
110N/A # source files completion
110N/A _filedir java
110N/A fi
110N/A} &&
110N/Acomplete -F _javac $filenames javac
110N/A
110N/A# PINE address-book completion
110N/A#
110N/Ahave pine &&
110N/A_pineaddr()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A COMPREPLY=( $( compgen -W '$( awk "{print \$1}" ~/.addressbook 2>/dev/null)' \
110N/A -- $cur ) )
110N/A} &&
110N/Acomplete -F _pineaddr $default pine
110N/A
110N/A# mutt completion
110N/A#
110N/A# Mutt doesn't have an "addressbook" like Pine, but it has aliases and
110N/A# a "query" function to retrieve addresses, so that's what we use here.
110N/Ahave mutt || have muttng && {
110N/A_muttaddr()
110N/A{
110N/A _muttaliases
110N/A _muttquery
110N/A return 0
110N/A}
110N/A
110N/A_muttconffiles()
110N/A{
110N/A local file sofar
110N/A local -a newconffiles
110N/A
110N/A sofar=" $1 "
110N/A shift
110N/A while [[ "$1" ]]; do
110N/A newconffiles=( $(sed -rn 's|^source[[:space:]]+([^[:space:]]+).*$|\1|p' $(eval echo $1) ) )
110N/A for file in "${newconffiles[@]}"; do
110N/A [[ ! "$file" ]] || [[ "${sofar/ ${file} / }" != "$sofar" ]] &&
110N/A continue
110N/A sofar="$sofar $file"
110N/A sofar=" $(eval _muttconffiles \"$sofar\" $file) "
110N/A done
110N/A shift
110N/A done
110N/A echo $sofar
110N/A}
110N/A
110N/A_muttaliases()
110N/A{
110N/A local cur muttrc
110N/A local -a conffiles aliases
110N/A cur=`_get_cword`
110N/A
110N/A [ -f ~/.${muttcmd}/${muttcmd}rc ] && muttrc="~/.${muttcmd}/${muttcmd}rc"
110N/A [ -f ~/.${muttcmd}rc ] && muttrc="~/.${muttcmd}rc"
110N/A [ -z "$muttrc" ] && return 0
110N/A
110N/A conffiles=( $(eval _muttconffiles $muttrc $muttrc) )
110N/A aliases=( $( sed -rn 's|^alias[[:space:]]+([^[:space:]]+).*$|\1|p' \
110N/A $(eval echo "${conffiles[@]}") ) )
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${aliases[*]}" -- $cur ) )
110N/A
110N/A return 0
110N/A}
110N/A
110N/A_muttquery()
110N/A{
110N/A local cur querycmd
110N/A local -a queryresults
110N/A cur=`_get_cword`
110N/A
110N/A querycmd="$( $muttcmd -Q query_command | sed -r 's|^query_command=\"(.*)\"$|\1|; s|%s|'$cur'|' )"
110N/A if [ -z "$cur" -o -z "$querycmd" ]; then
110N/A queryresults=()
110N/A else
110N/A queryresults=( $( $querycmd | \
110N/A sed -nr '2,$s|^([^[:space:]]+).*|\1|p' ) )
110N/A fi
110N/A
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "${queryresults[*]}" \
110N/A -- $cur ) )
110N/A
110N/A return 0
110N/A}
110N/A
110N/A_muttfiledir()
110N/A{
110N/A local cur folder spoolfile
110N/A cur=`_get_cword`
110N/A
110N/A # This is currently not working so well. Perhaps this function should
110N/A # just call _filedir() for the moment.
110N/A if [[ $cur == [=+]* ]]; then
110N/A folder="$( $muttcmd -Q folder | sed -r 's|^folder=\"(.*)\"$|\1|' )"
110N/A : folder:=~/Mail
110N/A
110N/A # Match any file in $folder beginning with $cur
110N/A # (minus the leading '=' sign).
110N/A COMPREPLY=( $( compgen -f -- "$folder/${cur:1}" ) )
110N/A COMPREPLY=( ${COMPREPLY[@]#$folder/} )
110N/A return 0
110N/A elif [ "$cur" == !* ]; then
110N/A spoolfile="$( $muttcmd -Q spoolfile | sed -r 's|^spoolfile=\"(.*)\"$|\1|' )"
110N/A [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}";
110N/A fi
110N/A _filedir
110N/A
110N/A return 0
110N/A}
110N/A
110N/A_mutt()
110N/A{
110N/A local cur prev
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A COMPREPLY=()
110N/A
110N/A [ ${COMP_WORDS[0]} == muttng ] && muttcmd="muttng" || muttcmd="mutt"
110N/A
110N/A case "$cur" in
110N/A -*)
110N/A COMPREPLY=( $( compgen -W '-A -a -b -c -e -f -F -H -i -m -n \
110N/A -p -Q -R -s -v -x -y -z -Z -h' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A *)
110N/A case "$prev" in
110N/A -@(a|f|F|H|i))
110N/A _muttfiledir
110N/A return 0
110N/A ;;
110N/A -A)
110N/A _muttaliases
110N/A return 0
110N/A ;;
110N/A -@(e|m|Q|s|h|p|R|v|y|z|Z))
110N/A return 0
110N/A ;;
110N/A *)
110N/A _muttaddr
110N/A return 0
110N/A ;;
110N/A esac
110N/A ;;
110N/A esac
110N/A
110N/A}
110N/Acomplete -F _mutt $default $filenames mutt muttng
110N/A}
110N/A
110N/A_configure_func()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A # if $COMP_CONFIGURE_HINTS is not null, then completions of the form
110N/A # --option=SETTING will include 'SETTING' as a contextual hint
110N/A [[ "$cur" != -* ]] && return 0
110N/A
110N/A if [ -n "$COMP_CONFIGURE_HINTS" ]; then
110N/A COMPREPLY=( $( $1 --help | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' | grep ^$cur ) )
110N/A
110N/A else
110N/A COMPREPLY=( $( $1 --help | awk '/^ --[A-Za-z]/ { print $1; if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,=].*//g' | grep ^$cur ) )
110N/A fi
110N/A}
110N/Acomplete -F _configure_func $default configure
110N/A
110N/A# Debian reportbug(1) completion
110N/A#
110N/Ahave reportbug &&
110N/A_reportbug()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -f|--filename|-i|--include|--mta|-o|--output)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -B|--bts)
110N/A COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
110N/A $cur ))
110N/A return 0
110N/A ;;
110N/A -e|--editor|--mua)
110N/A COMP_WORDS=(COMP_WORDS[0] $cur)
110N/A COMP_CWORD=1
110N/A _command
110N/A return 0
110N/A ;;
110N/A --mode)
110N/A COMPREPLY=( $( compgen -W "novice standard expert" -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -S|--severity)
110N/A COMPREPLY=( $( compgen -W "grave serious important normal \
110N/A minor wishlist" -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -u|--ui|--interface)
110N/A COMPREPLY=( $( compgen -W "newt text gnome" -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -t|--type)
110N/A COMPREPLY=( $( compgen -W "gnats debbugs" -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -T|--tags)
110N/A COMPREPLY=( $( compgen -W "none patch security upstream sid \
110N/A woody potato sarge fixed" -- $cur ))
110N/A return 0
110N/A ;;
110N/A *)
110N/A ;;
110N/A esac
110N/A
110N/A COMPREPLY=($( compgen -W '-h --help -v --version -a --af -b \
110N/A --no-query-bts --query-bts -B --bts -c --configure \
110N/A --no-config-files --check-available -d --debug \
110N/A --no-check-available -e --editor --email -f \
110N/A --filename -g --gnupg -H --header -i --include -j \
110N/A --justification -l --ldap --no-ldap -L --list-cc -m \
110N/A --maintonly --mode --mua --mta --mutt -n --mh --nmh \
110N/A -o --output -p --print -P --pgp --proxy --http_proxy\
110N/A -q --quiet -Q --query-only --realname --report-quiet \
110N/A --reply-to --replyto -s --subject -S --severity \
110N/A --smtphost -t --type -T --tags --template -V -x \
110N/A --no-cc --package-version -z --no-compress \
110N/A --ui --interface -u \
110N/A wnpp boot-floppies kernel-image' -- $cur ) \
110N/A $( apt-cache pkgnames -- $cur 2> /dev/null ) )
110N/A _filedir
110N/A return 0
110N/A} &&
110N/Acomplete -F _reportbug $filenames reportbug
110N/A
110N/A# Debian querybts(1) completion
110N/A#
110N/Ahave querybts &&
110N/A_querybts()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -B|--bts)
110N/A COMPREPLY=( $( compgen -W "debian guug kde mandrake help" -- \
110N/A $cur ))
110N/A return 0
110N/A ;;
110N/A -u|--ui|--interface)
110N/A COMPREPLY=($( compgen -W "newt text gnome" -- $cur ))
110N/A return 0
110N/A ;;
110N/A *)
110N/A ;;
110N/A esac
110N/A
110N/A COMPREPLY=($( compgen -W '-h --help -v --version -A --archive \
110N/A -B --bts -l --ldap --no-ldap --proxy= --http_proxy= \
110N/A -s --source -w --web -u --ui --interface \
110N/A wnpp boot-floppies' -- $cur ) \
110N/A $( apt-cache pkgnames -- $cur 2> /dev/null ) )
110N/A} &&
110N/Acomplete -F _querybts $filenames querybts
110N/A
110N/A# update-alternatives completion
110N/A#
110N/Ahave update-alternatives && {
110N/Ainstalled_alternatives()
110N/A{
110N/A local admindir
110N/A # find the admin dir
110N/A for i in alternatives dpkg/alternatives rpm/alternatives; do
110N/A [ -d /var/lib/$i ] && admindir=/var/lib/$i && break
110N/A done
110N/A for (( i=1; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" == --admindir ]]; then
110N/A admindir=${COMP_WORDS[i+1]}
110N/A break
110N/A fi
110N/A done
110N/A COMPREPLY=( $( command ls $admindir | grep "^$cur" ) )
110N/A}
110N/A
110N/A_update_alternatives()
110N/A{
110N/A local cur prev mode args i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A --@(altdir|admindir))
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A --@(help|version))
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A # find wich mode to use and how many real args used so far
110N/A for (( i=1; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" == --@(install|remove|auto|display|config|remove-all) ]]; then
110N/A mode=${COMP_WORDS[i]}
110N/A args=$(($COMP_CWORD - i))
110N/A break
110N/A fi
110N/A done
110N/A
110N/A case $mode in
110N/A --install)
110N/A case $args in
110N/A 1)
110N/A _filedir
110N/A ;;
110N/A 2)
110N/A installed_alternatives
110N/A ;;
110N/A 3)
110N/A _filedir
110N/A ;;
110N/A esac
110N/A ;;
110N/A --remove)
110N/A case $args in
110N/A 1)
110N/A installed_alternatives
110N/A ;;
110N/A 2)
110N/A _filedir
110N/A ;;
110N/A esac
110N/A ;;
110N/A --auto)
110N/A installed_alternatives
110N/A ;;
110N/A --remove-all)
110N/A installed_alternatives
110N/A ;;
110N/A --display)
110N/A installed_alternatives
110N/A ;;
110N/A --config)
110N/A installed_alternatives
110N/A ;;
110N/A *)
110N/A COMPREPLY=( $( compgen -W '--verbose --quiet --help --version \
110N/A --altdir --admindir' -- $cur ) \
110N/A $( compgen -W '--install --remove --auto --display \
110N/A --config' -- $cur ) )
110N/A esac
110N/A}
110N/Acomplete -F _update_alternatives update-alternatives
110N/A}
110N/A
110N/A# Python completion
110N/A#
110N/Ahave python &&
110N/A_python()
110N/A{
110N/A local prev cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]##*/}
110N/A
110N/A case "$prev" in
110N/A -Q)
110N/A COMPREPLY=( $( compgen -W "old new warn warnall" -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -W)
110N/A COMPREPLY=( $( compgen -W "ignore default all module once error" -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -c)
110N/A _filedir '@(py|pyc|pyo)'
110N/A return 0
110N/A ;;
110N/A !(python|-?))
110N/A [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
110N/A ;;
110N/A esac
110N/A
110N/A
110N/A # if '-c' is already given, complete all kind of files.
110N/A for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
110N/A if [[ ${COMP_WORDS[i]} == -c ]]; then
110N/A _filedir
110N/A fi
110N/A done
110N/A
110N/A
110N/A if [[ "$cur" != -* ]]; then
110N/A _filedir '@(py|pyc|pyo)'
110N/A else
110N/A COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
110N/A -U -v -V -W -x -c" -- $cur ) )
110N/A fi
110N/A
110N/A
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _python $filenames python
110N/A
110N/A# Perl completion
110N/A#
110N/Ahave perl &&
110N/A{
110N/A_perlmodules()
110N/A{
110N/A COMPREPLY=( $( compgen -P "$prefix" -W "$( perl -e 'sub mods { my ($base,$dir)=@_; return if $base !~ /^\Q$ENV{cur}/; chdir($dir) or return; for (glob(q[*.pm])) {s/\.pm$//; print qq[$base$_\n]}; mods(/^(?:[.\d]+|$Config{archname}-$Config{osname}|auto)$/ ? undef : qq[${base}${_}\\\\:\\\\:],qq[$dir/$_]) for grep {-d} glob(q[*]); } mods(undef,$_) for @INC;' )" -- $cur ) )
110N/A}
110N/A
110N/A_perl()
110N/A{
110N/A local cur prev prefix temp
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A prefix=""
110N/A
110N/A # completing an option (may or may not be separated by a space)
110N/A if [[ "$cur" == -?* ]]; then
110N/A temp=$cur
110N/A prev=${temp:0:2}
110N/A cur=${temp:2}
110N/A prefix=$prev
110N/A fi
110N/A
110N/A # only handle module completion for now
110N/A case "$prev" in
110N/A -I|-x)
110N/A COMPREPLY=( $( compgen -d -P "$prev" -- "$cur" ) )
110N/A return 0
110N/A ;;
110N/A -m|-M)
110N/A _perlmodules
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A # handle case where first parameter is not a dash option
110N/A if [[ "${COMP_WORDS[COMP_CWORD]}" != -* ]]; then
110N/A _filedir
110N/A return 0
110N/A fi
110N/A
110N/A # complete using basic options
110N/A COMPREPLY=( $( compgen -W '-C -s -T -u -U -W -X -h -v -V -c -w -d -D -p \
110N/A -n -a -F -l -0 -I -m -M -P -S -x -i -e ' -- $cur ) )
110N/A return 0
110N/A}
110N/Acomplete -F _perl $filenames perl
110N/A
110N/A_perldoc()
110N/A{
110N/A local cur prev prefix temp
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A prefix=""
110N/A
110N/A # completing an option (may or may not be separated by a space)
110N/A if [[ "$cur" == -?* ]]; then
110N/A temp=$cur
110N/A prev=${temp:0:2}
110N/A cur=${temp:2}
110N/A prefix=$prev
110N/A fi
110N/A
110N/A # complete builtin perl functions
110N/A case $prev in
110N/A -f)
110N/A COMPREPLY=( $( compgen -W 'chomp chop chr crypt hex index lc \
110N/A lcfirst length oct ord pack q qq reverse rindex sprintf \
110N/A substr tr uc ucfirst y m pos quotemeta s split study qr abs \
110N/A atan2 cos exp hex int log oct rand sin sqrt srand pop push \
110N/A shift splice unshift grep join map qw reverse sort unpack \
110N/A delete each exists keys values binmode close closedir \
110N/A dbmclose dbmopen die eof fileno flock format getc print \
110N/A printf read readdir rewinddir seek seekdir select syscall \
110N/A sysread sysseek syswrite tell telldir truncate warn write \
110N/A pack read syscall sysread syswrite unpack vec -X chdir chmod \
110N/A chown chroot fcntl glob ioctl link lstat mkdir open opendir \
110N/A readlink rename rmdir stat symlink umask unlink utime caller \
110N/A continue do dump eval exit goto last next redo return \
110N/A sub wantarray caller import local my our package use defined \
110N/A formline reset scalar undef \
110N/A alarm exec fork getpgrp getppid getpriority kill pipe qx \
110N/A setpgrp setpriority sleep system times wait waitpid \
110N/A import no package require use bless dbmclose dbmopen package \
110N/A ref tie tied untie use accept bind connect getpeername \
110N/A getsockname getsockopt listen recv send setsockopt shutdown \
110N/A socket socketpair msgctl msgget msgrcv msgsnd semctl semget \
110N/A semop shmctl shmget shmread shmwrite endgrent endhostent \
110N/A endnetent endpwent getgrent getgrgid getgrnam getlogin \
110N/A getpwent getpwnam getpwuid setgrent setpwent endprotoent \
110N/A endservent gethostbyaddr gethostbyname gethostent \
110N/A getnetbyaddr getnetbyname getnetent getprotobyname \
110N/A getprotobynumber getprotoent getservbyname getservbyport \
110N/A getservent sethostent setnetent setprotoent setservent \
110N/A gmtime localtime time times' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A case $cur in
110N/A -*)
110N/A COMPREPLY=( $( compgen -W '-h -v -t -u -m -l -F -X -f -q' -- $cur ))
110N/A return 0
110N/A ;;
110N/A */*)
110N/A return 0
110N/A ;;
110N/A *)
110N/A _perlmodules
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '$( PAGER=cat man perl 2>/dev/null | sed -ne "/perl.*Perl overview/,/perlwin32/s/^[^a-z0-9]*\([a-z0-9]*\).*$/\1/p")' -- $cur ) )
110N/A
110N/A return 0
110N/A ;;
110N/A esac
110N/A}
110N/Acomplete -F _perldoc $default perldoc
110N/A}
110N/A
110N/A# rcs(1) completion
110N/A#
110N/Ahave rcs &&
110N/A_rcs()
110N/A{
110N/A local cur prev file dir i
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A file=${cur##*/}
110N/A dir=${cur%/*}
110N/A
110N/A # deal with relative directory
110N/A [ "$file" = "$dir" ] && dir=.
110N/A
110N/A COMPREPLY=( $( compgen -f "$dir/RCS/$file" ) )
110N/A
110N/A for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
110N/A file=${COMPREPLY[$i]##*/}
110N/A dir=${COMPREPLY[$i]%RCS/*}
110N/A COMPREPLY[$i]=$dir$file
110N/A done
110N/A
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( compgen -G "$dir/$file*,v" ) )
110N/A
110N/A for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
110N/A COMPREPLY[$i]=${COMPREPLY[$i]%,v}
110N/A done
110N/A
110N/A # default to files if nothing returned and we're checking in.
110N/A # otherwise, default to directories
110N/A [ ${#COMPREPLY[@]} -eq 0 -a $1 = ci ] && _filedir || _filedir -d
110N/A} &&
110N/Acomplete -F _rcs $filenames ci co rlog rcs rcsdiff
110N/A
110N/A# lilo(8) completion
110N/A#
110N/Ahave lilo && {
110N/A_lilo_labels()
110N/A{
110N/A COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \
110N/A /etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) )
110N/A}
110N/A
110N/A_lilo()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case $prev in
110N/A -@(C|i|m|s|S))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -r)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A -@(I|D|R))
110N/A # label completion
110N/A _lilo_labels
110N/A return 0
110N/A ;;
110N/A -@(A|b|M|u|U))
110N/A # device completion
110N/A cur=${cur:=/dev/}
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -T)
110N/A # topic completion
110N/A COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
110N/A table= video' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # relevant options completion
110N/A COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
110N/A -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \
110N/A $cur ) )
110N/A fi
110N/A}
110N/Acomplete -F _lilo lilo
110N/A}
110N/A
110N/A# links completion
110N/A#
110N/Ahave links &&
110N/A_links()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A case "$cur" in
110N/A --*)
110N/A COMPREPLY=( $( compgen -W '--help' -- $cur ) )
110N/A ;;
110N/A -*)
110N/A COMPREPLY=( $( compgen -W '-async-dns -max-connections \
110N/A -max-connections-to-host -retries \
110N/A -receive-timeout -unrestartable-receive-timeout\
110N/A -format-cache-size -memory-cache-size \
110N/A -http-proxy -ftp-proxy -download-dir \
110N/A -assume-codepage -anonymous -dump -no-connect \
110N/A -source -version -help' -- $cur ) )
110N/A ;;
110N/A *)
110N/A if [ -r ~/.links/links.his ]; then
110N/A COMPREPLY=( $( compgen -W '$( < ~/.links/links.his )' \
110N/A -- $cur ) )
110N/A fi
110N/A _filedir '@(htm|html)'
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _links $filenames links
110N/A
110N/A[ $UNAME = FreeBSD ] && {
110N/A# FreeBSD package management tool completion
110N/A#
110N/A_pkg_delete()
110N/A{
110N/A local cur pkgdir prev
110N/A
110N/A pkgdir=${PKG_DBDIR:-/var/db/pkg}/
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A [ "$prev" = "-o" -o "$prev" = "-p" -o "$prev" = "-W" ] && return 0
110N/A
110N/A COMPREPLY=( $( compgen -d $pkgdir$cur ) )
110N/A COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _pkg_delete $dirnames pkg_delete pkg_info
110N/Ahave pkg_deinstall && complete -F _pkg_delete $dirnames pkg_deinstall
110N/A
110N/A# FreeBSD kernel module commands
110N/A#
110N/A_kldload()
110N/A{
110N/A local cur moddir
110N/A
110N/A moddir=/modules/
110N/A [ -d $moddir ] || moddir=/boot/kernel/
110N/A cur=`_get_cword`
110N/A
110N/A COMPREPLY=( $( compgen -f $moddir$cur ) )
110N/A COMPREPLY=( ${COMPREPLY[@]#$moddir} )
110N/A COMPREPLY=( ${COMPREPLY[@]%.ko} )
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _kldload $filenames kldload
110N/A
110N/A_kldunload()
110N/A{
110N/A local cur
110N/A cur=`_get_cword`
110N/A COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
110N/A}
110N/Acomplete -F _kldunload $filenames kldunload
110N/A}
110N/A
110N/A# FreeBSD portupgrade completion
110N/A#
110N/Ahave portupgrade &&
110N/A_portupgrade()
110N/A{
110N/A local cur pkgdir prev
110N/A
110N/A pkgdir=${PKG_DBDIR:-/var/db/pkg}/
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
110N/A
110N/A COMPREPLY=( $( compgen -d $pkgdir$cur ) )
110N/A COMPREPLY=( ${COMPREPLY[@]#$pkgdir} )
110N/A COMPREPLY=( ${COMPREPLY[@]%-*} )
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _portupgrade $dirnames portupgrade
110N/A
110N/A# FreeBSD portinstall completion
110N/A#
110N/Ahave portinstall &&
110N/A_portinstall()
110N/A{
110N/A local cur portsdir prev indexfile
110N/A local -a COMPREPLY2
110N/A
110N/A portsdir=${PORTSDIR:-/usr/ports}/
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A # First try INDEX-5
110N/A indexfile=$portsdir/INDEX-5
110N/A # Then INDEX if INDEX-5 does not exist or system is not FreeBSD 5.x
110N/A [ "${OSTYPE%.*}" = "freebsd5" -a -f $indexfile ] ||
110N/A indexfile=$portsdir/INDEX
110N/A
110N/A [ "$prev" = "-l" -o "$prev" = "-L" -o "$prev" = "-o" ] && return 0
110N/A
110N/A COMPREPLY=( $( egrep "^$cur" < $indexfile | cut -d'|' -f1 ) )
110N/A COMPREPLY2=( $( egrep "^[^\|]+\|$portsdir$cur" < $indexfile | \
110N/A cut -d'|' -f2 ) )
110N/A COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
110N/A COMPREPLY=( "${COMPREPLY[@]}" "${COMPREPLY2[@]}" )
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _portinstall $dirnames portinstall
110N/A
110N/A# Slackware Linux removepkg completion
110N/A#
110N/Ahave removepkg && [ -f /etc/slackware-version ] &&
110N/A_removepkg()
110N/A{
110N/A local packages cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
110N/A} &&
110N/Acomplete -F _removepkg $filenames removepkg &&
110N/A complete $dirnames -f -X '!*.tgz' installpkg upgradepkg explodepkg
110N/A
110N/A# look(1) completion
110N/A#
110N/Ahave look &&
110N/A_look()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD = 1 ]; then
110N/A COMPREPLY=( $( compgen -W '$(look $cur)' ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _look $default look
110N/A
110N/A# ypcat(1) and ypmatch(1) completion
110N/A#
110N/Ahave ypmatch &&
110N/A_ypmatch()
110N/A{
110N/A local cur map
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A [ $1 = ypcat ] && [ $COMP_CWORD -gt 1 ] && return 0
110N/A [ $1 = ypmatch ] && [ $COMP_CWORD -gt 2 ] && return 0
110N/A
110N/A if [ $1 = ypmatch ] && [ $COMP_CWORD -eq 1 ] && \
110N/A [ ${#COMP_WORDS[@]} -eq 3 ]; then
110N/A map=${COMP_WORDS[2]}
110N/A COMPREPLY=( $( compgen -W '$( ypcat $map | \
110N/A cut -d':' -f 1 )' -- $cur) )
110N/A else
110N/A [ $1 = ypmatch ] && [ $COMP_CWORD -ne 2 ] && return 0
110N/A COMPREPLY=( $( compgen -W \
110N/A '$( echo $(ypcat -x | cut -d"\"" -f 2))' -- $cur))
110N/A fi
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _ypmatch ypmatch ypcat
110N/A
110N/A# mplayer(1) completion
110N/A#
110N/Ahave mplayer && {
110N/A_mplayer_options_list()
110N/A{
110N/A cur=${cur%\\}
110N/A COMPREPLY=( $( $1 $2 help 2> /dev/null | \
110N/A sed -e '1,/^Available/d' | awk '{print $1}' | \
110N/A sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' | \
110N/A grep "^$cur" ) )
110N/A}
110N/A
110N/A_mplayer()
110N/A{
110N/A local cmd cur prev skinsdir IFS=$' \t\n' i j k=0
110N/A
110N/A COMPREPLY=()
110N/A cmd=${COMP_WORDS[0]}
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(ac|afm|vc|vfm|ao|vo|vop|fstype))
110N/A _mplayer_options_list mplayer $prev
110N/A return 0
110N/A ;;
110N/A -@(oac|ovc|of))
110N/A _mplayer_options_list mencoder $prev
110N/A return 0
110N/A ;;
110N/A -audiofile)
110N/A _filedir '@(mp3|MP3|mpg|MPG|ogg|OGG|wav|WAV|mid|MID|flac|FLAC|mka|MKA)'
110N/A return 0
110N/A ;;
110N/A -font)
110N/A _filedir '@(desc|ttf)'
110N/A return 0
110N/A ;;
110N/A -sub)
110N/A _filedir '@(srt|SRT|sub|SUB|txt|TXT|utf|UTF|rar|RAR|mpsub|smi|js|ssa|SSA|aas|AAS)'
110N/A return 0
110N/A ;;
110N/A -vobsub)
110N/A _filedir '@(idx|IDX|ifo|IFO|sub|SUB)'
110N/A IFS=$'\t\n'
110N/A COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
110N/A if [ -f $i -a -r $i ]; then
110N/A echo ${i%.*}
110N/A else
110N/A echo $i
110N/A fi
110N/A done ) )
110N/A IFS=$' \t\n'
110N/A return 0
110N/A ;;
110N/A -ifo)
110N/A _filedir '@(ifo|IFO)'
110N/A return 0
110N/A ;;
110N/A -cuefile)
110N/A _filedir '@(bin|BIN|cue|CUE)'
110N/A return 0
110N/A ;;
110N/A -skin)
110N/A # if you don't have installed mplayer in /usr you
110N/A # may want to set the MPLAYER_SKINS_DIR global variable
110N/A if [ -n "$MPLAYER_SKINS_DIR" ]; then
110N/A skinsdir=$MPLAYER_SKINS_DIR
110N/A else
110N/A skinsdir=/usr/share/mplayer/Skin
110N/A fi
110N/A
110N/A IFS=$'\t\n'
110N/A for i in ~/.mplayer/Skin $skinsdir; do
110N/A if [ -d $i -a -r $i ]; then
110N/A for j in $( compgen -d $i/$cur ); do
110N/A COMPREPLY[$k]=${j#$i/}
110N/A k=$((++k))
110N/A done
110N/A fi
110N/A done
110N/A IFS=$' \t\n'
110N/A return 0
110N/A ;;
110N/A -@(mixer|@(cdrom|dvd)-device|dvdauth|fb|zrdev))
110N/A cur=${cur:=/dev/}
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -@(edl?(out)|lircconf|menu-cfg|playlist|csslib|dumpfile)| \
110N/A -@(subfile|vobsub|aofile|fbmodeconfig|include|o|dvdkey)| \
110N/A -passlogfile)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -@(auto@(q|sync)|loop|menu-root|speed|sstep|aid|alang)| \
110N/A -@(?(@(audio|sub)-)demuxer|bandwidth|cache|chapter)| \
110N/A -@(dvd?(angle)|fps|frames|mc|passwd|user|sb|srate|ss|vcd)| \
110N/A -@(vi?(d|vo)|ffactor|sid|slang|spu@(align|aa|gauss))| \
110N/A -@(vobsubid|delay|bpp|brightness|contrast|dfbopts|display)| \
110N/A -@(fbmode|geometry|guiwid|hue|icelayer|screen[wh]|wid)| \
110N/A -@(monitor@(aspect|-@(dotclock|[hv]freq))|panscan|saturation)| \
110N/A -@(xineramascreen|zr@(crop|norm|quality|[xy]doff|[vh]dec))| \
110N/A -@(aspect|pp|x|y|xy|z|stereo|audio-@(density|delay|preload))| \
110N/A -@(endpos|osdlevel|ffourcc|sws|channels|skiplimit|format)| \
110N/A -@(ofps|aa@(driver|@(osd|sub)color)|vobsubout?(i@(ndex|d)))| \
110N/A -sub@(-bg-@(alpha|color)|cp|delay|fps|pos|align|width)| \
110N/A -sub@(font-@(blur|outline|autoscale|encoding|@(osd|text)-scale)))
110N/A return 0
110N/A ;;
110N/A -lavdopts)
110N/A COMPREPLY=( $( compgen -W 'ec er= bug= idct= gray' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -lavcopts)
110N/A COMPREPLY=( $( compgen -W 'vcodec= vqmin= vqscale= \
110N/A vqmax= mbqmin= mbqmax= vqdiff= \
110N/A vmax_b_frames= vme= vhq v4mv \
110N/A keyint= vb_strategy= vpass= \
110N/A aspect= vbitrate= vratetol= \
110N/A vrc_maxrate= vrc_minrate= \
110N/A vrc_buf_size= vb_qfactor= vi_qfactor= \
110N/A vb_qoffset= vi_qoffset= vqblur= \
110N/A vqcomp= vrc_eq= vrc_override= \
110N/A vrc_init_cplx= vqsquish= vlelim= \
110N/A vcelim= vstrict= vdpart vpsize= gray \
110N/A vfdct= idct= lumi_mask= dark_mask= \
110N/A tcplx_mask= scplx_mask= naq ildct \
110N/A format= pred qpel precmp= cmp= \
110N/A subcmp= predia= dia= trell last_pred= \
110N/A preme= subq= psnr mpeg_quant aic umv' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -ssf)
110N/A COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= \
110N/A cvs=' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -jpeg)
110N/A COMPREPLY=( $( compgen -W 'noprogressive progressive \
110N/A nobaseline baseline optimize= \
110N/A smooth= quality= outdir=' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -xvidopts)
110N/A COMPREPLY=( $( compgen -W 'dr2 nodr2' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -xvidencopts)
110N/A COMPREPLY=( $( compgen -W 'pass= bitrate= \
110N/A fixed_quant= me_quality= 4mv \
110N/A rc_reaction_delay_factor= \
110N/A rc_averaging_period= rc_buffer= \
110N/A quant_range= min_key_interval= \
110N/A max_key_interval= mpeg_quant \
110N/A mod_quant lumi_mask hintedme \
110N/A hintfile debug keyframe_boost= \
110N/A kfthreshold= kfreduction=' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -divx4opts)
110N/A COMPREPLY=( $( compgen -W 'br= key= deinterlace q= \
110N/A min_quant= max_quant= rc_period= \
110N/A rc_reaction_period= crispness= \
110N/A rc_reaction_ratio= pass= vbrpass= \
110N/A help' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -info)
110N/A COMPREPLY=( $( compgen -W 'name= artist= genre= \
110N/A subject= copyright= srcform= \
110N/A comment= help' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -lameopts)
110N/A COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= \
110N/A ratio= vol= mode= padding= fast \
110N/A preset= help' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -rawaudio)
110N/A COMPREPLY=( $( compgen -W 'on channels= rate= \
110N/A samplesize= format=' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -rawvideo)
110N/A COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif \
110N/A 4cif pal ntsc w= h= y420 yv12 yuy2 \
110N/A y8 format= size=' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -aop)
110N/A COMPREPLY=( $( compgen -W 'list= delay= format= fout= \
110N/A volume= mul= softclip' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -dxr2)
110N/A COMPREPLY=( $( compgen -W 'ar-mode= iec958-encoded \
110N/A iec958-decoded mute ucode= 75ire bw \
110N/A color interlaced macrovision= norm= \
110N/A square-pixel ccir601-pixel cr-left= \
110N/A cr-right= cr-top= cr-bot= ck-rmin= \
110N/A ck-gmin= ck-bmin= ck-rmax= ck-gmax= \
110N/A ck-bmax= ck-r= ck-g= ck-b= \
110N/A ignore-cache= ol-osd= olh-cor= \
110N/A olw-cor= olx-cor= oly-cor= overlay \
110N/A overlay-ratio= update-cache' -- $cur ))
110N/A return 0
110N/A ;;
110N/A -tv)
110N/A COMPREPLY=( $( compgen -W 'on noaudio driver= device= \
110N/A input= freq= outfmt= width= height= \
110N/A buffersize= norm= channel= chanlist= \
110N/A audiorate= forceaudio alsa amode= \
110N/A forcechan= adevice= audioid= volume= \
110N/A bass= treble= balance= fps= \
110N/A channels= immediatemode=' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -mf)
110N/A COMPREPLY=( $( compgen -W 'on w= h= fps= type=' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -cdda)
110N/A COMPREPLY=( $( compgen -W 'speed= paranoia= \
110N/A generic-dev= sector-size= overlap= \
110N/A toc-bias toc-offset= skip noskip' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -input)
110N/A COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate \
110N/A keylist cmdlist js-dev file' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -af)
110N/A COMPREPLY=( $( compgen -W 'resample resample= \
110N/A channels channels= format format= \
110N/A volume volume= delay delay= pan \
110N/A pan= sub sub= surround surround=' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -af-adv)
110N/A COMPREPLY=( $( compgen -W 'force= list=' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A case "$cur" in
110N/A -*)
110N/A COMPREPLY=( $( compgen -W '-aid -alang -audio-demuxer \
110N/A -audiofile -cdrom-device -cache -cdda \
110N/A -channels -chapter -csslib -demuxer \
110N/A -dvd -dvd-device -dvdangle -dvdauth \
110N/A -dvdkey -dvdnav -forceidx -fps -frames \
110N/A -hr-mp3-seek -idx -mc -mf -ni -nobps \
110N/A -passwd -rawaudio -rtsp-stream-over-tcp\
110N/A -skipopening -sb -srate -ss -tv -user \
110N/A -vcd -vid -vivo -ifo -ffactor -font \
110N/A -noautosub -nooverlapsub -sid -slang \
110N/A -sub -subcc -subcp -sub-demuxer \
110N/A -subdelay -subfont-autoscale \
110N/A -subfont-blur -subfont-encoding \
110N/A -subfont-osd-scale -subfont-outline \
110N/A -subfont-text-scale -subfps -subfile \
110N/A -subpos -unicode -utf8 -vobsub \
110N/A -vobsubid -ac -afm -aspect -flip \
110N/A -lavdopts -noaspect -nosound -pp -ssf \
110N/A -stereo -sws -vc -vfm -vop -xvidopts\
110N/A -xy -zoom -bandwidth -cuefile \
110N/A -noextbased -rawvideo -overlapsub \
110N/A -sub-bg-alpha -sub-bg-color -subalign \
110N/A -subwidth -sub-no-text-pp -spualign \
110N/A -spuaa -spugauss -pphelp -verbose -v \
110N/A -noni -noidx -nohr-mp3-seek -extbased \
110N/A -bps -oldpp -nozoom -noflip -nounicode \
110N/A -noutf8' -- $cur ) )
110N/A # add mplayer specific options
110N/A [[ "$cmd" == @(?(g)mplayer) ]] && COMPREPLY=( "${COMPREPLY[@]}" \
110N/A $(compgen -W '-autoq -autosync -benchmark \
110N/A -framedrop -h -help -hardframedrop \
110N/A -identify -input -lircconf -loop \
110N/A -nojoystick -nolirc -nortc -playlist \
110N/A -quiet -really-quiet -rnd -sdp -skin \
110N/A -slave -softsleep -speed -sstep \
110N/A -use-stdin -dumpaudio -dumpfile \
110N/A -dumpstream -dumpvideo -dumpmicrodvdsub\
110N/A -dumpmpsub -dumpsrtsub -dumpjacosub \
110N/A -dumpsami -dumpsub -osdlevel -af \
110N/A -af-adv -ao -aofile -aop -delay -mixer \
110N/A -nowaveheader -bpp -brightness \
110N/A -contrast -display -double -dr -dxr2 \
110N/A -fb -fbmode -fbmodeconfig -forcexv -fs \
110N/A -geometry -hue -icelayer -jpeg \
110N/A -monitor-dotclock -monitor-hfreq \
110N/A -monitor-vfreq -monitoraspect \
110N/A -nograbpointer -noslices -panscan \
110N/A -rootwin -saturation -screenw -screenh \
110N/A -stop-xscreensaver -vm -vo -vsync -wid \
110N/A -xineramascreen -z -zrbw -zrcrop \
110N/A -zrdev -zrfd -zrhelp -zrnorm -zrquality \
110N/A -zrvdec -zrhdec -zrxdoff -zrydoff -y \
110N/A -edl -edlout -enqueue -fixed-vo \
110N/A -menu -menu-root -menu-cfg -shuffle \
110N/A -format -aahelp -dfbopts -fstype \
110N/A -guiwid -nokeepaspect -x --help \
110N/A -aaosdcolor -aasubcolor -aadriver \
110N/A -aaextended -aaeight' -- $cur) )
110N/A # add mencoder specific options
110N/A [[ "$cmd" = mencoder ]] && COMPREPLY=( "${COMPREPLY[@]}" \
110N/A $(compgen -W '-audio-density -audio-delay \
110N/A -audio-preload -divx4opts -endpos \
110N/A -ffourcc -include -info -lameopts \
110N/A -lavcopts -noskip -o -oac -ofps -ovc \
110N/A -passlogfile -skiplimit -vobsubout \
110N/A -vobsuboutindex -vobsuboutid \
110N/A -xvidencopts -of --verbose' -- $cur) )
110N/A ;;
110N/A *)
110N/A _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|flv|FLV|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[34]|MP[34]|m4v|M4V|og[gm]|OG[GM]|wav|WAV|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|ts|TS|3gp|mpc|MPC|flac|FLAC|flv|FLV|divx|DIVX)'
110N/A ;;
110N/A esac
110N/A
110N/A return 0
110N/A}
110N/Acomplete $filenames -F _mplayer mplayer mencoder gmplayer kplayer
110N/A}
110N/A
110N/A# KDE dcop completion
110N/A#
110N/Ahave dcop &&
110N/A_dcop()
110N/A{
110N/A local cur compstr
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A if [ -z $cur ]; then
110N/A compstr=${COMP_WORDS[*]}
110N/A else
110N/A compstr=$( command echo ${COMP_WORDS[*]} | sed "s/ $cur$//" )
110N/A fi
110N/A COMPREPLY=( $( compgen -W '$( command $compstr | sed s/\(.*\)// )' -- $cur ) )
110N/A} &&
110N/Acomplete -F _dcop dcop
110N/A
110N/A# wvdial(1) completion
110N/A#
110N/Ahave wvdial &&
110N/A_wvdial()
110N/A{
110N/A local cur prev config i IFS=$'\t\n'
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case $prev in
110N/A --config)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A case $cur in
110N/A -*)
110N/A COMPREPLY=( $( compgen -W '--config --chat \
110N/A --remotename --help --version --no-syslog' \
110N/A -- $cur ) )
110N/A ;;
110N/A *)
110N/A # start with global and personal config files
110N/A config="/etc/wvdial.conf"$'\t'"$HOME/.wvdialrc"
110N/A # replace with command line config file if present
110N/A for (( i=1; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" == "--config" ]]; then
110N/A config=${COMP_WORDS[i+1]}
110N/A break
110N/A fi
110N/A done
110N/A # parse config files for sections and
110N/A # remove default section
110N/A COMPREPLY=( $( sed -ne \
110N/A "s|^\[Dialer \($cur.*\)\]$|\1|p" \
110N/A $config 2>/dev/null |grep -v '^Defaults$'))
110N/A # escape spaces
110N/A COMPREPLY=${COMPREPLY// /\\ }
110N/A ;;
110N/A esac
110N/A
110N/A} &&
110N/Acomplete -F _wvdial wvdial
110N/A
110N/A# gpg(1) completion
110N/A#
110N/Ahave gpg &&
110N/A_gpg()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(s|-sign|-clearsign|-decrypt-files|-load-extension))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A --@(export|@(?(l|nr|nrl)sign|edit)-key))
110N/A # return list of public keys
110N/A COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*/\([^ ]*\).*\(<\([^>]*\)>\).*$@\1 \3@p')" -- "$cur" ))
110N/A return 0
110N/A ;;
110N/A -@(r|-recipient))
110N/A COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | sed -ne 's@^pub.*<\([^>]*\)>.*$@\1@p')" -- "$cur" ))
110N/A if [ -e ~/.gnupg/gpg.conf ]; then
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$( sed -ne 's@^[ \t]*group[ \t][ \t]*\([^=]*\).*$@\1@p' ~/.gnupg/gpg.conf )" -- "$cur") )
110N/A fi
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-s -b -e -f -c -d -a -r -u -Z -o -v\
110N/A -q -n -N $(gpg --dump-options)' -- $cur ) )
110N/A fi
110N/A
110N/A} &&
110N/Acomplete -F _gpg $default gpg
110N/A
110N/A# iconv(1) completion
110N/A#
110N/Ahave iconv &&
110N/A_iconv()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(f|t|-@(from|to)-code))
110N/A COMPREPLY=( $( compgen -W \
110N/A '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A
110N/A if [[ "$cur" = -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
110N/A --output -o --verbose' -- "$cur" ) )
110N/A return 0
110N/A fi
110N/A} &&
110N/Acomplete -F _iconv $default iconv
110N/A
110N/A# dict(1) completion
110N/A#
110N/A{ have dict || have rdict; } && {
110N/A_dictdata()
110N/A{
110N/A dict $host $port $1 2>/dev/null | sed -ne \
110N/A 's/^['$'\t '']['$'\t '']*\([^'$'\t '']*\).*$/\1/p'
110N/A}
110N/A
110N/A_dict()
110N/A{
110N/A local cur prev host port db dictfile
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A dictfile=/usr/share/dict/words
110N/A
110N/A for (( i=1; i < COMP_CWORD; i++ )); do
110N/A case "${COMP_WORDS[i]}" in
110N/A -@(h|--host))
110N/A host=${COMP_WORDS[i+1]}
110N/A [ -n "$host" ] && host="-h $host"
110N/A i=$((++i))
110N/A ;;
110N/A -@(p|-port))
110N/A port=${COMP_WORDS[i+1]}
110N/A [ -n "$port" ] && port="-p $port"
110N/A i=$((++i))
110N/A ;;
110N/A -@(d|-database))
110N/A db=${COMP_WORDS[i+1]}
110N/A [ -n "$db" ] && host="-d $db"
110N/A i=$((++i))
110N/A ;;
110N/A *)
110N/A ;;
110N/A esac
110N/A done
110N/A
110N/A if [[ "$cur" = -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-h --host -p --port -d --database \
110N/A -m --match -s --strategy -c --config -C \
110N/A --nocorrect -D --dbs -S --strats -H \
110N/A --serverhelp -i --info -I --serverinfo \
110N/A -a --noauth -u --user -k --key -V --version \
110N/A -L --license --help -v --verbose -r --raw \
110N/A -P --pager --debug --html --pipesize --client' \
110N/A -- "$cur" ) )
110N/A return 0
110N/A fi
110N/A
110N/A case "$prev" in
110N/A -@(d|-database|i|info))
110N/A COMPREPLY=( $( compgen -W '$( _dictdata -D )' -- "$cur" ) )
110N/A return 0
110N/A ;;
110N/A -@(s|-strategy))
110N/A COMPREPLY=( $( compgen -W '$( _dictdata -S )' -- "$cur" ) )
110N/A return 0
110N/A ;;
110N/A *)
110N/A ;;
110N/A esac
110N/A
110N/A [ -r $dictfile ] && \
110N/A COMPREPLY=( $( compgen -W '$( cat $dictfile )' -- "$cur" ) )
110N/A}
110N/Acomplete -F _dict $default dict rdict
110N/A}
110N/A
110N/A# cdrecord(1) completion
110N/A#
110N/Ahave cdrecord &&
110N/A_cdrecord()
110N/A{
110N/A local cur prev i generic_options track_options track_mode
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A # foo=bar style option
110N/A if [[ "$cur" == *=* ]]; then
110N/A prev=${cur/=*/}
110N/A cur=${cur/*=/}
110N/A case "$prev" in
110N/A @(text|cue)file)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A blank)
110N/A COMPREPLY=( $( compgen -W 'help all fast \
110N/A track unreserve trtail unclose session' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A driveropts)
110N/A COMPREPLY=( $( compgen -W 'burnfree noburnfree\
110N/A varirec= audiomaster forcespeed noforcespeed\
110N/A speedread nospeedread singlesession \
110N/A nosinglesession hidecdr nohidecdr tattooinfo\
110N/A tattoofile=' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A generic_options=(-version -v -V -d -silent -s -force -immed -dummy \
110N/A -dao -raw -raw96r -raw96p -raw16 -multi -msinfo -toc \
110N/A -atip -fix -nofix -waiti -load -lock -eject -format \
110N/A -setdropts -checkdrive -prcap -inq -scanbus -reset \
110N/A -abort -overburn -ignsize -useinfo -packet -noclose \
110N/A -text debug= kdebug= kd= minbuf= speed= blank= fs= \
110N/A dev= gracetime= timeout= driver= driveropts= \
110N/A defpregap= pktsize= mcn= textfile= cuefile=)
110N/A track_options=(-audio -swab -data -mode2 -xa -xa1 -xa2 -xamix -cdi \
110N/A -isosize -pad padsize= -nopad -shorttrack -noshorttrack\
110N/A pregap= -preemp -nopreemp -copy -nocopy -scms tcsize= \
110N/A isrc= index=)
110N/A # look if previous was either a file or a track option
110N/A track_mode=0
110N/A if [ $COMP_CWORD -gt 1 ]; then
110N/A if [ -f "$prev" ]; then
110N/A track_mode=1
110N/A else
110N/A for (( i=0; i < ${#track_options[@]}; i++ )); do
110N/A if [[ "${track_options[i]}" == "$prev" ]]; then
110N/A track_mode=1
110N/A break
110N/A fi
110N/A done
110N/A fi
110N/A fi
110N/A
110N/A # files are always eligible completion
110N/A _filedir
110N/A # track options are always available
110N/A COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W '${track_options[@]}' -- $cur ) )
110N/A # general options are no more available after file or track option
110N/A if [ $track_mode -eq 0 ]; then
110N/A COMPREPLY=( "${COMPREPLY[@]}" \
110N/A $( compgen -W '${generic_options[@]}' -- $cur ) )
110N/A fi
110N/A
110N/A} &&
110N/Acomplete -F _cdrecord $filenames cdrecord
110N/A
110N/A# mkisofs(8) completion
110N/A#
110N/Ahave mkisofs &&
110N/A_mkisofs()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(o|abstract|biblio|check-session|copyright|log-file|root-info|prep-boot|*-list))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -*-charset)
110N/A COMPREPLY=( $( mkisofs -input-charset help 2>&1 | \
110N/A tail +3 | grep "^$cur") )
110N/A return 0
110N/A ;;
110N/A -uid)
110N/A _uids
110N/A return 0
110N/A ;;
110N/A -gid)
110N/A _gids
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-abstract -A -allow-lowercase \
110N/A -allow-multidot -biblio -cache-inodes \
110N/A -no-cache-inodes -b -eltorito-alt-boot -B -G \
110N/A -hard-disk-boot -no-emul-boot -no-boot \
110N/A -boot-load-seg -boot-load-size \
110N/A -boot-info-table -C -c -check-oldname \
110N/A -check-session -copyright -d -D -dir-mode \
110N/A -dvd-video -f -file-mode -gid -gui \
110N/A -graft-points -hide -hide-list -hidden \
110N/A -hidden-list -hide-joliet -hide-joliet-list \
110N/A -hide-joliet-trans-tbl -hide-rr-moved \
110N/A -input-charset -output-charset -iso-level -J \
110N/A -joliet-long -jcharset -l -L -log-file -m \
110N/A -exclude-list -max-iso9660-filenames -M -N \
110N/A -new-dir-mode -nobak -no-bak -force-rr -no-rr \
110N/A -no-split-symlink-components \
110N/A -no-split-symlink-fields -o -pad -no-pad \
110N/A -path-list -P -p -print-size -quiet -R -r \
110N/A -relaxed-filenames -sort -split-output \
110N/A -stream-media-size -stream-file-name -sysid -T\
110N/A -table-name -ucs-level -udf -uid \
110N/A -use-fileversion -U -no-iso-translate -V \
110N/A -volset -volset-size -volset-seqno -v -x -z \
110N/A -hfs -apple -map -magic -hfs-creator \
110N/A -hfs-type -probe -no-desktop -mac-name \
110N/A -boot-hfs-file -part -auto -cluster-size \
110N/A -hide-hfs -hide-hfs-list -hfs-volid \
110N/A -icon-position -root-info -prep-boot \
110N/A -input-hfs-charset -output-hfs-charset \
110N/A -hfs-unlock -hfs-bless -hfs-parms --cap \
110N/A --netatalk --double --ethershare --ushare \
110N/A --exchange --sgi --xinet --macbin --single \
110N/A --dave --sfm --osx-double --osx-hfs' -- $cur ))
110N/A else
110N/A _filedir
110N/A fi
110N/A
110N/A} &&
110N/Acomplete -F _mkisofs $filenames mkisofs
110N/A
110N/A# mc(1) completion
110N/A#
110N/Ahave mc &&
110N/A_mc()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A # -name value style option
110N/A case "$prev" in
110N/A -@(e|v|l|P))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A # --name=value style option
110N/A if [[ "$cur" == *=* ]]; then
110N/A prev=${cur/=*/}
110N/A cur=${cur/*=/}
110N/A case "$prev" in
110N/A --@(edit|view|ftplog|printwd))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
110N/A --color -C --colors= -d --nomouse -e --edit= -f \
110N/A --datadir -k --resetsoft -l --ftplog= -P --printwd= \
110N/A -s --slow -t --termcap -u --nosubshell -U --subshell \
110N/A -v --view= -V --version -x --xterm -h --help' -- $cur ) )
110N/A else
110N/A _filedir -d
110N/A fi
110N/A} &&
110N/Acomplete -F _mc $filenames mc
110N/A
110N/A# yum(8) completion
110N/A#
110N/Ahave yum && {
110N/A_yum()
110N/A{
110N/A local cur prev special
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
110N/A if [[ ${COMP_WORDS[i]} == @(install|update|upgrade|remove|erase|deplist) ]]; then
110N/A special=${COMP_WORDS[i]}
110N/A fi
110N/A done
110N/A
110N/A if [ -n "$special" ]; then
110N/A case $special in
110N/A install|deplist)
110N/A COMPREPLY=( $( compgen -W '$( yum -C list | cut -d" " -f1 )' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A *)
110N/A _rpm_installed_packages
110N/A return 0
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A case $cur in
110N/A --*)
110N/A COMPREPLY=( $( compgen -W '--installroot --version --help --enablerepo --disablerepo --exclude --obsoletes --noplugins' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -*)
110N/A COMPREPLY=( $( compgen -W '-c -e -d -y -t -R -C -h' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A case $prev in
110N/A list)
110N/A COMPREPLY=( $( compgen -W 'all available updates installed extras obsoletes recent' -- $cur ) )
110N/A ;;
110N/A clean)
110N/A COMPREPLY=( $( compgen -W 'packages headers metadata cache dbcache all' -- $cur ) )
110N/A ;;
110N/A localinstall)
110N/A _filedir rpm
110N/A ;;
110N/A -c)
110N/A _filedir
110N/A ;;
110N/A --installroot)
110N/A _filedir -d
110N/A ;;
110N/A *)
110N/A COMPREPLY=( $( compgen -W 'install update check-update upgrade remove list \
110N/A search info provides clean groupinstall groupupdate \
110N/A grouplist deplist erase groupinfo groupremove \
110N/A localinstall localupdate makecache resolvedep \
110N/A shell whatprovides' -- $cur ) )
110N/A ;;
110N/A esac
110N/A}
110N/Acomplete -F _yum $filenames yum
110N/A
110N/A# yum-arch(8) completion
110N/A#
110N/A_yum_arch()
110N/A{
110N/A local cur
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A case "$cur" in
110N/A -*)
110N/A COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- $cur ) )
110N/A ;;
110N/A *)
110N/A _filedir -d
110N/A ;;
110N/A esac
110N/A
110N/A return 0
110N/A
110N/A}
110N/Acomplete -F _yum_arch $filenames yum-arch
110N/A}
110N/A
110N/A# ImageMagick completion
110N/A#
110N/Ahave convert && {
110N/A_ImageMagick()
110N/A{
110N/A local prev
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -channel)
110N/A COMPREPLY=( $( compgen -W 'Red Green Blue Opacity \
110N/A Matte Cyan Magenta Yellow Black' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -colormap)
110N/A COMPREPLY=( $( compgen -W 'shared private' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -colorspace)
110N/A COMPREPLY=( $( compgen -W 'GRAY OHTA RGB Transparent \
110N/A XYZ YCbCr YIQ YPbPr YUV CMYK' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -compose)
110N/A COMPREPLY=( $( compgen -W 'Over In Out Atop Xor Plus \
110N/A Minus Add Subtract Difference Multiply Bumpmap\
110N/A Copy CopyRed CopyGreen CopyBlue CopyOpacity' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -compress)
110N/A COMPREPLY=( $( compgen -W 'None BZip Fax Group4 JPEG \
110N/A Lossless LZW RLE Zip' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -dispose)
110N/A COMPREPLY=( $( compgen -W 'Undefined None Background \
110N/A Previous' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -encoding)
110N/A COMPREPLY=( $( compgen -W 'AdobeCustom AdobeExpert \
110N/A AdobeStandard AppleRoman BIG5 GB2312 Latin2 \
110N/A None SJIScode Symbol Unicode Wansung' -- $cur))
110N/A return 0
110N/A ;;
110N/A -endian)
110N/A COMPREPLY=( $( compgen -W 'MSB LSB' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -filter)
110N/A COMPREPLY=( $( compgen -W 'Point Box Triangle Hermite \
110N/A Hanning Hamming Blackman Gaussian Quadratic \
110N/A Cubic Catrom Mitchell Lanczos Bessel Sinc' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -format)
110N/A COMPREPLY=( $( convert -list format | \
110N/A awk '/ [r-][w-][+-] / {print $1}' | \
110N/A tr -d '*' | tr [:upper:] [:lower:] | \
110N/A grep "^$cur" ) )
110N/A return 0
110N/A ;;
110N/A -gravity)
110N/A COMPREPLY=( $( compgen -W 'Northwest North NorthEast \
110N/A West Center East SouthWest South SouthEast' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -intent)
110N/A COMPREPLY=( $( compgen -W 'Absolute Perceptual \
110N/A Relative Saturation' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -interlace)
110N/A COMPREPLY=( $( compgen -W 'None Line Plane Partition' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -limit)
110N/A COMPREPLY=( $( compgen -W 'Disk File Map Memory' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -list)
110N/A COMPREPLY=( $( compgen -W 'Delegate Format Magic \
110N/A Module Resource Type' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -map)
110N/A COMPREPLY=( $( compgen -W 'best default gray red \
110N/A green blue' -- $cur ) )
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -noise)
110N/A COMPREPLY=( $( compgen -W 'Uniform Gaussian \
110N/A Multiplicative \
110N/A Impulse Laplacian Poisson' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -preview)
110N/A COMPREPLY=( $( compgen -W 'Rotate Shear Roll Hue \
110N/A Saturation Brightness Gamma Spiff \
110N/A Dull Grayscale Quantize Despeckle \
110N/A ReduceNoise AddNoise Sharpen Blur \
110N/A Treshold EdgeDetect Spread Shade \
110N/A Raise Segment Solarize Swirl Implode \
110N/A Wave OilPaint CharcoalDrawing JPEG' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(mask|profile|texture|tile|write))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -type)
110N/A COMPREPLY=( $( compgen -W 'Bilevel Grayscale Palette \
110N/A PaletteMatte TrueColor TrueColorMatte \
110N/A ColorSeparation ColorSeparationlMatte \
110N/A Optimize' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -units)
110N/A COMPREPLY=( $( compgen -W 'Undefined PixelsPerInch \
110N/A PixelsPerCentimeter' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -virtual-pixel)
110N/A COMPREPLY=( $( compgen -W 'Constant Edge mirror tile' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -visual)
110N/A COMPREPLY=( $( compgen -W 'StaticGray GrayScale \
110N/A StaticColor PseudoColor TrueColor \
110N/A DirectColor defaut visualid' -- $cur ))
110N/A return 0
110N/A ;;
110N/A esac
110N/A}
110N/A
110N/A_convert()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _ImageMagick
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-adjoin -affine -antialias -append \
110N/A -authenticate -average -background -black-threshold \
110N/A -blue-primary -blur -border -bordercolor -channel \
110N/A -charcoal -chop -clip -coalesce -colorize -colors \
110N/A -colorspace -comment -compress -contrast -convolve \
110N/A -crop -cycle -debug -deconstruct -delay -density \
110N/A -depth -despeckle -display -dispose -dither -draw \
110N/A -edge -emboss -encoding -endian -enhance -equalize \
110N/A -extract -fill -filter -flatten -flip -flop -font \
110N/A -frame -fuzz -gamma -gaussian -geometry \
110N/A -green-primary -gravity -help -implode -intent \
110N/A -interlace -label -lat -level -limit -list -log -loop \
110N/A -map -mask -matte -median -modulate -monochrome \
110N/A -morph -mosaic -negate -noop -noise -normalize \
110N/A -opaque -ordered-dither -page -paint -ping -pointsize \
110N/A -preview -profile -quality -raise -random-threshold \
110N/A -region -raise -red-primary -render -resize -resample \
110N/A -roll -rotate -sample -sampling-factor -scale -scene \
110N/A -seed -segment -shade -sharpen -shave -shear -size \
110N/A -solarize -spread -stroke -strokewidth -swirl \
110N/A -texture -threshold -thumbnail -tile -transform \
110N/A -transparent -treedepth -trim -type -undercolor \
110N/A -units -unsharp -verbose -version -view \
110N/A -virtual-pixel -wave -white-point -white-threshold \
110N/A -write' -- $cur ) )
110N/A elif [[ "$cur" == +* ]]; then
110N/A COMPREPLY=( $( compgen -W '+adjoin +append +compress \
110N/A +contrast +debug +dither +endian +gamma +label +map \
110N/A +mask +matte +negate +noise +page +raise +render \
110N/A +write' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A}
110N/Acomplete -F _convert $filenames convert
110N/A
110N/A_mogrify()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _ImageMagick
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-affine -antialias -authenticate \
110N/A -background -black-threshold -blue-primary -blur \
110N/A -border -bordercolor -channel -charcoal -chop \
110N/A -colorize -colors -colorspace -comment -compress \
110N/A -contrast -convolve -crop -cycle -debug -delay \
110N/A -density -depth -despeckle -display -dispose -dither \
110N/A -draw -edge -emboss -encoding -endian -enhance \
110N/A -equalize -extract -fill -filter -flip -flop -font \
110N/A -format -frame -fuzz -gamma -gaussian -geometry \
110N/A -green-primary -implode -interlace -help -label -lat \
110N/A -level -limit -list -log -loop -map -mask -matte \
110N/A -median -modulate -monochrome -negate -noop \
110N/A -normalize -opaque -page -paint -fill -ordered-dither \
110N/A -pointsize -profile -quality -raise -random-threshold \
110N/A -red-primary -region -resample -resize -roll -rotate \
110N/A -sample -sampling-factor -scale -scene -seed -segment \
110N/A -shade -sharpen -shear -size -solarize -spread \
110N/A -stroke -strokewidth -swirl -texture -threshold \
110N/A -thumbnail -tile -transform -transparent -treedepth \
110N/A -trim -type -undercolor -units -unsharp -verbose \
110N/A -version -view -virtual-pixel -wave -white-point \
110N/A -white-threshold' -- $cur ) )
110N/A elif [[ "$cur" == +* ]]; then
110N/A COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
110N/A +endian +gamma +label +map +mask +matte +negate +page \
110N/A +raise' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A}
110N/Acomplete -F _mogrify $filenames mogrify
110N/A
110N/A_display()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _ImageMagick
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-authenticate -backdrop -border \
110N/A -colormap -colors -colorspace -comment -compress \
110N/A -contrast -crop -debug -delay -density -depth \
110N/A -despeckle -display -dispose -dither -edge -endian \
110N/A -enhance -extract -filter -flip -flop -frame -gamma \
110N/A -geometry -help -immutable -interlace -label -limit \
110N/A -log -map -matte -monochrome -negate -noop -page \
110N/A -quality -raise -remote -roll -rotate -sample \
110N/A -sampling-factor -scene -segment -sharpen -size \
110N/A -texture -treedepth -trim -update -verbose -version \
110N/A -virtual-pixel -window -window_group -write' -- $cur))
110N/A elif [[ "$cur" == +* ]]; then
110N/A COMPREPLY=( $( compgen -W '+compress +contrast +debug +dither \
110N/A +endian +gamma +label +map +matte +negate +page \
110N/A +raise +write' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A}
110N/Acomplete -F _display $filenames display
110N/A
110N/A_animate()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _ImageMagick
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-authenticate -backdrop -colormap \
110N/A -colors -colorspace -crop -debug -delay -density \
110N/A -depth -display -dither -extract -gamma -geometry \
110N/A -help -interlace -limit -log -matte -map -monochrome \
110N/A -noop -pause -remote -rotate -sampling-factor -scene \
110N/A -size -treedepth -trim -verbose -version -visual \
110N/A -virtual-pixel -window' -- $cur ) )
110N/A elif [[ "$cur" == +* ]]; then
110N/A COMPREPLY=( $( compgen -W '+debug +dither +gamma +map +matte' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A}
110N/Acomplete -F _animate $filenames animate
110N/A
110N/A_identify()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _ImageMagick
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-authenticate -debug -density \
110N/A -depth -extract -format -help -interlace -limit -list \
110N/A -log -size -sampling-factor -verbose -version \
110N/A -virtual-pixel' -- $cur ) )
110N/A elif [[ "$cur" == +* ]]; then
110N/A COMPREPLY=( $( compgen -W '+debug ' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A}
110N/Acomplete -F _identify $filenames identify
110N/A
110N/A_montage()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _ImageMagick
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-adjoin -affine -authenticate \
110N/A -blue-primary -blur -colors -colorspace -comment \
110N/A -compose -compress -crop -debug -density -depth \
110N/A -display -dispose -dither -draw -encoding -endian \
110N/A -extract -fill -filter -flip -flop -frame -gamma \
110N/A -geometry -gravity -green-primary -interlace -help \
110N/A -label -limit -log -matte -mode -monochrome -noop \
110N/A -page -pointsize -quality -red-primary -resize \
110N/A -rotate -sampling-factor -scene -shadow -size \
110N/A -stroke -texture -thumbnail -tile -transform \
110N/A -transparent -treedepth -trim -type -verbose \
110N/A -version -virtual-pixel -white-point' -- $cur ) )
110N/A elif [[ "$cur" == +* ]]; then
110N/A COMPREPLY=( $( compgen -W '+adjoin +compress +debug +dither \
110N/A +endian +gamma +label +matte +page' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A}
110N/Acomplete -F _montage $filenames montage
110N/A
110N/A_composite()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _ImageMagick
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-affine -authenticate \
110N/A -blue-primary -colors -colorspace -comment -compose \
110N/A -compress -debug -density -depth -displace -display \
110N/A -dispose -dissolve -dither -encoding -endian -extract \
110N/A -filter -font -geometry -gravity -green-primary -help \
110N/A -interlace -label -limit -log -matte -monochrome \
110N/A -negate -page -profile -quality -red-primary -rotate \
110N/A -resize -sampling-factor -scene -sharpen -size \
110N/A -stegano -stereo -thumbnail -tile -transform \
110N/A -treedepth -type -units -unsharp -verbose -version \
110N/A -virtual-pixel -watermark -white-point -write' \
110N/A -- $cur ) )
110N/A elif [[ "$cur" == +* ]]; then
110N/A COMPREPLY=( $( compgen -W '+compress +debug +dither +endian +label \
110N/A +matte +negate +page +write' -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A}
110N/Acomplete -F _composite $filenames composite
110N/A}
110N/A
110N/A# dd(1) completion
110N/A#
110N/Ahave dd &&
110N/A_dd()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A case "$cur" in
110N/A if=*|of=*)
110N/A cur=${cur#*=}
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A conv=*)
110N/A cur=${cur#*=}
110N/A COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
110N/A lcase notrunc ucase swab noerror sync' \
110N/A -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A _expand || return 0
110N/A
110N/A COMPREPLY=( $( compgen -W '--help --version' -- $cur ) \
110N/A $( compgen -W 'bs cbs conv count ibs if obs of seek skip'\
110N/A -S '=' -- $cur ) )
110N/A} &&
110N/Acomplete -F _dd $nospace $filenames dd
110N/A
110N/A# CUPS cancel(1) completion
110N/A#
110N/Ahave cancel &&
110N/A_cancel()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A COMPREPLY=( $( lpstat | cut -d' ' -f1 | grep "^$cur" ) )
110N/A} &&
110N/Acomplete -F _cancel $filenames cancel
110N/A
110N/A# aspell(1) completion
110N/A#
110N/Ahave aspell && {
110N/A_aspell_dictionary()
110N/A{
110N/A local datadir
110N/A datadir=/usr/lib/aspell
110N/A COMPREPLY=( $( command ls $datadir/*.@(multi|alias) ) )
110N/A COMPREPLY=( ${COMPREPLY[@]%.@(multi|alias)} )
110N/A COMPREPLY=( $( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ) )
110N/A}
110N/A
110N/A_aspell()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A # --name value style option
110N/A case "$prev" in
110N/A @(-c|-p|check))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A @(dump|create|merge))
110N/A COMPREPLY=( $( compgen -W 'master personal repl' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -d)
110N/A _aspell_dictionary
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A # --name=value style option
110N/A if [[ "$cur" == *=* ]]; then
110N/A prev=${cur/=*/}
110N/A cur=${cur/*=/}
110N/A case "$prev" in
110N/A --@(conf|personal|repl|per-conf))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A --master)
110N/A _aspell_dictionary
110N/A return 0
110N/A ;;
110N/A --mode)
110N/A COMPREPLY=( $( compgen -W 'none url email sgml tex' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --sug-mode)
110N/A COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --keymapping)
110N/A COMPREPLY=( $( compgen -W 'aspell ispell' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \
110N/A --encoding= --add-filter= --rem-filter= --mode= -e \
110N/A -H -t --add-extra-dicts= --rem-extra-dicts= \
110N/A --home-dir= -W --ignore= --ignore-accents \
110N/A --dont-ignore-accents --ignore-case --dont-ignore-case \
110N/A --ignore-repl --dont-ignore-repl --jargon= --keyboard= \
110N/A --lang= --language-tag= --local-data-dir= -d --master= \
110N/A --module= --add-module-search-order= \
110N/A --rem-module-search-order= --per-conf= -p --personal= \
110N/A --prefix= --repl= -C -B --run-together --dont-run-together \
110N/A --run-together-limit= --run-together-min= --save-repl \
110N/A --dont-save-repl --set-prefix --dont-set-prefix --size= \
110N/A --spelling= --strip-accents --dont-strip-accents \
110N/A --sug-mode= --add-word-list-path= --rem-word-list-path= \
110N/A -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
110N/A --time --dont-time --keymapping= --add-email-quote= \
110N/A --rem-email-quote= --email-margin= --add-tex-command= \
110N/A --rem-tex-command= --tex-check-comments \
110N/A --dont-tex-check-comments --add-tex-extension= \
110N/A --rem-tex-extension= --add-sgml-check= --rem-sgml-check= \
110N/A --add-sgml-extension= --rem-sgml-extension=' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
110N/A config config soundslike filter -v version dump \
110N/A create merge' -- $cur ) )
110N/A fi
110N/A
110N/A}
110N/Acomplete -F _aspell $filenames aspell
110N/A}
110N/A
110N/A# xmms(1) completion
110N/A#
110N/Ahave xmms &&
110N/A_xmms()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-h --help -r --rew -p --play \
110N/A -u --pause -s --stop -t --play-pause -f --fwd -e \
110N/A --enqueue -m --show-main-window -i --sm-client-id \
110N/A -v --version' -- $cur ) )
110N/A else
110N/A _filedir '@(mp[23]|MP[23]|ogg|OGG|wav|WAV|pls|m3u|xm|mod|s[3t]m|it|mtm|ult|flac)'
110N/A
110N/A fi
110N/A
110N/A} &&
110N/Acomplete -F _xmms $filenames xmms
110N/A
110N/A# info(1) completion
110N/A#
110N/Ahave info &&
110N/A_info()
110N/A{
110N/A local cur infopath UNAME
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _expand || return 0
110N/A
110N/A # default completion if parameter contains /
110N/A if [[ "$cur" == */* ]]; then
110N/A _filedir
110N/A return 0
110N/A fi
110N/A
110N/A infopath='/usr/share/info'
110N/A
110N/A if [ "${INFOPATH: -1:1}" == ':' ]; then
110N/A infopath=${INFOPATH}${infopath}
110N/A elif [ ${INFOPATH:+set} ]; then
110N/A infopath=$INFOPATH
110N/A fi
110N/A
110N/A infopath=$infopath:
110N/A if [ -n "$cur" ]; then
110N/A infopath="${infopath//://$cur* }"
110N/A else
110N/A infopath="${infopath//:// }"
110N/A fi
110N/A
110N/A # redirect stderr for when path doesn't exist
110N/A COMPREPLY=( $( eval command ls "$infopath" 2>/dev/null ) )
110N/A # weed out directory path names and paths to info pages
110N/A COMPREPLY=( ${COMPREPLY[@]##*/?(:)} )
110N/A # weed out info dir file
110N/A for (( i=0 ; i < ${#COMPREPLY[@]} ; ++i )); do
110N/A if [ "${COMPREPLY[$i]}" == 'dir' ]; then
110N/A unset COMPREPLY[$i];
110N/A fi;
110N/A done
110N/A # strip suffix from info pages
110N/A COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2)} )
110N/A COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) )
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _info $filenames info
110N/A
110N/A# dhclient(1) completion
110N/A#
110N/Ahave dhclient && _dhclient()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(cf|lf|pf|sf))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -s)
110N/A _known_hosts
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-p -d -q -1 -r -lf -pf \
110N/A -cf -sf -s -g -n -nw -w' -- $cur ) )
110N/A else
110N/A _available_interfaces
110N/A fi
110N/A} &&
110N/Acomplete -F _dhclient dhclient
110N/A
110N/A# lvm(8) completion
110N/A#
110N/Ahave lvm && {
110N/A_volumegroups()
110N/A{
110N/A COMPREPLY=( $(compgen -W "$( vgscan 2>/dev/null | \
110N/A sed -n -e 's|.*Found.*"\(.*\)".*$|\1|p' )" -- $cur ) )
110N/A}
110N/A
110N/A_physicalvolumes()
110N/A{
110N/A COMPREPLY=( $(compgen -W "$( pvscan 2>/dev/null | \
110N/A sed -n -e 's|^.*PV \(.*\) VG.*$|\1|p' )" -- $cur ) )
110N/A}
110N/A
110N/A_logicalvolumes()
110N/A{
110N/A COMPREPLY=( $(compgen -W "$( lvscan 2>/dev/null | \
110N/A sed -n -e "s|^.*'\(.*\)'.*$|\1|p" )" -- $cur ) )
110N/A}
110N/A
110N/A_units()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'h s b k m g t H K M G T' -- $cur ) )
110N/A}
110N/A
110N/A_sizes()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'k K m M g G t T' -- $cur ) )
110N/A}
110N/A
110N/A_args()
110N/A{
110N/A args=0
110N/A if [[ "${COMP_WORDS[0]}" == lvm ]]; then
110N/A offset=2
110N/A else
110N/A offset=1
110N/A fi
110N/A for (( i=$offset; i < COMP_CWORD; i++ )); do
110N/A if [[ "${COMP_WORDS[i]}" != -* ]]; then
110N/A args=$(($args + 1))
110N/A fi
110N/A done
110N/A}
110N/A
110N/A_lvmdiskscan()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -h -? --help -l \
110N/A --lvmpartition -v --verbose --version' -- $cur ) )
110N/A fi
110N/A}
110N/Acomplete -F _lvmdiskscan lvmdiskscan
110N/A
110N/A_pvscan()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -e \
110N/A --exported -n --novolumegroup -h -? \
110N/A --help --ignorelockingfailure -P \
110N/A --partial -s --short -u --uuid -v \
110N/A --verbose --version' -- $cur ) )
110N/A fi
110N/A}
110N/Acomplete -F _pvscan pvscan
110N/A
110N/A_pvs()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(o|O|-options|-sort))
110N/A COMPREPLY=( $( compgen -W 'pv_fmt pv_uuid \
110N/A pv_size pv_free pv_used pv_name \
110N/A pv_attr pv_pe_count \
110N/A pv_pe_alloc_count' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --units)
110N/A _units
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--aligned -a --all -d --debug \
110N/A -h -? --help --ignorelockingfailure --noheadings \
110N/A --nosuffix -o --options -O --sort \
110N/A --separator --unbuffered --units \
110N/A -v --verbose --version' -- $cur ) )
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _pvs pvs
110N/A
110N/A_pvdisplay()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A --units)
110N/A _units
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
110N/A -v --verbose -d --debug -h --help --version' -- $cur ) )
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _pvdisplay pvdisplay
110N/A
110N/A_pvchange()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|x|-autobackup|--allocatable))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-a --all -A --autobackup \
110N/A -d --debug -h --help -t --test -u --uuid -x \
110N/A --allocatable -v --verbose --addtag --deltag \
110N/A --version' -- $cur ) )
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _pvchange pvchange
110N/A
110N/A_pvcreate()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A --restorefile)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -@(M|-metadatatype))
110N/A COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --metadatacopies)
110N/A COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --@(metadatasize|setphysicalvolumesize))
110N/A _sizes
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--restorefile -d --debug -f \
110N/A --force -h -? --help --labelsector -M --metadatatype \
110N/A --metadatacopies --metadatasize \
110N/A --setphysicalvolumesize -t --test -u --uuid uuid -v \
110N/A --verbose -y --yes --version' -- $cur ) )
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _pvcreate pvcreate
110N/A
110N/A_pvmove()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(n|-name))
110N/A _logicalvolumes
110N/A return 0
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--abort -A --autobackup \
110N/A -b --background -d --debug -f --force -h -? \
110N/A --help -i --interval -t --test -v --verbose \
110N/A --version -n --name' -- $cur ) )
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _pvmove pvmove
110N/A
110N/A_pvremove()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -f --force -h -? \
110N/A --help -y --yes -t --test -v --verbose \
110N/A --version' -- $cur ) )
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _pvremove pvremove
110N/A
110N/A_vgscan()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -h --help \
110N/A --ignorelockingfailure --mknodes -P \
110N/A --partial -v --verbose --version' -- $cur ) )
110N/A fi
110N/A}
110N/Acomplete -F _vgscan vgscan
110N/A
110N/A_vgs()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(o|O|-options|-sort))
110N/A COMPREPLY=( $( compgen -W 'vg_fmt vg_uuid vg_name \
110N/A vg_attr vg_size vg_free vg_sysid \
110N/A vg_extent_size vg_extent_count vg_free_count \
110N/A max_lv max_pv pv_count lv_count snap_count \
110N/A vg_seqno' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --units)
110N/A _units
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--aligned -d --debug \
110N/A -h --help --ignorelockingfailure --noheadings \
110N/A --nosuffix -o --options -O --sort -P --partial \
110N/A --separator --unbuffered --units \
110N/A -v --verbose --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgs vgs
110N/A
110N/A_vgdisplay()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A --units)
110N/A _units
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
110N/A -P --partial -A --activevolumegroups -v --verbose \
110N/A -d --debug -h --help --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgdisplay vgdisplay
110N/A
110N/A_vgchange()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(a|A|x|-available|-autobackup|-resizeable))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup --alloc -P \
110N/A --partial -d --debug -h --help --ignorelockingfailure \
110N/A -t --test -u --uuid -v --verbose --version -a \
110N/A --available -x --resizeable -l --logicalvolume \
110N/A --addtag --deltag' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgchange vgchange
110N/A
110N/A_vgcreate()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(M|-metadatatype))
110N/A COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(s|-physicalextentsize))
110N/A _sizes
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup --addtag \
110N/A --alloc -d --debug -h --help -l --maxlogicalvolumes \
110N/A -M --metadatatype -p --maxphysicalvolumes -s \
110N/A --physicalextentsize -t --test -v --verbose \
110N/A --version' -- $cur ) )
110N/A else
110N/A _args
110N/A if [ $args -eq 0 ]; then
110N/A _volumegroups
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A fi
110N/A}
110N/Acomplete -F _vgcreate vgcreate
110N/A
110N/A_vgremove()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -h --help -t --test \
110N/A -v --verbose --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgremove vgremove
110N/A
110N/A_vgrename()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
110N/A -? --help -t --test -v --verbose --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgrename vgrename
110N/A
110N/A_vgreduce()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-a --all -A --autobackup -d \
110N/A --debug -h --help --removemissing -t --test -v \
110N/A --verbose --version' -- $cur ) )
110N/A
110N/A else
110N/A _args
110N/A if [ $args -eq 0 ]; then
110N/A _volumegroups
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A fi
110N/A}
110N/Acomplete -F _vgreduce vgreduce
110N/A
110N/A_vgextend()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(L|-size))
110N/A _sizes
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
110N/A -? --help -t --test -v --verbose --version' -- $cur ) )
110N/A else
110N/A _args
110N/A if [ $args -eq 0 ]; then
110N/A _volumegroups
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A fi
110N/A}
110N/Acomplete -F _vgextend vgextend
110N/A
110N/A_vgport()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-a --all -d --debug -h \
110N/A -? --help -v --verbose --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgport vgimport vgexport
110N/A
110N/A_vgck()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -h \
110N/A -? --help -v --verbose --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgck vgck
110N/A
110N/A_vgconvert()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(M|-metadatatype))
110N/A COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --metadatacopies)
110N/A COMPREPLY=( $( compgen -W '0 1 2' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --metadatasize)
110N/A _sizes
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -h --help --labelsector \
110N/A -M --metadatatype --metadatacopies --metadatasize \
110N/A -t --test -v --verbose --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgconvert vgconvert
110N/A
110N/A_vgcfgbackup()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(f|-file))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -f --file -h --help \
110N/A --ignorelockingfailure -P --partial -v --verbose \
110N/A --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgcfgbackup vgcfgbackup
110N/A
110N/A_vgcfgrestore()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(f|-file))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -@(M|-metadatatype))
110N/A COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(n|-name))
110N/A _volumegroups
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -f --file -l --list \
110N/A -h --help -M --Metadatatype -n --name -t --test \
110N/A -v --verbose --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgcfgrestore vgcfgrestore
110N/A
110N/A_vgmerge()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
110N/A -h --help -l --list -t --test -v --verbose \
110N/A --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgmerge vgmerge
110N/A
110N/A_vgsplit()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(M|-metadatatype))
110N/A COMPREPLY=( $( compgen -W '1 2' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup -d --debug \
110N/A -h --help -l --list -M --metadatatype -t --test \
110N/A -v --verbose --version' -- $cur ) )
110N/A else
110N/A _args
110N/A if [ $args -eq 0 -o $args -eq 1 ]; then
110N/A _volumegroups
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A fi
110N/A}
110N/Acomplete -F _vgsplit vgsplit
110N/A
110N/A_vgmknodes()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-d --debug -h --help -v --verbose \
110N/A --version' -- $cur ) )
110N/A else
110N/A _volumegroups
110N/A fi
110N/A}
110N/Acomplete -F _vgmknodes vgmknodes
110N/A
110N/A_lvscan()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-b --blockdevice -d --debug \
110N/A -h -? --help --ignorelockingfailure -P \
110N/A --partial -v --verbose --version' -- $cur ) )
110N/A fi
110N/A}
110N/Acomplete -F _lvscan lvscan
110N/A
110N/A_lvs()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(o|O|-options|-sort))
110N/A COMPREPLY=( $( compgen -W 'lv_uuid lv_name \
110N/A lv_attr lv_minor lv_size seg_count \
110N/A origin snap_percent segtype stripes \
110N/A stripesize chunksize seg_start \
110N/A seg_size' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A --units)
110N/A _units
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--aligned -d --debug \
110N/A -h --help --ignorelockingfailure --noheadings \
110N/A --nosuffix -o --options -O --sort -P --partial \
110N/A --segments --separator --unbuffered --units \
110N/A -v --verbose --version' -- $cur ) )
110N/A else
110N/A _logicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _lvs lvs
110N/A
110N/A_lvdisplay()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A --units)
110N/A _units
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-c --colon -C --columns --units \
110N/A -P --partial -m --maps -v --verbose -d --debug -h \
110N/A --help --version' -- $cur ) )
110N/A else
110N/A _logicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _lvdisplay lvdisplay
110N/A
110N/A_lvchange()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(a|A|C|M|-available|-autobackup|-continguous|-persistent))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(p|-permission))
110N/A COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup -a --available \
110N/A --addtag --alloc -C --contiguous -d --debug --deltag \
110N/A -f --force -h --help --ignorelockingfailure -M \
110N/A --persistent --major major --minor minor -P --partial \
110N/A -p --permission -r --readahead --refresh -t --test \
110N/A -v --verbose --version' -- $cur ) )
110N/A else
110N/A _logicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _lvchange lvchange
110N/A
110N/A_lvcreate()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|C|M|Z|-autobackup|-continguous|-persistent|-zero))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(L|-size))
110N/A _sizes
110N/A return 0
110N/A ;;
110N/A -@(p|-permission))
110N/A COMPREPLY=( $( compgen -W 'r rw' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(n|-name))
110N/A _logicalvolumes
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup --addtag --alloc \
110N/A -C --contiguous -d --debug -h -? --help -i --stripes \
110N/A -I --stripesize -l --extents -L --size -M --persistent \
110N/A --major --minor -n --name -p --permission -r \
110N/A --readahead -t --test --type -v --verbose -Z --zero \
110N/A --version' -- $cur ) )
110N/A else
110N/A _args
110N/A if [ $args -eq 0 ]; then
110N/A _volumegroups
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A fi
110N/A}
110N/Acomplete -F _lvcreate lvcreate
110N/A
110N/A_lvremove()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -f \
110N/A --force -h -? --help -t --test -v --verbose \
110N/A --version' -- $cur ) )
110N/A else
110N/A _logicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _lvremove lvremove
110N/A
110N/A_lvrename()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup -d --debug -h \
110N/A -? --help -t --test -v --verbose --version' -- $cur ) )
110N/A else
110N/A _logicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _lvrename lvrename
110N/A
110N/A_lvreduce()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(L|-size))
110N/A _sizes
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup -d \
110N/A --debug -f --force -h --help -l --extents \
110N/A -L --size -n --nofsck -r --resizefs -t --test \
110N/A -v --verbose --version' -- $cur ) )
110N/A else
110N/A _logicalvolumes
110N/A fi
110N/A}
110N/Acomplete -F _lvreduce lvreduce
110N/A
110N/A_lvresize()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(L|-size))
110N/A _sizes
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
110N/A --debug -h --help -i --stripes -I --stripesize \
110N/A -l --extents -L --size -n --nofsck -r --resizefs \
110N/A -t --test --type -v --verbose --version' -- $cur ) )
110N/A else
110N/A _args
110N/A if [ $args -eq 0 ]; then
110N/A _logicalvolumes
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A fi
110N/A}
110N/Acomplete -F _lvresize lvresize
110N/A
110N/A_lvextend()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -@(A|-autobackup))
110N/A COMPREPLY=( $( compgen -W 'y n' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(L|-size))
110N/A _sizes
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-A --autobackup --alloc -d \
110N/A --debug -h --help -i --stripes -I --stripesize \
110N/A -l --extents -L --size -n --nofsck -r --resizefs \
110N/A -t --test --type -v --verbose --version' -- $cur ) )
110N/A else
110N/A _args
110N/A if [ $args -eq 0 ]; then
110N/A _logicalvolumes
110N/A else
110N/A _physicalvolumes
110N/A fi
110N/A fi
110N/A}
110N/Acomplete -F _lvextend lvextend
110N/A
110N/A_lvm()
110N/A{
110N/A local prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
110N/A lvcreate lvdisplay lvextend lvmchange \
110N/A lvmdiskscan lvmsadc lvmsar lvreduce \
110N/A lvremove lvrename lvresize lvs lvscan \
110N/A pvchange pvcreate pvdata pvdisplay pvmove \
110N/A pvremove pvresize pvs pvscan vgcfgbackup \
110N/A vgcfgrestore vgchange vgck vgconvert \
110N/A vgcreate vgdisplay vgexport vgextend \
110N/A vgimport vgmerge vgmknodes vgreduce \
110N/A vgremove vgrename vgs vgscan vgsplit \
110N/A version' -- $cur ) )
110N/A else
110N/A case ${COMP_WORDS[1]} in
110N/A pvchange)
110N/A _pvchange
110N/A ;;
110N/A pvcreate)
110N/A _pvcreate
110N/A ;;
110N/A pvdisplay)
110N/A _pvdisplay
110N/A ;;
110N/A pvmove)
110N/A _pvmove
110N/A ;;
110N/A pvremove)
110N/A _pvremove
110N/A ;;
110N/A pvresize)
110N/A _pvresize
110N/A ;;
110N/A pvs)
110N/A _pvs
110N/A ;;
110N/A pvscan)
110N/A _pvscan
110N/A ;;
110N/A vgcfgbackup)
110N/A _vgcfgbackup
110N/A ;;
110N/A vgcfgrestore)
110N/A _vgcfgrestore
110N/A ;;
110N/A vgchange)
110N/A _vgchange
110N/A ;;
110N/A vgck)
110N/A _vgck
110N/A ;;
110N/A vgconvert)
110N/A _vgconvert
110N/A ;;
110N/A vgcreate)
110N/A _vgcreate
110N/A ;;
110N/A vgdisplay)
110N/A _vgdisplay
110N/A ;;
110N/A vgexport)
110N/A _vgexport
110N/A ;;
110N/A vgextend)
110N/A _vgextend
110N/A ;;
110N/A vgimport)
110N/A _vgimport
110N/A ;;
110N/A vgmerge)
110N/A _vgmerge
110N/A ;;
110N/A vgmknodes)
110N/A _vgmknodes
110N/A ;;
110N/A vgreduce)
110N/A _vgreduce
110N/A ;;
110N/A vgremove)
110N/A _vgremove
110N/A ;;
110N/A vgrename)
110N/A _vgrename
110N/A ;;
110N/A vgs)
110N/A _vgs
110N/A ;;
110N/A vgscan)
110N/A _vgscan
110N/A ;;
110N/A vgsplit)
110N/A _vgsplit
110N/A ;;
110N/A lvchange)
110N/A _lvchange
110N/A ;;
110N/A lvcreate)
110N/A _lvcreate
110N/A ;;
110N/A lvdisplay)
110N/A _lvdisplay
110N/A ;;
110N/A lvextend)
110N/A _lvextend
110N/A ;;
110N/A lvreduce)
110N/A _lvreduce
110N/A ;;
110N/A lvremove)
110N/A _lvremove
110N/A ;;
110N/A lvrename)
110N/A _lvrename
110N/A ;;
110N/A lvresize)
110N/A _lvresize
110N/A ;;
110N/A lvs)
110N/A _lvs
110N/A ;;
110N/A lvscan)
110N/A _lvscan
110N/A ;;
110N/A esac
110N/A fi
110N/A}
110N/Acomplete -F _lvm lvm
110N/A}
110N/A
110N/A# mkinitrd(8) completion
110N/A#
110N/Ahave mkinitrd &&
110N/A_mkinitrd()
110N/A{
110N/A local cur args
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A # --name value style option
110N/A case "$prev" in
110N/A --preload)
110N/A _modules
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A # --name=value style option
110N/A if [[ "$cur" == *=* ]]; then
110N/A prev=${cur/=*/}
110N/A cur=${cur/*=/}
110N/A case "$prev" in
110N/A --@(with|builtin))
110N/A _modules
110N/A return 0
110N/A ;;
110N/A --@(fstab|dsdt))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A --tmpdir)
110N/A _filedir -d
110N/A return 0
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--version -v -f --preload \
110N/A --with= --omit-scsi-modules --omit-raid-modules \
110N/A --images-version --fstab= --nocompress --builtin= \
110N/A --nopivot --noudev --allow-missing --tmpdir= \
110N/A --initrdfs= --dsdt= --lvm-version= --froce-usb' \
110N/A -- $cur ) )
110N/A else
110N/A _count_args
110N/A
110N/A case $args in
110N/A 1)
110N/A _filedir
110N/A ;;
110N/A 2)
110N/A COMPREPLY=( $( command ls /lib/modules | grep "^$cur" ) )
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A} &&
110N/Acomplete -F _mkinitrd mkinitrd
110N/A
110N/A# pkgconfig(1) completion
110N/A#
110N/Ahave pkg-config &&
110N/A_pkg_config()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # return list of available options
110N/A COMPREPLY=( $( compgen -W '-version --modversion \
110N/A --atleast-pkgconfig-version= --libs --libs-only-l \
110N/A --libs-only-other --libs-only-L --cflags \
110N/A --cflags-only-I --cflags-only-other --variable= \
110N/A --define-variable= --exists --uninstalled \
110N/A --atleast-version= --exact-version= --max-version= \
110N/A --list-all --debug --print-errors --silence-errors \
110N/A --errors-to-stdout -? --help --usage' -- $cur))
110N/A else
110N/A COMPREPLY=( $( pkg-config --list-all 2>/dev/null | \
110N/A awk '{print $1}' | grep "^$cur" ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _pkg_config pkg-config
110N/A
110N/A
110N/A# cpio(1) completion
110N/A#
110N/Ahave cpio && {
110N/A_cpio_format()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'bin odc newc crc tar ustar hpbin hpodc' -- $cur ) )
110N/A}
110N/A
110N/A_cpio()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A # --name value style option
110N/A case $prev in
110N/A -H)
110N/A _cpio_format
110N/A return 0
110N/A ;;
110N/A -@(E|F|I))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -R)
110N/A _usergroup
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A # --name=value style option
110N/A if [[ "$cur" == *=* ]]; then
110N/A prev=${cur/=*/}
110N/A cur=${cur/*=/}
110N/A case $prev in
110N/A --format)
110N/A _cpio_format
110N/A return 0
110N/A ;;
110N/A --@(file|pattern-file))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A --owner)
110N/A _usergroup
110N/A return 0
110N/A ;;
110N/A --rsh-command)
110N/A COMPREPLY=( $( compgen -c -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) )
110N/A else
110N/A case ${COMP_WORDS[1]} in
110N/A -@(o|-create))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
110N/A -L -V -C -H -M -O -F --file= --format=\
110N/A --message= --null --reset-access-time\
110N/A --verbose --dot --append --block-size=\
110N/A --dereference --io-size= --quiet\
110N/A --force-local --rsh-command= --help\
110N/A --version' -- $cur ) )
110N/A fi
110N/A ;;
110N/A -@(i|-extract))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
110N/A -t -s -u -v -B -S -V -C -E -H -M -R -I\
110N/A -F --file= --make-directories\
110N/A --nonmatching\
110N/A --preserve-modification-time\
110N/A --numeric-uid-gid --rename -t --list\
110N/A --swap-bytes --swap --dot\
110N/A --unconditional --verbose --block-size=\
110N/A --swap-halfwords --io-size=\
110N/A --pattern-file= --format= --owner=\
110N/A --no-preserve-owner --message=\
110N/A --force-local --no-absolute-filenames\
110N/A --sparse --only-verify-crc --quiet\
110N/A --rsh-command= --help\
110N/A --version' -- $cur ) )
110N/A fi
110N/A ;;
110N/A -@(p|-pass-through))
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-0 -a -d -l -m -u -v\
110N/A -L -V -R --null --reset-access-time\
110N/A --make-directories --link --quiet\
110N/A --preserve-modification-time\
110N/A --unconditional --verbose --dot\
110N/A --dereference --owner=\
110N/A --no-preserve-owner --sparse --help\
110N/A --version' -- $cur ) )
110N/A else
110N/A _filedir -d
110N/A fi
110N/A ;;
110N/A esac
110N/A fi
110N/A}
110N/Acomplete -F _cpio cpio
110N/A}
110N/A
110N/A# id(1) completion
110N/A#
110N/Ahave id &&
110N/A_id()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-a -g --group -G --groups -n --name\
110N/A -r --real -u --user --help --version' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -u $cur ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _id id
110N/A
110N/A# getent(1) completion
110N/A#
110N/Ahave getent &&
110N/A_getent()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case $prev in
110N/A passwd)
110N/A COMPREPLY=( $( compgen -u $cur ) )
110N/A return 0
110N/A ;;
110N/A group)
110N/A COMPREPLY=( $( compgen -g $cur ) )
110N/A return 0
110N/A ;;
110N/A services)
110N/A COMPREPLY=( $( compgen -s $cur ) )
110N/A return 0
110N/A ;;
110N/A hosts)
110N/A COMPREPLY=( $( compgen -A hostname $cur ) )
110N/A return 0
110N/A ;;
110N/A protocols)
110N/A COMPREPLY=( $( getent protocols | awk '{print $1}' | grep "^$cur" ) )
110N/A return 0
110N/A ;;
110N/A networks)
110N/A COMPREPLY=( $( getent networks | awk '{print $1}' | grep "^$cur" ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A
110N/A if [ $COMP_CWORD -eq 1 ]; then
110N/A COMPREPLY=( $( compgen -W 'passwd group hosts services protocols networks' -- $cur ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _getent getent
110N/A
110N/A# ntpdate(1) completion
110N/A#
110N/Ahave ntpdate &&
110N/A_ntpdate()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case $prev in
110N/A -k)
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -U)
110N/A COMPREPLY=( $( compgen -u $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-4 -6 -b -B -d -Q -q -s -u -v -a\
110N/A -e -k -p -o -r -t' -- $cur ) )
110N/A else
110N/A _known_hosts
110N/A fi
110N/A} &&
110N/Acomplete -F _ntpdate ntpdate
110N/A
110N/A# smartctl(8) completion
110N/A#
110N/Ahave smartctl && {
110N/A_smartctl_quietmode()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'errorsonly silent' -- $cur ) )
110N/A}
110N/A_smartctl_device()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'ata scsi 3ware' -- $cur ) )
110N/A}
110N/A_smartctl_tolerance()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'warn exit ignore' -- $cur ) )
110N/A}
110N/A_smartctl_badsum()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'normal conservative permissive verypermissive' -- $cur ) )
110N/A}
110N/A_smartctl_report()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'ioctl ataioctl scsiioctl' -- $cur ) )
110N/A}
110N/A_smartctl_feature()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
110N/A}
110N/A_smartctl_log()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'error selftest selective directory' -- $cur ) )
110N/A}
110N/A_smartctl_vendorattribute()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'help 9,minutes 9,seconds 9,halfminutes \
110N/A 9,temp 192,emergencyretractcyclect 193,loadunload \
110N/A 194,10xCelsius 194,unknown 198,offlinescanuncsectorct \
110N/A 200,writeerrorcount 201,detectedtacount 220,temp' -- $cur ) )
110N/A}
110N/A_smartctl_firmwarebug()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'none samsung samsung2' -- $cur ) )
110N/A}
110N/A_smartctl_presets()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'use ignore show showall' -- $cur ) )
110N/A}
110N/A_smartctl_test()
110N/A{
110N/A COMPREPLY=( $( compgen -W 'offline short long conveyance select afterselect,on afterselect,off pending' -- $cur ) )
110N/A}
110N/A
110N/A_smartctl()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A # --name value style option
110N/A case "$prev" in
110N/A -q)
110N/A _smartctl_quietmode
110N/A ;;
110N/A -d)
110N/A _smartctl_device
110N/A return 0
110N/A ;;
110N/A -t)
110N/A _smartctl_tolerance
110N/A return 0
110N/A ;;
110N/A -b)
110N/A _smartctl_badsum
110N/A return 0
110N/A ;;
110N/A -r)
110N/A _smartctl_report
110N/A return 0
110N/A ;;
110N/A -s)
110N/A _smartctl_feature
110N/A return 0
110N/A ;;
110N/A -o)
110N/A _smartctl_feature
110N/A return 0
110N/A ;;
110N/A -S)
110N/A _smartctl_feature
110N/A return 0
110N/A ;;
110N/A -l)
110N/A _smartctl_log
110N/A return 0
110N/A ;;
110N/A -v)
110N/A _smartctl_vendorattribute
110N/A return 0
110N/A ;;
110N/A -F)
110N/A _smartctl_firmwarebug
110N/A return 0
110N/A ;;
110N/A -P)
110N/A _smartctl_presets
110N/A return 0
110N/A ;;
110N/A -t)
110N/A _smartctl_test
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A # --name=value style option
110N/A if [[ "$cur" == *=* ]]; then
110N/A prev=${cur/=*/}
110N/A cur=${cur/*=/}
110N/A case "$prev" in
110N/A --quietmode)
110N/A _smartctl_quietmode
110N/A return 0
110N/A ;;
110N/A --device)
110N/A _smartctl_device
110N/A return 0
110N/A ;;
110N/A --tolerance)
110N/A _smartctl_tolerance
110N/A return 0
110N/A ;;
110N/A --badsum)
110N/A _smartctl_badsum
110N/A return 0
110N/A ;;
110N/A --report)
110N/A _smartctl_report
110N/A return 0
110N/A ;;
110N/A --smart)
110N/A _smartctl_feature
110N/A return 0
110N/A ;;
110N/A --offlineauto)
110N/A _smartctl_feature
110N/A return 0
110N/A ;;
110N/A --saveauto)
110N/A _smartctl_feature
110N/A return 0
110N/A ;;
110N/A --log)
110N/A _smartctl_log
110N/A return 0
110N/A ;;
110N/A --vendorattribute)
110N/A _smartctl_vendorattribute
110N/A return 0
110N/A ;;
110N/A --firmwarebug)
110N/A _smartctl_firmwarebug
110N/A return 0
110N/A ;;
110N/A --presets)
110N/A _smartctl_presets
110N/A return 0
110N/A ;;
110N/A --test)
110N/A _smartctl_test
110N/A return 0
110N/A ;;
110N/A esac
110N/A fi
110N/A
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-h --help --usage -V --version \
110N/A --copyright --license-i --info -a --all -q \
110N/A --quietmode= -d --device= -T --tolerance= -b --badsum= \
110N/A -r --report= -s --smart= -o --offlineauto= -S \
110N/A --saveauto= -H --health -c --capabilities -A \
110N/A --attributes -l --log= -v --vendorattribute= -F \
110N/A --firmwarebug= -P --presets= -t --test= -C \
110N/A --captive -X --abort' -- $cur ) )
110N/A else
110N/A cur=${cur:=/dev/}
110N/A _filedir
110N/A fi
110N/A}
110N/Acomplete -F _smartctl smartctl
110N/A}
110N/A
110N/A# vncviewer(1) completion
110N/A#
110N/Ahave vncviewer &&
110N/A_vncviewer()
110N/A{
110N/A local cur prev
110N/A local -a config
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case "$prev" in
110N/A -via)
110N/A _known_hosts -a
110N/A ;;
110N/A *)
110N/A # ssh into the the server, find and ping the broadcast address, then
110N/A # sort and show the results.
110N/A COMPREPLY=( $( ssh -o 'Batchmode yes' $prev \
110N/A "ping -bnc 4 255.255.255.255" 2>/dev/null | \
110N/A awk -F ' ' '{print $4}' | \
110N/A sort -n | uniq | egrep '[0-9]+\.[0-9]+\.' 2>/dev/null ) )
110N/A esac
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _vncviewer vncviewer
110N/A
110N/A# sysctl(8) completion
110N/A#
110N/Ahave sysctl &&
110N/A_sysctl()
110N/A{
110N/A local cur
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A COMPREPLY=( $( compgen -W "$(sysctl -N -a 2>/dev/null)" -- $cur ) )
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _sysctl sysctl
110N/A
110N/A# update-rc.d(8) completion
110N/A#
110N/A# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
110N/A#
110N/Ahave update-rc.d &&
110N/A_update_rc_d()
110N/A{
110N/A local cur prev sysvdir services options valid_options
110N/A
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
110N/A || sysvdir=/etc/init.d
110N/A
110N/A services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm*)) )
110N/A services=( ${services[@]#$sysvdir/} )
110N/A options=( -f -n )
110N/A
110N/A if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
110N/A valid_options=( $( \
110N/A echo "${COMP_WORDS[@]} ${options[@]}" \
110N/A | tr " " "\n" \
110N/A | sed -ne "/$( echo "${options[@]}" | sed "s/ /\\|/g" )/p" \
110N/A | sort | uniq -u \
110N/A ) )
110N/A COMPREPLY=( $( compgen -W '${options[@]} ${services[@]}' \
110N/A -X '$( echo ${COMP_WORDS[@]} | tr " " "|" )' -- $cur ) )
110N/A elif [[ "$prev" == ?($( echo ${services[@]} | tr " " "|" )) ]]; then
110N/A COMPREPLY=( $( compgen -W 'remove defaults start stop' -- $cur ) )
110N/A elif [[ "$prev" == defaults && "$cur" == [0-9] ]]; then
110N/A COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
110N/A elif [[ "$prev" == defaults && "$cur" == [sk]?([0-9]) ]]; then
110N/A COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
110N/A elif [[ "$prev" == defaults && -z "$cur" ]]; then
110N/A COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 s k )
110N/A elif [[ "$prev" == ?(start|stop) ]]; then
110N/A if [[ "$cur" == [0-9] || -z "$cur" ]]; then
110N/A COMPREPLY=( 0 1 2 3 4 5 6 7 8 9 )
110N/A elif [[ "$cur" == [0-9][0-9] ]]; then
110N/A COMPREPLY=( $cur )
110N/A else
110N/A COMPREPLY=()
110N/A fi
110N/A elif [[ "$prev" == ?([0-9][0-9]|[0-6S]) ]]; then
110N/A if [[ -z "$cur" ]]; then
110N/A if [[ $prev == [0-9][0-9] ]]; then
110N/A COMPREPLY=( 0 1 2 3 4 5 6 S )
110N/A else
110N/A COMPREPLY=( 0 1 2 3 4 5 6 S . )
110N/A fi
110N/A elif [[ "$cur" == [0-6S.] ]]; then
110N/A COMPREPLY=( $cur )
110N/A else
110N/A COMPREPLY=()
110N/A fi
110N/A elif [[ "$prev" == "." ]]; then
110N/A COMPREPLY=( $(compgen -W "start stop" -- $cur) )
110N/A else
110N/A COMPREPLY=()
110N/A fi
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _update_rc_d update-rc.d
110N/A
110N/A# invoke-rc.d(8) completion
110N/A#
110N/A# Copyright (C) 2004 Servilio Afre Puentes <servilio@gmail.com>
110N/A#
110N/Ahave invoke-rc.d &&
110N/A_invoke_rc_d()
110N/A{
110N/A local cur prev sysvdir services options valid_options
110N/A
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A [ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
110N/A || sysvdir=/etc/init.d
110N/A
110N/A services=( $(echo $sysvdir/!(README*|*.sh|*.dpkg*|*.rpm*)) )
110N/A services=( ${services[@]#$sysvdir/} )
110N/A options=( --help --quiet --force --try-anyway --disclose-deny --query --no-fallback )
110N/A
110N/A if [[ ($COMP_CWORD -eq 1) || ("$prev" == --* ) ]]; then
110N/A valid_options=( $( \
110N/A echo ${COMP_WORDS[@]} ${options[@]} \
110N/A | tr " " "\n" \
110N/A | sed -ne "/$( echo ${options[@]} | sed "s/ /\\\\|/g" )/p" \
110N/A | sort | uniq -u \
110N/A ) )
110N/A COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- \
110N/A $cur ) )
110N/A elif [ -x $sysvdir/$prev ]; then
110N/A COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
110N/A s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
110N/A $sysvdir/$prev`' -- \
110N/A $cur ) )
110N/A else
110N/A COMPREPLY=()
110N/A fi
110N/A
110N/A return 0
110N/A} &&
110N/Acomplete -F _invoke_rc_d invoke-rc.d
110N/A
110N/A# minicom(1) completion
110N/A#
110N/Ahave minicom &&
110N/A_minicom()
110N/A{
110N/A local cur prev
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A
110N/A case $prev in
110N/A -@(a|c))
110N/A COMPREPLY=( $( compgen -W 'on off' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A -@(S|C))
110N/A _filedir
110N/A return 0
110N/A ;;
110N/A -P)
110N/A COMPREPLY=( $( command ls /dev/tty* ) )
110N/A COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' -- $cur ) )
110N/A return 0
110N/A ;;
110N/A esac
110N/A
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
110N/A -c -S -d -p -C -T -8' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( command ls /etc/minicom/minirc.* 2>/dev/null | sed -e 's|/etc/minicom/minirc.||' | grep "^$cur" ) )
110N/A fi
110N/A} &&
110N/Acomplete -F _minicom minicom
110N/A
110N/A# svn completion
110N/A#
110N/Ahave svn &&
110N/A{
110N/A_svn()
110N/A{
110N/A local cur prev commands options command
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A commands='add blame praise annotate ann cat checkout co cleanup commit \
110N/A ci copy cp delete del remove rm diff di export help ? h import \
110N/A info list ls lock log merge mkdir move mv rename ren \
110N/A propdel pdel pd propedit pedit pe propget pget pg \
110N/A proplist plist pl propset pset ps resolved revert \
110N/A status stat st switch sw unlock update up'
110N/A
110N/A if [[ $COMP_CWORD -eq 1 ]] ; then
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--version' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
110N/A fi
110N/A else
110N/A
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A case $prev in
110N/A --config-dir)
110N/A _filedir -d
110N/A return 0;
110N/A ;;
110N/A -@(F|-file|-targets))
110N/A _filedir
110N/A return 0;
110N/A ;;
110N/A --encoding)
110N/A COMPREPLY=( $( compgen -W \
110N/A '$( iconv --list | sed -e "s@//@@;" )' \
110N/A -- "$cur" ) )
110N/A return 0;
110N/A ;;
110N/A --@(editor|diff|diff3)-cmd)
110N/A COMP_WORDS=(COMP_WORDS[0] $cur)
110N/A COMP_CWORD=1
110N/A _command
110N/A return 0;
110N/A ;;
110N/A esac
110N/A
110N/A command=${COMP_WORDS[1]}
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # possible options for the command
110N/A case $command in
110N/A add)
110N/A options='--auto-props --no-auto-props \
110N/A --force --targets --no-ignore \
110N/A --non-recursive -N -q --quiet'
110N/A ;;
110N/A @(blame|annotate|ann|praise))
110N/A options='-r --revisions --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive -v \
110N/A --verbose --incremental --xml'
110N/A ;;
110N/A cat)
110N/A options='-r --revision --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A @(checkout|co))
110N/A options='-r --revision -q --quiet -N \
110N/A --non-recursive --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive \
110N/A --ignore-externals'
110N/A ;;
110N/A cleanup)
110N/A options='--diff3-cmd'
110N/A ;;
110N/A @(commit|ci))
110N/A options='-m --message -F --file \
110N/A --encoding --force-log -q \
110N/A --quiet --non-recursive -N \
110N/A --targets --editor-cmd \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive --no-unlock'
110N/A ;;
110N/A @(copy|cp))
110N/A options='-m --message -F --file \
110N/A --encoding --force-log -r \
110N/A --revision -q --quiet \
110N/A --editor-cmd -username \
110N/A --password --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A @(delete|del|remove|rm))
110N/A options='--force -m --message -F \
110N/A --file --encoding --force-log \
110N/A -q --quiet --targets \
110N/A --editor-cmd -username \
110N/A --password --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A @(diff|di))
110N/A options='-r --revision -x --extensions \
110N/A --diff-cmd --no-diff-deleted \
110N/A -N --non-recursive --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive --force \
110N/A --old --new --notice-ancestry'
110N/A ;;
110N/A export)
110N/A options='-r --revision -q --quiet \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive -N \
110N/A --non-recursive --force \
110N/A --native-eol --ignore-externals'
110N/A ;;
110N/A import)
110N/A options='--auto-props --no-auto-props \
110N/A -m --message -F --file \
110N/A --encoding --force-log -q \
110N/A --quiet --non-recursive \
110N/A --no-ignore --editor-cmd \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A info)
110N/A options='--username --password \
110N/A --no-auth-cache \
110N/A --non-interactive -r \
110N/A --revision --xml --targets \
110N/A -R --recursive --incremental'
110N/A ;;
110N/A @(list|ls))
110N/A options='-r --revision -v --verbose -R \
110N/A --recursive --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive \
110N/A --incremental --xml'
110N/A ;;
110N/A lock)
110N/A options='-m --message -F --file \
110N/A --encoding --force-log \
110N/A --targets --force --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A log)
110N/A options='-r --revision -v --verbose \
110N/A --targets --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive \
110N/A --stop-on-copy --incremental \
110N/A --xml -q --quiet --limit'
110N/A ;;
110N/A merge)
110N/A options='-r --revision -N \
110N/A --non-recursive -q --quiet \
110N/A --force --dry-run --diff3-cmd \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive \
110N/A --ignore-ancestry'
110N/A ;;
110N/A mkdir)
110N/A options='-m --message -F --file \
110N/A --encoding --force-log -q \
110N/A --quiet --editor-cmd \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A @(move|mv|rename|ren))
110N/A options='-m --message -F --file \
110N/A --encoding --force-log -r \
110N/A --revision -q --quiet \
110N/A --force --editor-cmd \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A @(propdel|pdel|pd))
110N/A options='-q --quiet -R --recursive -r \
110N/A --revision --revprop \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A @(propedit|pedit|pe))
110N/A options='-r --revision --revprop \
110N/A --encoding --editor-cmd \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive --force'
110N/A ;;
110N/A @(propget|pget|pg))
110N/A options='-R --recursive -r --revision \
110N/A --revprop --strict --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A @(proplist|plist|pl))
110N/A options='-v --verbose -R --recursive \
110N/A -r --revision --revprop -q \
110N/A --quiet --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A @(propset|pset|ps))
110N/A options='-F --file -q --quiet \
110N/A --targets -R --recursive \
110N/A --revprop --encoding \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive -r \
110N/A --revision --force'
110N/A ;;
110N/A resolved)
110N/A options='--targets -R --recursive -q \
110N/A --quiet'
110N/A ;;
110N/A revert)
110N/A options='--targets -R --recursive -q \
110N/A --quiet'
110N/A ;;
110N/A @(status|stat|st))
110N/A options='-u --show-updates -v \
110N/A --verbose -N --non-recursive \
110N/A -q --quiet --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive --no-ignore \
110N/A --ignore-externals \
110N/A --incremental --xml'
110N/A ;;
110N/A @(switch|sw))
110N/A options='--relocate -r --revision -N \
110N/A --non-recursive -q --quiet \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive --diff3-cmd'
110N/A ;;
110N/A unlock)
110N/A options='--targets --force --username \
110N/A --password --no-auth-cache \
110N/A --non-interactive'
110N/A ;;
110N/A @(update|up))
110N/A options='-r --revision -N \
110N/A --non-recursive -q --quiet \
110N/A --username --password \
110N/A --no-auth-cache \
110N/A --non-interactive \
110N/A --diff3-cmd --ignore-externals'
110N/A ;;
110N/A esac
110N/A options="$options --help -h --config-dir"
110N/A
110N/A COMPREPLY=( $( compgen -W "$options" -- $cur ) )
110N/A else
110N/A if [[ "$command" == @(help|h|\?) ]]; then
110N/A COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A fi
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _svn $default svn
110N/A
110N/A_svnadmin()
110N/A{
110N/A local cur prev commands options mode
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A commands='create deltify dump help ? hotcopy list-dblogs \
110N/A list-unused-dblogs load lslocks lstxns recover rmlocks \
110N/A rmtxns setlog verify'
110N/A
110N/A if [[ $COMP_CWORD -eq 1 ]] ; then
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--version' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
110N/A fi
110N/A else
110N/A prev=${COMP_WORDS[COMP_CWORD-1]}
110N/A case $prev in
110N/A --config-dir)
110N/A _filedir -d
110N/A return 0;
110N/A ;;
110N/A --fs-type)
110N/A COMPREPLY=( $( compgen -W 'fsfs bdb' -- $cur ) )
110N/A return 0;
110N/A ;;
110N/A esac
110N/A
110N/A command=${COMP_WORDS[1]}
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # possible options for the command
110N/A case $command in
110N/A create)
110N/A options='--bdb-txn-nosync \
110N/A --bdb-log-keep --config-dir \
110N/A --fs-type'
110N/A ;;
110N/A deltify)
110N/A options='-r --revision -q --quiet'
110N/A ;;
110N/A dump)
110N/A options='-r --revision --incremental \
110N/A -q --quiet --deltas'
110N/A ;;
110N/A hotcopy)
110N/A options='--clean-logs'
110N/A ;;
110N/A load)
110N/A options='--ignore-uuid --force-uuid \
110N/A --parent-dir -q --quiet \
110N/A --use-pre-commit-hook \
110N/A --use-post-commit-hook'
110N/A ;;
110N/A rmtxns)
110N/A options='-q --quiet'
110N/A ;;
110N/A setlog)
110N/A options='-r --revision --bypass-hooks'
110N/A ;;
110N/A esac
110N/A
110N/A options="$options --help -h"
110N/A COMPREPLY=( $( compgen -W "$options" -- $cur ) )
110N/A else
110N/A if [[ "$command" == @(help|h|\?) ]]; then
110N/A COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A fi
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _svnadmin $default svnadmin
110N/A
110N/A_svnlook()
110N/A{
110N/A local cur prev commands options mode
110N/A
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A commands='author cat changed date diff dirs-changed help ? h history \
110N/A info lock log propget pget pg proplist plist pl tree uuid \
110N/A youngest'
110N/A
110N/A if [[ $COMP_CWORD -eq 1 ]] ; then
110N/A if [[ "$cur" == -* ]]; then
110N/A COMPREPLY=( $( compgen -W '--version' -- $cur ) )
110N/A else
110N/A COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
110N/A fi
110N/A else
110N/A command=${COMP_WORDS[1]}
110N/A
110N/A if [[ "$cur" == -* ]]; then
110N/A # possible options for the command
110N/A case $command in
110N/A @(author|cat|date|dirs-changed|info|log))
110N/A options='-r --revision -t \
110N/A --transaction'
110N/A ;;
110N/A changed)
110N/A options='-r --revision -t \
110N/A --transaction --copy-info'
110N/A ;;
110N/A diff)
110N/A options='-r --revision -t \
110N/A --transaction \
110N/A --no-diff-deleted \
110N/A --no-diff-added \
110N/A --diff-copy-from'
110N/A ;;
110N/A history)
110N/A options='-r --revision --show-ids'
110N/A ;;
110N/A prop@(get|list))
110N/A options='-r --revision -t \
110N/A --transaction --revprop'
110N/A ;;
110N/A tree)
110N/A options='-r --revision -t \
110N/A --transaction --show-ids \
110N/A --full-paths'
110N/A ;;
110N/A esac
110N/A
110N/A options="$options --help -h"
110N/A COMPREPLY=( $( compgen -W "$options" -- $cur ) )
110N/A else
110N/A if [[ "$command" == @(help|h|\?) ]]; then
110N/A COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
110N/A else
110N/A _filedir
110N/A fi
110N/A fi
110N/A fi
110N/A
110N/A return 0
110N/A}
110N/Acomplete -F _svnlook $default svnlook
110N/A}
110N/A
110N/A_filedir_xspec()
110N/A{
110N/A local IFS cur xspec
110N/A
110N/A IFS=$'\t\n'
110N/A COMPREPLY=()
110N/A cur=`_get_cword`
110N/A
110N/A _expand || return 0
110N/A
110N/A # get first exclusion compspec that matches this command
110N/A xspec=$( sed -ne $'/^complete .*[ \t]'${1##*/}$'\([ \t]\|$\)/{p;q;}' \
110N/A $BASH_COMPLETION )
110N/A # prune to leave nothing but the -X spec
110N/A xspec=${xspec#*-X }
110N/A xspec=${xspec%% *}
110N/A
110N/A local toks=( ) tmp
110N/A
110N/A while read -r tmp; do
110N/A [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
110N/A done < <( compgen -d -- "$(quote_readline "$cur")" )
110N/A
110N/A while read -r tmp; do
110N/A [[ -n $tmp ]] && toks[${#toks[@]}]=$tmp
110N/A done < <( eval compgen -f -X $xspec -- "\$(quote_readline "\$cur")" )
110N/A
110N/A COMPREPLY=( "${toks[@]}" )
110N/A}
110N/Alist=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \
110N/A $BASH_COMPLETION | \
110N/A # read exclusion compspecs
110N/A (
110N/A while read line
110N/A do
110N/A # ignore compspecs that are commented out
110N/A if [ "${line#\#}" != "$line" ]; then continue; fi
110N/A line=${line%# START exclude*}
110N/A line=${line%# FINISH exclude*}
110N/A line=${line##*\'}
110N/A list=( "${list[@]}" $line )
110N/A done
110N/A echo "${list[@]}"
110N/A )
110N/A ) )
110N/A# remove previous compspecs
110N/Aif [ ${#list[@]} -gt 0 ]; then
110N/A eval complete -r ${list[@]}
110N/A # install new compspecs
110N/A eval complete -F _filedir_xspec $filenames "${list[@]}"
110N/Afi
110N/Aunset list
110N/A
110N/A# source completion directory definitions
110N/Aif [ -d $BASH_COMPLETION_DIR -a -r $BASH_COMPLETION_DIR -a \
110N/A -x $BASH_COMPLETION_DIR ]; then
110N/A for i in $BASH_COMPLETION_DIR/*; do
110N/A [[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|.rpm*) ]] &&
110N/A [ \( -f $i -o -h $i \) -a -r $i ] && . $i
110N/A done
110N/Afi
110N/Aunset i
110N/A
110N/A# source user completion file
110N/A[ $BASH_COMPLETION != ~/.bash_completion -a -r ~/.bash_completion ] \
110N/A && . ~/.bash_completion
110N/Aunset -f have
110N/Aunset UNAME RELEASE default dirnames filenames have nospace bashdefault \
110N/A plusdirs
110N/A
110N/Aset $BASH_COMPLETION_ORIGINAL_V_VALUE
110N/Aunset BASH_COMPLETION_ORIGINAL_V_VALUE
110N/A
110N/A### Local Variables:
110N/A### mode: shell-script
110N/A### End: