You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
2.9 KiB

# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../bashcompletion/rock-tools
# Copyright (C) 1998 - 2004 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# 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; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-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