2001-11-29 00:37:54 +00:00
|
|
|
# bash_completion - some programmable completion functions for bash 2.05a
|
2000-08-08 22:17:29 +00:00
|
|
|
#
|
2000-08-11 21:20:41 +00:00
|
|
|
# <![CDATA[
|
|
|
|
#
|
2002-01-05 19:48:59 +00:00
|
|
|
# $Id: bash_completion,v 1.46 2002/01/05 20:48:59 ianmacd Exp $
|
2000-08-08 22:17:29 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
# any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
2002-01-03 00:16:41 +00:00
|
|
|
[ -n "$DEBUG" ] && set -v
|
2001-07-08 23:14:13 +00:00
|
|
|
# Set a couple of useful vars
|
|
|
|
#
|
|
|
|
OS=$( uname -s )
|
|
|
|
RELEASE=$( uname -r )
|
|
|
|
|
2000-08-29 00:41:27 +00:00
|
|
|
# Turn on extended globbing and programmable completion
|
|
|
|
shopt -s extglob progcomp
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# A lot of the following one-liners were taken directly from the
|
|
|
|
# completion examples provided with the bash 2.04 source distribution
|
|
|
|
|
2000-10-19 15:25:36 +00:00
|
|
|
# Make directory commands see only directories
|
2002-01-03 00:16:41 +00:00
|
|
|
complete -d mkdir rmdir pushd
|
2000-10-19 15:25:36 +00:00
|
|
|
|
2000-08-08 22:17:29 +00:00
|
|
|
# Make file commands see only files
|
|
|
|
complete -f cat less more ln strip
|
2001-12-20 07:52:12 +00:00
|
|
|
|
|
|
|
# the following section lists completions that are redefined later
|
|
|
|
# START exclude -- do NOT remove this line
|
2000-08-08 22:17:29 +00:00
|
|
|
complete -f -X '*.bz2' bzip2
|
|
|
|
complete -f -X '!*.bz2' bunzip2
|
|
|
|
complete -f -X '!*.zip' unzip
|
|
|
|
complete -f -X '*.gz' gzip
|
|
|
|
complete -f -X '*.Z' compress
|
|
|
|
complete -f -X '!*.+(Z|gz|tgz|Gz)' gunzip zcat zmore
|
2001-12-20 07:52:12 +00:00
|
|
|
complete -f -X '!*.Z' uncompress
|
2001-12-13 20:34:17 +00:00
|
|
|
complete -f -X '!*.+(gif|jpg|jpeg|tif|tiff|png|GIF|JPG|TIF|TIFF|PNG|bmp)' ee xv
|
2002-01-05 19:42:41 +00:00
|
|
|
complete -f -X '!*.+(?(e)ps|?(E)PS|?(e)ps.gz|pdf|PDF)' gv
|
2000-08-08 22:17:29 +00:00
|
|
|
complete -f -X '!*.+(dvi|DVI)' dvips xdvi dviselect dvitype
|
|
|
|
complete -f -X '!*.+(pdf|PDF)' acroread xpdf
|
|
|
|
complete -f -X '!*.texi*' makeinfo texi2dvi texi2html
|
2002-01-05 19:42:41 +00:00
|
|
|
complete -f -X '!*.+(tex|TEX)' tex latex slitex jadetex pdfjadetex
|
2001-12-20 18:26:49 +00:00
|
|
|
complete -f -X '!*.+(mp3|MP3)' mpg123
|
2001-12-20 07:52:12 +00:00
|
|
|
# FINISH exclude -- do not remove this line
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# kill sees only signals
|
2001-12-05 16:32:24 +00:00
|
|
|
complete -A signal -P '-' kill
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# user commands see only users
|
|
|
|
complete -u finger su usermod userdel passwd
|
|
|
|
|
2001-11-29 00:37:54 +00:00
|
|
|
# group commands see only groups
|
2002-01-03 00:17:44 +00:00
|
|
|
complete -g groupmod groupdel passwd
|
2001-11-29 00:37:54 +00:00
|
|
|
|
2000-08-08 22:17:29 +00:00
|
|
|
# bg completes with stopped jobs
|
|
|
|
complete -A stopped -P '%' bg
|
|
|
|
|
|
|
|
# other job commands
|
|
|
|
complete -j -P '%' fg jobs disown
|
|
|
|
|
|
|
|
# network commands complete with hostname
|
|
|
|
complete -A hostname ssh rsh telnet rlogin ftp ping fping host traceroute \
|
|
|
|
nslookup
|
|
|
|
|
|
|
|
# export and others complete with shell variables
|
|
|
|
complete -v export local readonly unset
|
|
|
|
|
|
|
|
# set completes with set options
|
|
|
|
complete -A setopt set
|
|
|
|
|
|
|
|
# shopt completes with shopt options
|
|
|
|
complete -A shopt shopt
|
|
|
|
|
|
|
|
# helptopics
|
|
|
|
complete -A helptopic help
|
|
|
|
|
|
|
|
# unalias completes with aliases
|
|
|
|
complete -a unalias
|
|
|
|
|
|
|
|
# bind completes with readline bindings (make this more intelligent)
|
|
|
|
complete -A binding bind
|
|
|
|
|
|
|
|
# Now we get to the meat of the file, the functions themselves. Some
|
|
|
|
# of these are works in progress. Most assume GNU versions of the
|
|
|
|
# tools in question and may require modifications for use on vanilla
|
|
|
|
# UNIX systems.
|
|
|
|
#
|
|
|
|
# A couple of functions may have non-portable, Linux specific code in
|
|
|
|
# them, but this will be noted where applicable
|
|
|
|
|
2001-07-08 23:14:13 +00:00
|
|
|
# This function is handy for checking whether we have certain programs
|
|
|
|
# on the system. No need for bulky functions in memory if we don't.
|
|
|
|
#
|
|
|
|
have()
|
|
|
|
{
|
2001-07-09 00:55:01 +00:00
|
|
|
unset -v have
|
2001-12-05 17:05:49 +00:00
|
|
|
type $1 &> /dev/null
|
2001-07-09 00:55:01 +00:00
|
|
|
[ $? = 0 ] && have="yes"
|
2001-07-08 23:14:13 +00:00
|
|
|
}
|
|
|
|
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# GNU chown(1) completion. This should be expanded to allow the use of
|
|
|
|
# ':' as well as '.' as the user.group separator.
|
|
|
|
#
|
2000-08-29 00:41:27 +00:00
|
|
|
_chown()
|
2000-08-08 22:17:29 +00:00
|
|
|
{
|
2001-11-20 04:15:48 +00:00
|
|
|
local cur prev user group i
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# do not attempt completion if we're specifying an option
|
2001-05-21 20:10:29 +00:00
|
|
|
[ "$cur" == -* ] && return 0
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# first parameter on line or first since an option?
|
2000-08-29 00:41:27 +00:00
|
|
|
if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then
|
|
|
|
if [[ "$cur" == [a-zA-Z]*.* ]]; then
|
2000-08-08 22:17:29 +00:00
|
|
|
user=${cur%.*}
|
|
|
|
group=${cur#*.}
|
2001-11-29 00:37:54 +00:00
|
|
|
COMPREPLY=( $( compgen -g $group ) )
|
2000-08-08 22:17:29 +00:00
|
|
|
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
|
|
|
COMPREPLY[i]=$user.${COMPREPLY[i]}
|
|
|
|
done
|
2000-08-29 00:41:27 +00:00
|
|
|
else
|
2000-08-08 22:17:29 +00:00
|
|
|
COMPREPLY=( $( compgen -u $cur -S '.' ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
fi
|
2000-08-08 22:17:29 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2001-05-21 20:10:29 +00:00
|
|
|
complete -F _chown -o default chown
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# umount(8) completion. This relies on the mount point being the third
|
|
|
|
# space-delimited field in the output of mount(8)
|
|
|
|
#
|
2000-08-29 00:41:27 +00:00
|
|
|
_umount()
|
2000-08-08 22:17:29 +00:00
|
|
|
{
|
|
|
|
local cur
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# could rewrite the cut | grep to be a sed command, but this is
|
|
|
|
# clearer and doesn't result in much overhead
|
|
|
|
COMPREPLY=( $( mount | cut -d' ' -f 3 | grep ^$cur) )
|
2000-08-29 00:41:27 +00:00
|
|
|
|
2000-08-08 22:17:29 +00:00
|
|
|
return 0
|
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
complete -F _umount -o filenames umount
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# mount(8) completion. This will pull a list of possible mounts out of
|
|
|
|
# /etc/fstab, unless the word being completed contains a ':', which
|
|
|
|
# would indicate the specification of an NFS server. In that case, we
|
|
|
|
# query the server for a list of all available exports and complete on
|
|
|
|
# that instead.
|
|
|
|
#
|
2000-08-29 00:41:27 +00:00
|
|
|
_mount()
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2002-01-03 00:16:41 +00:00
|
|
|
{ local cur i sm
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2002-01-03 00:16:41 +00:00
|
|
|
for i in {,/usr}/sbin/showmount; do [ -x $i ] && sm=$i && break; done
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-21 07:56:18 +00:00
|
|
|
if [ -n "$sm" ] && [[ "$cur" == *:* ]]; then
|
|
|
|
COMPREPLY=( $( $sm -e --no-headers ${cur%%:*} | \
|
2000-10-09 18:07:50 +00:00
|
|
|
grep ^${cur#*:} | awk '{print $1}' ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
else
|
2000-08-08 22:17:29 +00:00
|
|
|
COMPREPLY=( $( awk '{if ($2 ~ /\//) print $2}' /etc/fstab | \
|
2000-10-09 18:07:50 +00:00
|
|
|
grep ^$cur ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
2000-08-08 22:17:29 +00:00
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
complete -F _mount -o default mount
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# Linux rmmod(1) completion. This completes on a list of all currently
|
|
|
|
# installed kernel modules.
|
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
[ $OS = Linux ] &&
|
2000-08-29 00:41:27 +00:00
|
|
|
_rmmod()
|
2000-08-08 22:17:29 +00:00
|
|
|
{
|
|
|
|
local cur
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2000-09-25 21:38:11 +00:00
|
|
|
COMPREPLY=( $( /sbin/lsmod | \
|
2001-01-31 22:30:49 +00:00
|
|
|
awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) )
|
2000-08-08 22:17:29 +00:00
|
|
|
return 0
|
|
|
|
}
|
2001-07-08 23:14:13 +00:00
|
|
|
[ $OS = Linux ] && complete -F _rmmod rmmod
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-03-05 19:12:48 +00:00
|
|
|
# Linux insmod(8) & modprobe(8) completion. This completes on a list of all
|
2000-08-08 22:17:29 +00:00
|
|
|
# available modules for the version of the kernel currently running.
|
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
[ $OS = Linux ] &&
|
2000-08-29 00:41:27 +00:00
|
|
|
_insmod()
|
2000-08-08 22:17:29 +00:00
|
|
|
{
|
2000-09-25 21:38:11 +00:00
|
|
|
local cur prev modpath
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-08-08 22:17:29 +00:00
|
|
|
modpath=/lib/modules/`uname -r`
|
|
|
|
|
2001-01-31 22:57:06 +00:00
|
|
|
# behave like lsmod for modprobe -r
|
2001-03-05 19:12:48 +00:00
|
|
|
if [ ${COMP_WORDS[0]} = "modprobe" ] && [ "${COMP_WORDS[1]}" = "-r" ]; then
|
2001-01-31 22:57:06 +00:00
|
|
|
COMPREPLY=( $( /sbin/lsmod | \
|
|
|
|
awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# do filename completion if we're giving a path to a module
|
2001-12-18 03:43:25 +00:00
|
|
|
if [[ "$cur" == /* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
return 0
|
|
|
|
fi
|
2001-01-31 22:57:06 +00:00
|
|
|
|
2000-09-25 21:38:11 +00:00
|
|
|
if [ $COMP_CWORD -gt 1 ]; then
|
2001-01-31 22:57:06 +00:00
|
|
|
# do module parameter completion
|
2001-01-31 22:30:49 +00:00
|
|
|
COMPREPLY=( $( /sbin/modinfo -p ${COMP_WORDS[1]} | \
|
|
|
|
awk '{if ($1 ~ /^'$cur'/) print $1}' ) )
|
2000-09-25 21:38:11 +00:00
|
|
|
else
|
2001-01-31 22:57:06 +00:00
|
|
|
# do module name completion
|
2001-01-31 22:30:49 +00:00
|
|
|
COMPREPLY=( $( ls -R $modpath | sed -ne 's/^\('$cur'.*\)\.o$/\1/p') )
|
2000-09-25 21:38:11 +00:00
|
|
|
fi
|
2000-08-29 00:41:27 +00:00
|
|
|
|
2000-08-08 22:17:29 +00:00
|
|
|
return 0
|
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
[ $OS = Linux ] && complete -F _insmod -o filenames insmod modprobe
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-05 16:32:24 +00:00
|
|
|
# man(1) completion. This is Linux specific, in that 'man <section> <page>'
|
|
|
|
# is the expected syntax. This allows one to do something like
|
2000-08-08 22:17:29 +00:00
|
|
|
# 'man 3 str<tab>' to obtain a list of all string handling syscalls on
|
|
|
|
# the system.
|
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
[ $OS = Linux ] &&
|
2000-08-29 00:41:27 +00:00
|
|
|
_man()
|
2000-08-08 22:17:29 +00:00
|
|
|
{
|
2001-12-18 03:43:25 +00:00
|
|
|
local cur prev cmd
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-18 03:25:04 +00:00
|
|
|
# default completion if parameter contains /
|
|
|
|
[[ "$cur" == /* ]] && return 0
|
|
|
|
# default to command completion if no man.config
|
|
|
|
if [ ! -f /etc/man.config ]; then
|
|
|
|
COMPREPLY=( $( compgen -c $cur ) )
|
|
|
|
return 0
|
|
|
|
fi
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
if [[ "$prev" == [0-9ln] ]]; then
|
|
|
|
# churn out a string of paths to search, with * appended to $cur
|
|
|
|
cmd=`awk '{if ($1 ~ /^MANPATH/) \
|
|
|
|
print $(NF)"/man'$prev'/'$cur'*"}' /etc/man.config | \
|
|
|
|
sort -u`
|
|
|
|
# strip off * from paths ending in /*
|
|
|
|
cmd=${cmd//\/\\*/\/}
|
|
|
|
# redirect stderr for when path doesn't exist
|
|
|
|
cmd="ls $cmd 2>/dev/null"
|
|
|
|
COMPREPLY=( $( eval $cmd ) )
|
|
|
|
# get basename of man pages
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]##*/} )
|
|
|
|
# strip suffix from man pages
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]%.gz} )
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]%.*} )
|
2000-08-29 00:41:27 +00:00
|
|
|
else
|
2001-12-18 03:43:25 +00:00
|
|
|
cmd=`awk '{if ($1 ~ /^MANPATH/) \
|
|
|
|
print $(NF)"/man?/'$cur'*"}' /etc/man.config | sort -u`
|
|
|
|
cmd=${cmd//\/\\*/\/}
|
|
|
|
cmd="ls $cmd 2>/dev/null"
|
|
|
|
COMPREPLY=( $( eval $cmd ) )
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]##*/} )
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]%.gz} )
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]%.*} $( compgen -G $cur\*.[0-9ln] ) )
|
|
|
|
fi
|
2000-08-29 00:41:27 +00:00
|
|
|
|
|
|
|
return 0
|
2000-08-08 22:17:29 +00:00
|
|
|
}
|
2001-07-08 23:14:13 +00:00
|
|
|
[ $OS = Linux ] && complete -F _man -o default man
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# Linux killall(1) completion. This wouldn't be much use on, say,
|
|
|
|
# Solaris, where killall does exactly that: kills ALL processes.
|
|
|
|
#
|
|
|
|
# This could be improved. For example, it currently doesn't take
|
|
|
|
# command line options into account
|
|
|
|
#
|
2000-08-29 00:41:27 +00:00
|
|
|
_killall()
|
2000-08-08 22:17:29 +00:00
|
|
|
{
|
2001-11-20 04:15:48 +00:00
|
|
|
local cur prev i
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2000-08-29 00:41:27 +00:00
|
|
|
if [[ "$prev" == -[A-Z0-9]* ]]; then
|
2000-08-29 19:21:00 +00:00
|
|
|
# get a list of processes (the gensub() in the awk takes care
|
|
|
|
# of getting the basename of the process, the first sed
|
|
|
|
# evaluation takes care of swapped out processes, and the
|
|
|
|
# second takes care of getting the basename of the process)
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=( $( ps ahx | sed -e 's#[]\[()]##g' | \
|
2000-08-29 19:21:00 +00:00
|
|
|
awk '{if (gensub("^.*/","",1,$5) ~ /^'$cur'/) print $5}' | \
|
2000-12-19 19:54:49 +00:00
|
|
|
sed -e 's#^.*/##' ) )
|
2000-08-08 22:17:29 +00:00
|
|
|
return 0
|
2000-08-29 00:41:27 +00:00
|
|
|
fi
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# first parameter can be either a signal or a process
|
|
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
|
|
# standard signal completion is rather braindead, so we need
|
|
|
|
# to hack around to get what we want here, which is to
|
|
|
|
# complete on a dash, followed by the signal name minus
|
|
|
|
# the SIG prefix
|
|
|
|
COMPREPLY=( $( compgen -A signal SIG${cur#-} ))
|
|
|
|
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
|
|
|
COMPREPLY[i]=-${COMPREPLY[i]#SIG}
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
# get processes, adding to signals if applicable
|
2000-12-19 19:54:49 +00:00
|
|
|
COMPREPLY=( ${COMPREPLY[*]} $( ps ahx | sed -e 's#[]\[()]##g' | \
|
2000-08-29 19:21:00 +00:00
|
|
|
awk '{if (gensub("^.*/","",1,$5) ~ /^'$cur'/) print $5}' | \
|
2000-12-19 19:54:49 +00:00
|
|
|
sed -e 's#^.*/##' ))
|
2000-08-08 22:17:29 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
complete -F _killall killall
|
|
|
|
|
|
|
|
# GNU find(1) completion. This makes heavy use of ksh style extended
|
|
|
|
# globs and contains Linux specific code for completing the parameter
|
|
|
|
# to the -fstype option.
|
|
|
|
#
|
2000-08-29 00:41:27 +00:00
|
|
|
_find()
|
2000-08-08 22:17:29 +00:00
|
|
|
{
|
2001-11-20 04:15:48 +00:00
|
|
|
local cur prev i
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]#-}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
case "$prev" in
|
|
|
|
-@(max|min)depth)
|
|
|
|
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-?(a)newer|-fls|-fprint?(0|f))
|
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-fstype)
|
2002-01-03 00:16:41 +00:00
|
|
|
# this is highly non-portable
|
|
|
|
COMPREPLY=( $( cut -d$'\t' -f 2 /proc/filesystems | grep ^$cur ) )
|
2000-08-08 22:17:29 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-gid)
|
|
|
|
COMPREPLY=( $( awk 'BEGIN {FS=":"} \
|
|
|
|
{if ($3 ~ /^'$cur'/) print $3}' /etc/group ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-group)
|
2001-11-29 00:37:54 +00:00
|
|
|
COMPREPLY=( $( compgen -g $cur ) )
|
2000-08-08 22:17:29 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-?(x)type)
|
|
|
|
COMPREPLY=( $( compgen -W 'b c d p f l s' $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-uid)
|
|
|
|
COMPREPLY=( $( awk 'BEGIN {FS=":"} \
|
|
|
|
{if ($3 ~ /^'$cur'/) print $3}' /etc/passwd ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-user)
|
|
|
|
COMPREPLY=( $( compgen -u $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-[acm]min|-[acm]time|-?(i)?(l)name|-inum|-?(i)path|-?(i)regex| \
|
|
|
|
-links|-perm|-size|-used|-exec|-ok|-printf)
|
|
|
|
# do nothing, just wait for a parameter to be given
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# complete using basic options ($cur has had its dash removed here,
|
|
|
|
# as otherwise compgen will bomb out with an error, since it thinks
|
|
|
|
# the dash is an option to itself)
|
|
|
|
COMPREPLY=( $( compgen -W 'daystart depth follow help maxdepth \
|
|
|
|
mindepth mount noleaf version xdev amin anewer atime \
|
|
|
|
cmin cnewer ctime empty false fstype gid group ilname \
|
|
|
|
iname inum ipath iregex links lname mmin mtime name \
|
|
|
|
newer nouser nogroup perm regex size true type uid \
|
|
|
|
used user xtype exec fls fprint fprint0 fprintf ok \
|
|
|
|
print print0 printf prune ls' $cur ) )
|
|
|
|
|
|
|
|
# this removes any options from the list of completions that have
|
|
|
|
# already been specified somewhere on the command line.
|
|
|
|
COMPREPLY=( $( echo "${COMP_WORDS[@]}-" | \
|
|
|
|
(while read -d '-' i; do
|
|
|
|
[ "$i" == "" ] && continue
|
|
|
|
# flatten array with spaces on either side,
|
|
|
|
# otherwise we cannot grep on word boundaries of
|
|
|
|
# first and last word
|
|
|
|
COMPREPLY=" ${COMPREPLY[@]} "
|
|
|
|
# remove word from list of completions
|
|
|
|
COMPREPLY=( ${COMPREPLY/ ${i%% *} / } )
|
2001-12-18 03:43:25 +00:00
|
|
|
done
|
|
|
|
echo ${COMPREPLY[@]})
|
2000-08-08 22:17:29 +00:00
|
|
|
) )
|
|
|
|
|
|
|
|
# put dashes back
|
|
|
|
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
|
|
|
COMPREPLY[i]=-${COMPREPLY[i]}
|
|
|
|
done
|
2000-10-09 18:07:50 +00:00
|
|
|
|
|
|
|
|
2000-08-08 22:17:29 +00:00
|
|
|
return 0
|
|
|
|
}
|
2001-11-20 04:15:48 +00:00
|
|
|
complete -F _find -o dirnames find
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
# Linux ifconfig(8) completion
|
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
[ $OS = Linux ] &&
|
2000-08-29 00:41:27 +00:00
|
|
|
_ifconfig()
|
2000-08-08 22:17:29 +00:00
|
|
|
{
|
|
|
|
local cur
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2000-08-08 22:17:29 +00:00
|
|
|
|
|
|
|
case "${COMP_WORDS[1]}" in
|
|
|
|
-|*[0-9]*)
|
|
|
|
COMPREPLY=( $( compgen -W '-a up down arp promisc allmulti \
|
|
|
|
metric mtu dstaddr netmask add del \
|
|
|
|
tunnel irq io_addr mem_start media \
|
|
|
|
broadcast pointopoint hw multicast \
|
|
|
|
address txqueuelen' $cur ))
|
|
|
|
COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
|
|
|
|
(while read -d ' ' i; do
|
|
|
|
[ "$i" == "" ] && continue
|
|
|
|
# flatten array with spaces on either side,
|
|
|
|
# otherwise we cannot grep on word
|
|
|
|
# boundaries of first and last word
|
|
|
|
COMPREPLY=" ${COMPREPLY[@]} "
|
|
|
|
# remove word from list of completions
|
|
|
|
COMPREPLY=( ${COMPREPLY/ $i / } )
|
|
|
|
done
|
2001-12-18 03:43:25 +00:00
|
|
|
echo ${COMPREPLY[@]})
|
2000-08-08 22:17:29 +00:00
|
|
|
) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
COMPREPLY=( $( ifconfig -a | sed -ne 's/^\('$cur'[^ ]*\).*$/\1/p' ))
|
|
|
|
}
|
2001-07-08 23:14:13 +00:00
|
|
|
[ $OS = Linux ] && complete -F _ifconfig ifconfig
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2000-10-09 18:07:50 +00:00
|
|
|
# Linux ipsec(8) completion (for FreeS/WAN). Basic.
|
2000-08-08 22:17:29 +00:00
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
[ $OS = Linux ] && have ipsec &&
|
2000-08-29 00:41:27 +00:00
|
|
|
_ipsec()
|
2000-08-08 22:17:29 +00:00
|
|
|
{
|
|
|
|
local cur
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2000-08-08 22:17:29 +00:00
|
|
|
|
2000-10-09 18:07:50 +00:00
|
|
|
|
|
|
|
if [ $COMP_CWORD = 1 ]; then
|
|
|
|
COMPREPLY=( $( compgen -W 'auto barf eroute klipsdebug look manual \
|
2000-08-08 22:17:29 +00:00
|
|
|
pluto ranbits rsasigkey setup showdefaults \
|
|
|
|
showhostkey spi spigrp tncfg whack' $cur ))
|
2000-10-09 18:07:50 +00:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
case ${COMP_WORDS[1]} in
|
|
|
|
auto)
|
|
|
|
COMPREPLY=( $( compgen -W '--asynchronous --up --add --delete \
|
|
|
|
--replace --down --route --unroute \
|
|
|
|
--ready --status --rereadsecrets' $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
manual)
|
|
|
|
COMPREPLY=( $( compgen -W '--up --down --route --unroute \
|
|
|
|
--union' $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
ranbits)
|
|
|
|
COMPREPLY=( $( compgen -W '--quick --continuous --bytes' $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
setup)
|
|
|
|
COMPREPLY=( $( compgen -W '--start --stop --restart' $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2000-08-29 00:41:27 +00:00
|
|
|
return 0
|
2000-08-08 22:17:29 +00:00
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
[ $OS = Linux ] && [ "$have" ] && complete -F _ipsec ipsec
|
2000-08-11 21:20:41 +00:00
|
|
|
|
2000-08-29 00:41:27 +00:00
|
|
|
# cvs(1) completion
|
|
|
|
#
|
|
|
|
_cvs()
|
2000-08-11 21:20:41 +00:00
|
|
|
{
|
|
|
|
local cur prev
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-08-11 21:20:41 +00:00
|
|
|
|
2000-08-29 00:41:27 +00:00
|
|
|
if [ $COMP_CWORD -eq 1 ] || [[ "$prev" == -* ]]; then
|
2000-08-11 21:20:41 +00:00
|
|
|
COMPREPLY=( $( compgen -W 'add admin checkout commit diff \
|
|
|
|
export history import log rdiff release remove rtag status \
|
|
|
|
tag update' $cur ))
|
|
|
|
fi
|
2000-08-29 00:41:27 +00:00
|
|
|
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
}
|
2001-05-21 20:10:29 +00:00
|
|
|
complete -F _cvs -o default cvs
|
2000-08-11 21:20:41 +00:00
|
|
|
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
# rpm(8) completion. This is quite comprehensive now and covers rpm 4.x
|
2000-08-29 00:41:27 +00:00
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
have rpm &&
|
2000-08-11 21:20:41 +00:00
|
|
|
_rpm()
|
|
|
|
{
|
|
|
|
dashify()
|
|
|
|
{
|
|
|
|
local i
|
|
|
|
|
|
|
|
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
|
|
|
if [ ${#COMPREPLY[i]} -le 2 ]; then
|
|
|
|
COMPREPLY[i]=-${COMPREPLY[i]}
|
|
|
|
else
|
|
|
|
COMPREPLY[i]=--${COMPREPLY[i]}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
add_package_list()
|
|
|
|
{
|
2001-11-04 23:11:48 +00:00
|
|
|
if [ -f /var/log/rpmpkgs ]; then
|
2001-12-20 07:52:12 +00:00
|
|
|
# using RHL 7.2 - this is quicker than querying the DB
|
2001-11-04 23:11:48 +00:00
|
|
|
COMPREPLY=( ${COMPREPLY[@]}
|
|
|
|
$( sed -ne 's/^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.]\+.*\.rpm$/\1/p' /var/log/rpmpkgs ) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]} $( rpm -qa | \
|
2001-12-18 03:43:25 +00:00
|
|
|
sed -ne 's/^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.]\+$/\1/p' ) )
|
2001-11-04 23:11:48 +00:00
|
|
|
fi
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
}
|
|
|
|
|
2000-12-19 19:54:49 +00:00
|
|
|
file_glob()
|
|
|
|
{
|
|
|
|
local suffix
|
|
|
|
|
|
|
|
# get extension of current word, if relevant
|
|
|
|
suffix=${cur##*.}
|
|
|
|
# nullify it if it's not a substring of the extension we're
|
|
|
|
# completing on
|
|
|
|
[ "$suffix" != "${1:0:${#suffix}}" ] && suffix=""
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]} $( compgen -G $cur\*${1:${#suffix}} ) )
|
|
|
|
# directory completion if all else fails and current word
|
|
|
|
# contains a slash
|
|
|
|
if [ ${#COMPREPLY[@]} = 0 ] && [[ $cur == */* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -d $cur ) )
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2000-08-11 21:20:41 +00:00
|
|
|
local cur cur_nodash prev
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2000-08-11 21:20:41 +00:00
|
|
|
cur_nodash=${cur#-}
|
2001-12-18 03:43:25 +00:00
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-08-11 21:20:41 +00:00
|
|
|
|
|
|
|
if [ $COMP_CWORD = 1 ]; then
|
|
|
|
# first parameter on line
|
|
|
|
case "$cur" in
|
|
|
|
-b*)
|
|
|
|
COMPREPLY=( $( compgen -W 'ba bb bc bi bl bp bs' \
|
|
|
|
$cur_nodash ) )
|
|
|
|
dashify
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-t*)
|
|
|
|
COMPREPLY=( $( compgen -W 'ta tb tc ti tl tp ts' \
|
|
|
|
$cur_nodash ) )
|
|
|
|
dashify
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--*)
|
|
|
|
COMPREPLY=( $( compgen -W 'help version initdb \
|
|
|
|
checksig recompile rebuild resign addsign rebuilddb \
|
2001-03-21 23:33:02 +00:00
|
|
|
showrc setperms setugids tarbuild eval install \
|
2000-12-20 02:04:54 +00:00
|
|
|
upgrade query freshen erase verify querytags rmsource' \
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
${cur_nodash#-} ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
dashify
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
COMPREPLY=( $( compgen -W 'b e F i q t U V' \
|
|
|
|
$cur_nodash ) )
|
|
|
|
dashify
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2000-08-29 00:41:27 +00:00
|
|
|
case "$prev" in
|
|
|
|
--@(db|exclude)path|prefix|relocate|root)
|
|
|
|
COMPREPLY=( $( compgen -d $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
--eval)
|
2002-01-03 00:16:41 +00:00
|
|
|
# get a list of macros
|
|
|
|
COMPREPLY=( $( sed -ne 's/^\(%'${cur#\%}'[^ '$'\t'']*\).*$/\1/p' \
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
/usr/lib/rpm/macros ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--pipe)
|
|
|
|
COMPREPLY=( $( compgen -c $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--rcfile)
|
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
2001-03-05 19:12:48 +00:00
|
|
|
--specfile)
|
|
|
|
# complete on .spec files
|
|
|
|
file_glob spec
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--whatprovides)
|
|
|
|
# complete on capabilities
|
|
|
|
COMPREPLY=( $( rpm -qa --queryformat '%{providename}\n' | grep ^$cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--whatrequires)
|
|
|
|
# complete on capabilities
|
|
|
|
COMPREPLY=( $( rpm -qa --queryformat '%{requirename}\n' | grep ^$cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
2000-08-29 00:41:27 +00:00
|
|
|
esac
|
|
|
|
|
2000-08-11 21:20:41 +00:00
|
|
|
case "${COMP_WORDS[1]}" in
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
-@([iFU]*|-install|-freshen|-upgrade))
|
2000-08-11 21:20:41 +00:00
|
|
|
# complete on list of relevant options
|
|
|
|
COMPREPLY=( $( compgen -W 'percent force test replacepkgs \
|
|
|
|
replacefiles root excludedocs includedocs noscripts rcfile \
|
|
|
|
ignorearch dbpath prefix ignoreos nodeps allfiles ftpproxy \
|
|
|
|
ftpport justdb httpproxy httpport noorder relocate badreloc \
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
notriggers excludepath ignoresize oldpackage define eval \
|
2002-01-04 04:34:21 +00:00
|
|
|
pipe queryformat repackage' ${cur_nodash#-} ))
|
2000-08-29 00:41:27 +00:00
|
|
|
dashify
|
2000-08-11 21:20:41 +00:00
|
|
|
# return if $cur is an option
|
2000-08-29 00:41:27 +00:00
|
|
|
[[ "$cur" == -* ]] && return 0
|
2000-08-11 21:20:41 +00:00
|
|
|
# add a list of RPMS to possible completions
|
2000-12-19 19:54:49 +00:00
|
|
|
file_glob rpm
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
;;
|
2001-08-22 15:20:27 +00:00
|
|
|
-qp*)
|
2000-08-11 21:20:41 +00:00
|
|
|
# complete on list of relevant options
|
|
|
|
COMPREPLY=( $( compgen -W 'scripts root rcfile whatprovides \
|
|
|
|
whatrequires requires triggeredby ftpport ftpproxy httpproxy \
|
2001-08-22 15:20:27 +00:00
|
|
|
httpport provides triggers dump changelog dbpath filesbypkg \
|
|
|
|
define eval pipe showrc info list state docfiles \
|
2002-01-04 18:29:18 +00:00
|
|
|
configfiles queryformat conflicts obsoletes' ${cur_nodash#-} ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
dashify
|
2000-08-11 21:20:41 +00:00
|
|
|
# return if $cur is an option
|
2000-08-29 00:41:27 +00:00
|
|
|
[[ "$cur" == -* ]] && return 0
|
2001-08-22 15:20:27 +00:00
|
|
|
# add a list of RPMS to possible completions
|
|
|
|
file_glob rpm
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-*f)
|
|
|
|
# standard filename completion
|
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
-@(e|-erase))
|
2000-08-11 21:20:41 +00:00
|
|
|
# complete on list of relevant options
|
|
|
|
COMPREPLY=( $( compgen -W 'allmatches noscripts notriggers \
|
2002-01-04 04:34:21 +00:00
|
|
|
nodeps test repackage' ${cur_nodash#-} ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
dashify
|
2000-08-11 21:20:41 +00:00
|
|
|
# return if $cur is an option
|
2000-08-29 00:41:27 +00:00
|
|
|
[[ "$cur" == -* ]] && return 0
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
add_package_list
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
;;
|
2001-08-22 15:20:27 +00:00
|
|
|
-q*)
|
|
|
|
# complete on list of relevant options
|
|
|
|
COMPREPLY=( $( compgen -W 'scripts root rcfile whatprovides \
|
|
|
|
whatrequires requires triggeredby ftpport ftpproxy httpproxy \
|
|
|
|
httpport provides triggers dump changelog dbpath specfile \
|
|
|
|
querybynumber last filesbypkg define eval pipe showrc info \
|
2002-01-04 18:29:18 +00:00
|
|
|
list state docfiles configfiles queryformat conflicts \
|
|
|
|
obsoletes' ${cur_nodash#-} ) )
|
2001-08-22 15:20:27 +00:00
|
|
|
dashify
|
|
|
|
# return if $cur is an option
|
|
|
|
[[ "$cur" == -* ]] && return 0
|
|
|
|
# don't complete on packages if we are querying all packages
|
|
|
|
[[ ${COMP_WORDS[1]} == -qa* ]] && return 0
|
|
|
|
add_package_list
|
|
|
|
return 0
|
|
|
|
;;
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
-@(K|-checksig))
|
2000-08-11 21:20:41 +00:00
|
|
|
# complete on list of relevant options
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
COMPREPLY=( $( compgen -W 'nopgp nogpg nomd5' \
|
|
|
|
${cur_nodash#-} ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
dashify
|
2000-08-11 21:20:41 +00:00
|
|
|
# return if $cur is an option
|
2000-08-29 00:41:27 +00:00
|
|
|
[[ "$cur" == -* ]] && return 0
|
2000-08-11 21:20:41 +00:00
|
|
|
# add a list of RPMS to possible completions
|
2000-12-19 19:54:49 +00:00
|
|
|
file_glob rpm
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
;;
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
-@([Vy]*|-verify))
|
2000-08-11 21:20:41 +00:00
|
|
|
# complete on list of relevant options
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
COMPREPLY=( $( compgen -W 'root rcfile dbpath nodeps nofiles \
|
|
|
|
noscripts nomd5' ${cur_nodash#-} ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
dashify
|
2000-08-11 21:20:41 +00:00
|
|
|
# return if $cur is an option
|
2000-08-29 00:41:27 +00:00
|
|
|
[[ "$cur" == -* ]] && return 0
|
2000-12-19 19:54:49 +00:00
|
|
|
add_package_list
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
;;
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
-[bt]*)
|
2000-08-11 21:20:41 +00:00
|
|
|
# complete on list of relevant options
|
|
|
|
COMPREPLY=( $( compgen -W 'short-circuit timecheck clean \
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
rmsource test sign buildroot target buildarch buildos \
|
|
|
|
nobuild' ${cur_nodash#-} ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
dashify
|
2000-08-11 21:20:41 +00:00
|
|
|
# return if $cur is an option
|
2000-08-29 00:41:27 +00:00
|
|
|
[[ "$cur" == -* ]] && return 0
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
if [[ ${COMP_WORDS[1]} == -b* ]]; then
|
|
|
|
# complete on .spec files
|
2000-12-19 19:54:49 +00:00
|
|
|
file_glob spec
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
else
|
|
|
|
# complete on .tar files
|
|
|
|
COMPREPLY=( $( compgen -G $cur\*.+(tgz|tar.+(gz|bz2)) ) )
|
|
|
|
fi
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--re@(build|compile))
|
|
|
|
# complete on source RPMs
|
|
|
|
COMPREPLY=( $( compgen -G $cur\*.src.rpm ) )
|
|
|
|
return 0
|
|
|
|
;;
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
--tarbuild)
|
|
|
|
# complete on tarred sources
|
|
|
|
COMPREPLY=( $( compgen -G $cur\*.+(tgz|tar.+(gz|bz2)) ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--@(re|add)sign)
|
2000-08-11 21:20:41 +00:00
|
|
|
# complete on RPMs
|
2000-12-19 19:54:49 +00:00
|
|
|
file_glob rpm
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--set@(perms|gids))
|
rpm completion updated for extra options in rpm 4.x (added --eval, --pipe,
--rcfile, etc.)
some minor bug fixes to rpm completion; code tidied in places
added some outstanding long options to rpm completion (--install, --freshen,
--upgrade, --info, --list, --state, --docfiles, --queryformat, --verify etc.)
added -g group completion
2000-11-20 20:41:43 +00:00
|
|
|
add_package_list
|
2000-08-11 21:20:41 +00:00
|
|
|
return 0
|
|
|
|
;;
|
2000-12-20 02:04:54 +00:00
|
|
|
--rmsource)
|
|
|
|
file_glob spec
|
|
|
|
return 0
|
|
|
|
;;
|
2001-03-05 19:12:48 +00:00
|
|
|
-*g)
|
|
|
|
# package group completion
|
2001-12-20 07:52:12 +00:00
|
|
|
local IFS=$'\t'
|
2001-03-05 19:12:48 +00:00
|
|
|
# remove trailing backslash, or grep will complain
|
|
|
|
cur=${cur%'\'}
|
|
|
|
COMPREPLY=( $( rpm -qa --queryformat '%{group}\n' | \
|
|
|
|
grep ^$cur ) )
|
|
|
|
# backslash escape spaces and translate newlines to tabs
|
|
|
|
COMPREPLY=( $( echo ${COMPREPLY[@]} | sed 's/ /\\ /g' | \
|
|
|
|
tr '\n' '\t' ) )
|
|
|
|
return 0
|
|
|
|
;;
|
2000-08-11 21:20:41 +00:00
|
|
|
esac
|
2000-08-29 00:41:27 +00:00
|
|
|
|
|
|
|
return 0
|
2000-08-11 21:20:41 +00:00
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
[ "$have" ] && complete -F _rpm -o filenames rpm
|
2000-08-11 21:20:41 +00:00
|
|
|
|
2000-10-09 18:07:50 +00:00
|
|
|
# Debian Linux apt-get(8) completion.
|
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
have apt-get &&
|
2000-10-09 18:07:50 +00:00
|
|
|
_apt-get()
|
|
|
|
{
|
2001-11-20 04:15:48 +00:00
|
|
|
local cur prev special i
|
2000-10-09 18:07:50 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-10-09 18:07:50 +00:00
|
|
|
|
|
|
|
for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
|
|
|
|
if [[ ${COMP_WORDS[i]} == @(install|remove|source) ]]; then
|
|
|
|
special=${COMP_WORDS[i]}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "$special" ]; then
|
|
|
|
case $special in
|
|
|
|
@(install|remove|source))
|
|
|
|
COMPREPLY=( $( apt-cache pkgnames $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$prev" == -*c ]] || [ "$prev" = --config-file ]; then
|
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( $( compgen -W 'update upgrade dselect-upgrade \
|
|
|
|
dist-upgrade install remove source check \
|
|
|
|
clean autoclean -d -f -h -v -m -q -s -y -u \
|
|
|
|
-b -c -o --download-only --fix-broken --help \
|
|
|
|
--version --ignore-missing --fix-missing \
|
|
|
|
--no-download --quiet --simulate \
|
|
|
|
--just-print --dry-run --recon --no-act \
|
|
|
|
--yes --assume-yes --show-upgraded \
|
|
|
|
--compile --build --ignore-hold \
|
|
|
|
--no-upgrade --force-yes --print-uris \
|
|
|
|
--purge --reinstall --list-cleanup \
|
|
|
|
--trivial-only --no-remove --diff-only \
|
|
|
|
--tar-only --config-file --option ' | \
|
|
|
|
grep ^$cur ) )
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
[ "$have" ] && complete -F _apt-get -o filenames apt-get
|
2000-10-09 18:07:50 +00:00
|
|
|
|
|
|
|
# Debian Linux apt-cache(8) completion.
|
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
have apt-cache &&
|
2000-10-09 18:07:50 +00:00
|
|
|
_apt-cache()
|
|
|
|
{
|
2001-11-20 04:15:48 +00:00
|
|
|
local cur prev special i
|
2000-10-09 18:07:50 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-10-09 18:07:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
|
|
|
|
if [[ ${COMP_WORDS[i]} == @(add|showpkg) ]]; then
|
|
|
|
special=${COMP_WORDS[i]}
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "$special" ]; then
|
|
|
|
case $special in
|
|
|
|
add)
|
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
showpkg)
|
|
|
|
COMPREPLY=( $( apt-cache pkgnames $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "$prev" == -*c ]] || [ "$prev" = --config-file ]; then
|
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( $( compgen -W 'add gencaches showpkg stats dump \
|
|
|
|
dumpavail unmet check search show showpkg \
|
|
|
|
depends pkgnames -h -v -p -s -q -i -f -a -g -c \
|
|
|
|
-o --help --version --pkg-cache --src-cache \
|
|
|
|
--quiet --important --full --all-versions \
|
|
|
|
--no-generate --names-only --all-names \
|
|
|
|
--config-file --option' | grep ^$cur ) )
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
[ "$have" ] && complete -F _apt-cache -o filenames apt-cache
|
2000-10-09 18:07:50 +00:00
|
|
|
|
2000-08-29 00:41:27 +00:00
|
|
|
# chsh(1) completion
|
|
|
|
#
|
2000-08-11 21:20:41 +00:00
|
|
|
_chsh()
|
|
|
|
{
|
|
|
|
local cur prev
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-08-11 21:20:41 +00:00
|
|
|
|
|
|
|
if [ "$prev" = "-s" ]; then
|
|
|
|
COMPREPLY=( $( chsh -l | grep ^$cur ) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( $( compgen -u $cur ) )
|
|
|
|
fi
|
2000-08-29 00:41:27 +00:00
|
|
|
|
|
|
|
return 0
|
2000-08-11 21:20:41 +00:00
|
|
|
}
|
|
|
|
complete -F _chsh chsh
|
|
|
|
|
2000-08-29 00:41:27 +00:00
|
|
|
# chkconfig(8) completion
|
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
have chkconfig &&
|
2000-08-11 21:20:41 +00:00
|
|
|
_chkconfig()
|
|
|
|
{
|
2001-11-20 04:15:48 +00:00
|
|
|
local cur prev i
|
2000-08-11 21:20:41 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2000-08-11 21:20:41 +00:00
|
|
|
cur_nodash=${cur#--}
|
2001-12-18 03:43:25 +00:00
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-08-11 21:20:41 +00:00
|
|
|
|
|
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
|
|
COMPREPLY=( $( compgen -W 'list add del level' $cur_nodash ) )
|
|
|
|
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
|
|
|
COMPREPLY[i]=--${COMPREPLY[i]}
|
|
|
|
done
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $COMP_CWORD -eq 4 ]; then
|
|
|
|
COMPREPLY=( $( compgen -W 'on off reset' $cur ) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$prev" in
|
|
|
|
@([1-6]|--@(list|add|del)))
|
|
|
|
COMPREPLY=( $( compgen -W "`(cd /etc/rc.d/init.d; echo *)`" \
|
|
|
|
$cur) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--level)
|
|
|
|
COMPREPLY=( $( compgen -W '1 2 3 4 5 6' $cur ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2000-08-29 00:41:27 +00:00
|
|
|
|
|
|
|
return 0
|
2000-08-11 21:20:41 +00:00
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
[ "$have" ] && complete -F _chkconfig chkconfig
|
2000-08-11 21:20:41 +00:00
|
|
|
|
2000-09-25 21:38:11 +00:00
|
|
|
# This function performs host completion based on ssh's known_hosts files, defaulting
|
|
|
|
# to standard host completion if they don't exist.
|
2000-08-29 00:41:27 +00:00
|
|
|
#
|
2000-09-25 21:38:11 +00:00
|
|
|
_known_hosts()
|
2000-08-29 00:41:27 +00:00
|
|
|
{
|
2000-09-25 21:38:11 +00:00
|
|
|
local cur kh
|
2000-08-29 00:41:27 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2001-11-20 04:15:48 +00:00
|
|
|
cur=${cur#*@}
|
2001-11-26 18:19:59 +00:00
|
|
|
# Escape slashes and dots in paths for awk
|
|
|
|
cur=${cur//\//\\\/}
|
|
|
|
cur=${cur//\./\\\.}
|
2001-03-05 19:12:48 +00:00
|
|
|
kh=()
|
2000-09-11 18:46:39 +00:00
|
|
|
|
2001-03-05 19:12:48 +00:00
|
|
|
[ -r /etc/known_hosts ] && kh[0]=/etc/known_hosts
|
|
|
|
[ -r /etc/known_hosts2 ] && kh[1]=/etc/known_hosts2
|
|
|
|
[ -r ~/.ssh/known_hosts ] && kh[2]=~/.ssh/known_hosts
|
|
|
|
[ -r ~/.ssh/known_hosts2 ] && kh[3]=~/.ssh/known_hosts2
|
2000-08-29 00:41:27 +00:00
|
|
|
|
|
|
|
# If we have known_hosts files to use
|
|
|
|
if [ ${#kh[@]} -gt 0 ]; then
|
2001-12-05 16:32:24 +00:00
|
|
|
if [[ "$cur" == [0-9]*.* ]]; then
|
2000-09-11 18:46:39 +00:00
|
|
|
# Digits followed by a dot - just search for that
|
|
|
|
cur="^$cur.*"
|
2001-12-05 16:32:24 +00:00
|
|
|
elif [[ "$cur" == [0-9]* ]]; then
|
2000-09-11 18:46:39 +00:00
|
|
|
# Digits followed by no dot - search for digits followed
|
|
|
|
# by a dot
|
|
|
|
cur="^$cur.*\."
|
2001-12-05 16:32:24 +00:00
|
|
|
elif [ -z "$cur" ]; then
|
2000-09-11 18:46:39 +00:00
|
|
|
# A blank - search for a dot or an alpha character
|
|
|
|
cur="[a-z.]"
|
|
|
|
else
|
|
|
|
cur="^$cur"
|
|
|
|
fi
|
2000-08-29 00:41:27 +00:00
|
|
|
# FS needs to look for a comma separated list
|
2001-11-20 04:15:48 +00:00
|
|
|
COMPREPLY=( $( awk 'BEGIN {FS=","}
|
|
|
|
{for (i=1; i<=2; ++i) { \
|
|
|
|
gsub(" .*$", "", $i); \
|
2000-09-11 18:46:39 +00:00
|
|
|
if ($i ~ /'$cur'/) {print $i} \
|
|
|
|
}}' ${kh[@]} ) )
|
2000-08-29 00:41:27 +00:00
|
|
|
else
|
|
|
|
# Just do normal hostname completion
|
|
|
|
COMPREPLY=( $( compgen -A hostname $cur ) )
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2000-09-25 21:38:11 +00:00
|
|
|
complete -F _known_hosts traceroute ping fping telnet host nslookup
|
|
|
|
|
|
|
|
# ssh(1) completion. Should be able to improve this with user@host notation,
|
|
|
|
# but the '@' seems to trigger some kind of bug in bash's completion.
|
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
have ssh &&
|
2000-09-25 21:38:11 +00:00
|
|
|
_ssh()
|
|
|
|
{
|
2001-12-05 16:32:24 +00:00
|
|
|
local cur prev
|
2000-09-25 21:38:11 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-09-25 21:38:11 +00:00
|
|
|
|
|
|
|
case "$prev" in
|
|
|
|
-*c)
|
|
|
|
COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
|
|
|
|
arcfour cast128-cbc' $cur ) )
|
|
|
|
;;
|
|
|
|
-*l)
|
|
|
|
COMPREPLY=( $( compgen -u $cur ) )
|
|
|
|
;;
|
2001-11-20 04:15:48 +00:00
|
|
|
*)
|
|
|
|
_known_hosts
|
2001-12-05 16:32:24 +00:00
|
|
|
[ $COMP_CWORD = 1 ] || \
|
|
|
|
COMPREPLY=( ${COMPREPLY[@]} $( compgen -c $cur ) )
|
2000-09-25 21:38:11 +00:00
|
|
|
esac
|
|
|
|
|
2001-11-20 04:15:48 +00:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
[ "$have" ] && complete -F _ssh ssh slogin sftp
|
|
|
|
|
|
|
|
have scp &&
|
|
|
|
_scp()
|
|
|
|
{
|
2001-12-05 16:32:24 +00:00
|
|
|
local cur
|
2000-09-25 21:38:11 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2001-11-20 04:15:48 +00:00
|
|
|
|
2000-09-25 21:38:11 +00:00
|
|
|
_known_hosts
|
2001-12-05 16:32:24 +00:00
|
|
|
COMPREPLY=( ${COMPREPLY[@]} $( compgen -f $cur ) )
|
2000-09-25 21:38:11 +00:00
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2001-12-05 16:32:24 +00:00
|
|
|
[ "$have" ] && complete -o filenames -F _scp scp
|
2001-11-20 04:15:48 +00:00
|
|
|
|
2000-08-29 00:41:27 +00:00
|
|
|
|
2000-09-11 18:46:39 +00:00
|
|
|
# Linux route(8) completion. This could be improved by adding address family
|
|
|
|
# completion for -A, etc.
|
|
|
|
#
|
|
|
|
_route()
|
|
|
|
{
|
|
|
|
local cur prev
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-09-11 18:46:39 +00:00
|
|
|
|
|
|
|
if [ "$prev" = dev ]; then
|
|
|
|
COMPREPLY=( $( ifconfig -a | sed -ne 's/^\('$cur'[^ ]*\).*$/\1/p' ))
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Must use grep here, otherwise $cur will cause compgen to barf, if
|
|
|
|
# it begins with a hyphen
|
|
|
|
COMPREPLY=( $( compgen -W 'add del -host -net netmask metric mss \
|
|
|
|
window irtt reject mod dyn reinstate dev' | \
|
|
|
|
grep ^$cur ) )
|
|
|
|
|
|
|
|
COMPREPLY=( $( echo " ${COMP_WORDS[@]}" | \
|
|
|
|
(while read -d ' ' i; do
|
|
|
|
[ "$i" == "" ] && continue
|
|
|
|
# flatten array with spaces on either side,
|
|
|
|
# otherwise we cannot grep on word
|
|
|
|
# boundaries of first and last word
|
|
|
|
COMPREPLY=" ${COMPREPLY[@]} "
|
|
|
|
# remove word from list of completions
|
|
|
|
COMPREPLY=( ${COMPREPLY/ $i / } )
|
|
|
|
done
|
|
|
|
echo ${COMPREPLY[@]})
|
|
|
|
) )
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
complete -F _route route
|
|
|
|
|
2000-09-25 21:38:11 +00:00
|
|
|
# GNU make(1) completion (adapted from the example supplied with the bash 2.04
|
|
|
|
# source code)
|
|
|
|
#
|
|
|
|
_make()
|
|
|
|
{
|
2001-12-18 03:43:25 +00:00
|
|
|
local mdef makef gcmd cur prev i
|
2000-09-25 21:38:11 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2000-09-25 21:38:11 +00:00
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
# if prev argument is -f, return possible filename completions.
|
|
|
|
# we could be a little smarter here and return matches against
|
|
|
|
# `makefile Makefile *.mk', whatever exists
|
|
|
|
if [[ "$prev" == -*f ]]; then
|
2000-09-25 21:38:11 +00:00
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
# if we want an option, return the possible posix options
|
|
|
|
if [[ "$cur" == - ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-e -f -i -k -n -p -q -r -S -s -t' | grep ^$cur ) )
|
2000-09-25 21:38:11 +00:00
|
|
|
return 0
|
2001-12-18 03:43:25 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# make reads `makefile' before `Makefile'
|
|
|
|
if [ -f makefile ]; then
|
|
|
|
mdef=makefile
|
|
|
|
elif [ -f Makefile ]; then
|
|
|
|
mdef=Makefile
|
|
|
|
else
|
|
|
|
mdef=*.mk # local convention
|
|
|
|
fi
|
|
|
|
|
|
|
|
# before we scan for targets, see if a makefile name was specified
|
|
|
|
# with -f
|
|
|
|
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
|
|
|
|
if [[ ${COMP_WORDS[i]} == -*f ]]; then
|
|
|
|
eval makef=${COMP_WORDS[i+1]} # eval for tilde expansion
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
[ -z "$makef" ] && makef=$mdef
|
|
|
|
|
|
|
|
# if we have a partial word to complete, restrict completions to
|
|
|
|
# matches of that word
|
|
|
|
[ -n "$2" ] && gcmd='grep "^$2"' || gcmd=cat
|
|
|
|
|
|
|
|
# if we don't want to use *.mk, we can take out the cat and use
|
|
|
|
# test -f $makef and input redirection
|
|
|
|
COMPREPLY=( $( cat $makef 2>/dev/null | \
|
2000-09-25 21:38:11 +00:00
|
|
|
awk 'BEGIN {FS=":"} /^[^.# ][^=]*:/ {print $1}' | \
|
|
|
|
eval $gcmd ) )
|
|
|
|
|
|
|
|
# default to filename completion if all else failed
|
|
|
|
if [ ${#COMPREPLY[@]} = 0 ]; then
|
2000-10-09 18:07:50 +00:00
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
2000-09-25 21:38:11 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
complete -F _make -X '+($*|*.[cho])' -o filenames make gmake pmake
|
2001-01-10 23:09:48 +00:00
|
|
|
|
|
|
|
# Red Hat Linux service completion. This completes on a list of all available
|
|
|
|
# service scripts in the SysV init.d directory, followed by that script's
|
|
|
|
# available commands
|
|
|
|
#
|
2001-07-08 23:14:13 +00:00
|
|
|
have service &&
|
2001-01-10 23:09:48 +00:00
|
|
|
_service()
|
|
|
|
{
|
|
|
|
local cur sysvdir
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2001-01-10 23:09:48 +00:00
|
|
|
|
2001-03-05 19:12:48 +00:00
|
|
|
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d \
|
|
|
|
|| sysvdir=/etc/init.d
|
2001-01-10 23:09:48 +00:00
|
|
|
|
|
|
|
#[[ "$cur" == -* ]] && return 0
|
|
|
|
if [ $COMP_CWORD = 1 ]; then
|
|
|
|
COMPREPLY=( $( compgen -W '`echo $sysvdir/!(*.rpmsave|*.rpmorig)`' ) )
|
|
|
|
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#$sysvdir/}' $cur ) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \
|
|
|
|
s/^.*Usage.*{\(.*\)}.*$/\1/p" \
|
2001-11-26 18:19:59 +00:00
|
|
|
$sysvdir/${COMP_WORDS[1]}`' $cur ) )
|
2001-01-10 23:09:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
[ "$have" ] && complete -F _service service
|
2001-07-08 23:14:13 +00:00
|
|
|
|
|
|
|
# The beginnings of a completion function for GNU tar(1)
|
|
|
|
#
|
|
|
|
_tar()
|
|
|
|
{
|
|
|
|
local cur
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2001-07-08 23:14:13 +00:00
|
|
|
|
2002-01-05 19:42:41 +00:00
|
|
|
if [[ ${COMP_WORDS[1]} == c*f ]]; then
|
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
elif [[ ${COMP_WORDS[1]} == +([^zj])f ]]; then
|
|
|
|
COMPREPLY=( $( compgen -G $cur\*.tar ) )
|
|
|
|
elif [[ ${COMP_WORDS[1]} == *z*f ]]; then
|
|
|
|
COMPREPLY=( $( compgen -G $cur\*.t?(ar.)gz ) )
|
2001-07-08 23:14:13 +00:00
|
|
|
elif [[ ${COMP_WORDS[1]} == *j*f ]]; then
|
|
|
|
COMPREPLY=( $( compgen -G $cur\*.tar.bz2 ) )
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
complete -F _tar -o default tar
|
|
|
|
|
|
|
|
# Linux iptables(8) completion
|
|
|
|
#
|
|
|
|
have iptables &&
|
|
|
|
_iptables()
|
|
|
|
{
|
|
|
|
local cur
|
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
|
|
|
|
[ "$prev" = -t ] && COMPREPLY=( $( compgen -W 'nat filter mangle' $cur ) )
|
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
[ "$have" ] && complete -F _iptables iptables
|
2001-07-08 23:14:13 +00:00
|
|
|
|
2002-01-03 00:16:41 +00:00
|
|
|
# tcpdump(8) completion
|
2001-07-08 23:14:13 +00:00
|
|
|
#
|
|
|
|
have tcpdump &&
|
|
|
|
_tcpdump()
|
|
|
|
{
|
|
|
|
local cur
|
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
|
|
|
|
COMPREPLY=( $( compgen -W 'host net port src dst ether gateway
|
|
|
|
less greater' $cur ) )
|
|
|
|
|
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
[ "$have" ] && complete -F _tcpdump tcpdump
|
2001-03-05 19:12:48 +00:00
|
|
|
|
|
|
|
# This meta-cd function observes the CDPATH variable, so that cd additionally
|
|
|
|
# completes on directories under those specified in CDPATH.
|
|
|
|
#
|
|
|
|
_cd()
|
|
|
|
{
|
2002-01-04 04:34:21 +00:00
|
|
|
local IFS=$'\t\n' cur=${COMP_WORDS[COMP_CWORD]} dirs=() i
|
2001-03-05 19:12:48 +00:00
|
|
|
|
2001-11-20 04:15:48 +00:00
|
|
|
# expand ~username type directory specifications
|
|
|
|
if [[ "$cur" == \~*/* ]]; then
|
|
|
|
eval cur=$cur
|
|
|
|
elif [[ "$cur" == \~* ]]; then
|
|
|
|
cur=${cur#\~}
|
|
|
|
COMPREPLY=( $( compgen -P '~' -u $cur ) )
|
|
|
|
return 0
|
|
|
|
fi
|
2001-03-05 19:12:48 +00:00
|
|
|
|
2001-11-20 04:15:48 +00:00
|
|
|
# standard dir completion if parameter starts with /, ./ or ../
|
2002-01-05 19:48:59 +00:00
|
|
|
if [[ "$cur" == ?(.)?(.)/* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -d $cur ) )
|
|
|
|
return 0
|
|
|
|
fi
|
2001-09-21 18:51:30 +00:00
|
|
|
if [ -n "$CDPATH" ]; then
|
2001-03-05 19:12:48 +00:00
|
|
|
# we have a CDPATH, so loop on its contents
|
|
|
|
for i in ${CDPATH//:/ }; do
|
|
|
|
# create an array of matched subdirs
|
|
|
|
dirs=( $( compgen -d $i/$cur ) )
|
|
|
|
# add subdirs to list of completions as necessary
|
|
|
|
[ ${#dirs[@]} ] && COMPREPLY=( ${COMPREPLY[@]} ${dirs[@]#$i/})
|
|
|
|
done
|
2001-09-21 18:51:30 +00:00
|
|
|
fi
|
2002-01-05 19:48:59 +00:00
|
|
|
COMPREPLY=( $( compgen -d $cur ) )
|
2001-03-05 19:12:48 +00:00
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
2001-07-09 00:55:01 +00:00
|
|
|
complete -F _cd -o filenames cd
|
|
|
|
|
2001-08-16 15:49:39 +00:00
|
|
|
# A meta-command completion function, for commands like sudo, which often
|
|
|
|
# need to complete on a command, followed by a file-name
|
|
|
|
#
|
|
|
|
_command()
|
|
|
|
{
|
|
|
|
local cur
|
|
|
|
|
2001-12-18 03:43:25 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2001-08-16 15:49:39 +00:00
|
|
|
|
|
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
|
|
COMPREPLY=( $( compgen -c $cur ) )
|
|
|
|
else
|
|
|
|
COMPREPLY=( $( compgen -f $cur ) )
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _command -o filenames type nohup exec nice eval strace sudo gdb
|
|
|
|
|
|
|
|
# Basic Perforce completion by Frank Cusack (frank@google.com)
|
2001-07-09 00:55:01 +00:00
|
|
|
#
|
|
|
|
have p4 &&
|
|
|
|
_p4()
|
|
|
|
{
|
2001-08-16 15:49:39 +00:00
|
|
|
local cur prev prev2 p4commands p4filetypes
|
2001-07-09 00:55:01 +00:00
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
2001-12-18 03:43:25 +00:00
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
2001-08-16 15:49:39 +00:00
|
|
|
|
|
|
|
# rename isn't really a command
|
|
|
|
p4commands="add admin branch branches change changes client \
|
|
|
|
clients counter counters delete depot depots describe \
|
|
|
|
diff diff2 dirs edit filelog files fix fixes flush \
|
|
|
|
fstat group groups have help info integrate integrated \
|
|
|
|
job jobs jobspec label labels labelsync lock obliterate \
|
|
|
|
opened passwd print protect rename reopen resolve \
|
|
|
|
resolved revert review reviews set submit sync triggers \
|
|
|
|
typemap unlock user users verify where"
|
|
|
|
p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \
|
|
|
|
uresource uxbinary xbinary xltext xtempobj xtext \
|
|
|
|
text binary resource"
|
|
|
|
|
|
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
|
|
COMPREPLY=( $( compgen -W "$p4commands" $cur ) )
|
|
|
|
elif [ $COMP_CWORD -eq 2 ]; then
|
|
|
|
case "$prev" in
|
|
|
|
help)
|
|
|
|
COMPREPLY=( $( compgen -W "simple commands \
|
|
|
|
environment filetypes jobview revisions \
|
|
|
|
usage views $p4commands" $cur ) )
|
|
|
|
;;
|
|
|
|
admin)
|
|
|
|
COMPREPLY=( $( compgen -W "checkpoint stop" $cur ) )
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
elif [ $COMP_CWORD -gt 2 ]; then
|
2001-12-18 03:43:25 +00:00
|
|
|
prev2=${COMP_WORDS[COMP_CWORD-2]}
|
2001-08-16 15:49:39 +00:00
|
|
|
case "$prev" in
|
|
|
|
-t)
|
|
|
|
case "$prev2" in
|
|
|
|
add|edit|reopen)
|
|
|
|
COMPREPLY=( $(compgen -W "$p4filetypes" $cur) )
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
2001-07-09 00:55:01 +00:00
|
|
|
}
|
2001-11-29 00:37:54 +00:00
|
|
|
[ "$have" ] && complete -F _p4 -o default p4 g4
|
2001-03-05 19:12:48 +00:00
|
|
|
|
2001-12-11 20:25:53 +00:00
|
|
|
# ant completion is modified from the original submitted by
|
|
|
|
# Claus-Peter Klas <peter.klas@uni-dortmund.de>
|
|
|
|
#
|
|
|
|
have ant &&
|
|
|
|
_ant_targets()
|
|
|
|
{
|
|
|
|
COMPREPLY=()
|
|
|
|
local gcmd
|
|
|
|
|
|
|
|
# if we have a partial word to complete, restrict completions to
|
|
|
|
# matches of that word
|
|
|
|
[ ! -f build.xml ] && return 0
|
|
|
|
|
|
|
|
[ -n "$2" ] && gcmd='grep "^$2"' || gcmd=cat
|
|
|
|
|
|
|
|
COMPREPLY=( $( awk 'BEGIN {FS="\""} /\<target/ {print $2}' < build.xml \
|
|
|
|
| tr -s ' ' '\012' | sort -u | eval $gcmd ) )
|
|
|
|
}
|
|
|
|
[ "$have" ] && complete -F _ant_targets ant
|
|
|
|
|
2001-12-18 03:25:04 +00:00
|
|
|
have nslookup &&
|
|
|
|
_nslookup()
|
|
|
|
{
|
|
|
|
local cur
|
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]#-}
|
|
|
|
|
|
|
|
COMPREPLY=( $( compgen -P '-' -W 'all class= debug d2 domain= \
|
|
|
|
srchlist= defname search port= querytype= \
|
|
|
|
type= recurse retry root timeout vc \
|
|
|
|
ignoretc' $cur ) )
|
|
|
|
}
|
|
|
|
[ "$have" ] && complete -F _nslookup nslookup
|
|
|
|
|
2001-03-05 19:12:48 +00:00
|
|
|
# Return 1 if $1 appears to contain a redirection operator. Handles backslash
|
|
|
|
# quoting (barely).
|
|
|
|
#
|
|
|
|
_redir_op()
|
|
|
|
{
|
|
|
|
case "$1" in
|
|
|
|
*\\'[\<\>]'*) return 1;;
|
|
|
|
*[\<\>]*) return 0;;
|
|
|
|
*) return 1;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# _redir_test tests the current word ($1) and the previous word ($2) for
|
|
|
|
# redirection operators and does filename completion on the current word
|
|
|
|
# if either one contains a redirection operator
|
|
|
|
_redir_test()
|
|
|
|
{
|
|
|
|
if _redir_op "$1" ; then
|
|
|
|
COMPREPLY=( $( compgen -f "$1" ) )
|
|
|
|
return 0
|
|
|
|
elif _redir_op "$2" ; then
|
|
|
|
COMPREPLY=( $( compgen -f "$1" ) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
_configure_func ()
|
|
|
|
{
|
|
|
|
case "$2" in
|
|
|
|
-*) ;;
|
|
|
|
*) return ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
\~*) eval cmd=$1 ;;
|
|
|
|
*) cmd="$1" ;;
|
|
|
|
esac
|
|
|
|
|
2002-01-03 00:16:41 +00:00
|
|
|
COMPREPLY=( $( "$cmd" --help | sed -ne 's/^ *\('$2'[^ '$'\t'',[]\+\).*$/\1/p' ) )
|
2001-03-05 19:12:48 +00:00
|
|
|
}
|
|
|
|
complete -F _configure_func configure
|
2001-07-08 23:14:13 +00:00
|
|
|
|
2001-12-20 07:52:12 +00:00
|
|
|
_file_and_dir()
|
|
|
|
{
|
2002-01-04 04:34:21 +00:00
|
|
|
local IFS cur xspec
|
2001-12-20 07:52:12 +00:00
|
|
|
|
2002-01-04 04:34:21 +00:00
|
|
|
IFS=$'\t\n'
|
2001-12-20 07:52:12 +00:00
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]#-}
|
|
|
|
|
|
|
|
# get first exclusion compspec that matches this command
|
2001-12-20 18:26:49 +00:00
|
|
|
xspec=$( sed -ne '/ '$1'/{p;q;}' /etc/bash_completion )
|
2001-12-20 07:52:12 +00:00
|
|
|
# prune to leave nothing but the -X spec
|
|
|
|
xspec=${xspec#*-X }
|
|
|
|
xspec=${xspec%% *}
|
|
|
|
|
|
|
|
COMPREPLY=( $( eval compgen -f -X "$xspec" $cur ) $( compgen -d $cur ) )
|
|
|
|
}
|
2001-12-20 16:12:44 +00:00
|
|
|
list=( $( sed -ne '/^# START exclude/,/^# FINISH exclude/p' \
|
|
|
|
/etc/bash_completion | \
|
|
|
|
# read exclusion compspecs
|
|
|
|
(
|
|
|
|
while read line
|
|
|
|
do
|
|
|
|
line=${line%# START exclude*}
|
|
|
|
line=${line%# FINISH exclude*}
|
|
|
|
line=${line##*\'}
|
|
|
|
list=( ${list[@]} $line )
|
|
|
|
done
|
|
|
|
echo ${list[@]}
|
|
|
|
)
|
2001-12-20 18:26:49 +00:00
|
|
|
) )
|
2001-12-20 07:52:12 +00:00
|
|
|
# remove previous compspecs
|
2002-01-03 00:16:41 +00:00
|
|
|
if [ ${#list[@]} -gt 0 ]; then
|
|
|
|
eval complete -r ${list[@]}
|
|
|
|
# install new compspecs
|
|
|
|
eval complete -F _file_and_dir -o filenames ${list[@]}
|
|
|
|
fi
|
2001-12-20 16:12:44 +00:00
|
|
|
unset list[@]
|
2001-12-20 07:52:12 +00:00
|
|
|
|
2001-12-05 16:32:24 +00:00
|
|
|
# source user completion file
|
|
|
|
[ -f ~/.bash_completion ] && . ~/.bash_completion
|
2001-07-08 23:14:13 +00:00
|
|
|
unset -f have
|
|
|
|
unset OS RELEASE have
|