|
|
|
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
|
|
|
|
#
|
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
|
|
|
# Please add additional copyright information _after_ the line containing
|
|
|
|
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
|
|
|
|
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
|
|
|
|
#
|
|
|
|
# ROCK Linux: rock-src/package/*/bashcompletion/rock-tools
|
|
|
|
# Copyright (C) 1998 - 2004 Clifford Wolf
|
|
|
|
#
|
|
|
|
# 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 of the License, or
|
|
|
|
# (at your option) any later version. A copy of the GNU General Public
|
|
|
|
# License can be found at Documentation/COPYING.
|
|
|
|
#
|
|
|
|
# Many people helped and are helping developing ROCK Linux. Please
|
|
|
|
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
|
|
|
|
# file for details.
|
|
|
|
#
|
|
|
|
# --- ROCK-COPYRIGHT-NOTE-END ---
|
|
|
|
|
|
|
|
_interfaces() {
|
|
|
|
COMPREPLY=( $( compgen -W "$( command \
|
|
|
|
sed -ne 's|^interface \([^ ]\+\).*$|\1|p' \
|
|
|
|
/etc/network/config )" -- $cur ) )
|
|
|
|
}
|
|
|
|
|
|
|
|
_mine_installed_packages() {
|
|
|
|
COMPREPLY=( $( compgen -W "`(cd /var/adm/packages; echo *)`" -- $cur ) )
|
|
|
|
}
|
|
|
|
|
|
|
|
_mine() {
|
|
|
|
local cur prev
|
|
|
|
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
|
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
|
|
case "$cur" in
|
|
|
|
*)
|
|
|
|
COMPREPLY=( $( compgen -W '-i -r -q -p -l -m -c -d -k -C -T' \
|
|
|
|
-- $cur ) )
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$prev" in
|
|
|
|
-R)
|
|
|
|
_filedir -d
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-k)
|
|
|
|
COMPREPLY=( $( compgen -W 'pkg_name pkg_version pkg_tarbz2 \
|
|
|
|
pkg_config packages flists md5sums cksums \
|
|
|
|
dependencies descs creator COPY I TITLE T \
|
|
|
|
TEXT U URL A AUTHOR M MAINTAINER C CATEGORY \
|
|
|
|
F FLAG R ARCH ARCHITECTURE E DEP DEPENDENCY \
|
|
|
|
L LICENSE S STATUS V VER VERSION P PRI \
|
|
|
|
PRIORITY CV-URL CV-PAT CV-DEL O CONF D DOWN \
|
|
|
|
DOWNLOAD SRC SOURCEPACKAGE' -- $cur ) )
|
|
|
|
return 0
|
|
|
|
esac
|
|
|
|
|
|
|
|
case "${COMP_WORDS[1]}" in
|
|
|
|
-i)
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-t -v -f -R' -- $cur ) )
|
|
|
|
else
|
|
|
|
_filedir 'gem'
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
-r)
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-t -v -f -R' -- $cur ) )
|
|
|
|
else
|
|
|
|
_mine_installed_packages
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
-[qplmcd])
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-h -H' -- $cur ) )
|
|
|
|
else
|
|
|
|
_mine_installed_packages
|
|
|
|
_filedir 'gem'
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
-k)
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-h -H' -- $cur ) )
|
|
|
|
else
|
|
|
|
_filedir 'gem'
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
-C)
|
|
|
|
case "$COMP_CWORD" in
|
|
|
|
2)
|
|
|
|
_filedir -d
|
|
|
|
;;
|
|
|
|
3)
|
|
|
|
_filedir 'tar.bz2'
|
|
|
|
;;
|
|
|
|
4)
|
|
|
|
_mine_installed_packages
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
-T)
|
|
|
|
case "$COMP_CWORD" in
|
|
|
|
2|3)
|
|
|
|
_filedir -d
|
|
|
|
;;
|
|
|
|
4)
|
|
|
|
_mine_installed_packages
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
complete -F _mine $filenames mine
|
|
|
|
|
|
|
|
_rc()
|
|
|
|
{
|
|
|
|
COMPREPLY=()
|
|
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
|
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
|
|
#first parameter on line
|
|
|
|
if [ -r /etc/rc.d/init.d ]; then
|
|
|
|
COMPREPLY=( $( compgen -W "`(cd /etc/rc.d/init.d; echo *)`" \
|
|
|
|
-- $cur ) )
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $COMP_CWORD -eq 2 ]; then
|
|
|
|
#second parameter on line
|
|
|
|
COMPREPLY=( $( compgen -W "$( command rc $prev help | \
|
|
|
|
cut -d{ -f2 | tr -d '{}|' )" \
|
|
|
|
-- $cur ) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
complete -F _rc $filenames rc
|
|
|
|
|