removed _gid_function and made other modifications to account for the fact
that group completion is now standard in bash 2.05a
This commit is contained in:
parent
3b4c23a0d2
commit
717b5e5bdd
@ -1,8 +1,8 @@
|
|||||||
# bash_completion - some programmable completion functions for bash 2.05
|
# bash_completion - some programmable completion functions for bash 2.05a
|
||||||
#
|
#
|
||||||
# <![CDATA[
|
# <![CDATA[
|
||||||
#
|
#
|
||||||
# $Id: bash_completion,v 1.29 2001/11/26 19:19:59 ianmacd Exp $
|
# $Id: bash_completion,v 1.30 2001/11/29 01:37:54 ianmacd Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||||
#
|
#
|
||||||
@ -56,6 +56,9 @@ complete -A signal kill -P '%'
|
|||||||
# user commands see only users
|
# user commands see only users
|
||||||
complete -u finger su usermod userdel passwd
|
complete -u finger su usermod userdel passwd
|
||||||
|
|
||||||
|
# group commands see only groups
|
||||||
|
complete -u groupmod groupdel passwd
|
||||||
|
|
||||||
# bg completes with stopped jobs
|
# bg completes with stopped jobs
|
||||||
complete -A stopped -P '%' bg
|
complete -A stopped -P '%' bg
|
||||||
|
|
||||||
@ -122,9 +125,7 @@ _chown()
|
|||||||
if [[ "$cur" == [a-zA-Z]*.* ]]; then
|
if [[ "$cur" == [a-zA-Z]*.* ]]; then
|
||||||
user=${cur%.*}
|
user=${cur%.*}
|
||||||
group=${cur#*.}
|
group=${cur#*.}
|
||||||
COMPREPLY=( $( awk 'BEGIN {FS=":"} \
|
COMPREPLY=( $( compgen -g $group ) )
|
||||||
{if ($1 ~ /^'$group'/) print $1}' \
|
|
||||||
/etc/group ) )
|
|
||||||
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
|
||||||
COMPREPLY[i]=$user.${COMPREPLY[i]}
|
COMPREPLY[i]=$user.${COMPREPLY[i]}
|
||||||
done
|
done
|
||||||
@ -155,21 +156,6 @@ _umount()
|
|||||||
}
|
}
|
||||||
complete -F _umount -o filenames umount
|
complete -F _umount -o filenames umount
|
||||||
|
|
||||||
# GID completion. This will get a list of all valid group names from
|
|
||||||
# /etc/group and should work anywhere.
|
|
||||||
#
|
|
||||||
_gid_func()
|
|
||||||
{
|
|
||||||
local cur
|
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
|
||||||
COMPREPLY=( $( awk 'BEGIN {FS=":"} {if ($1 ~ /^'$cur'/) print $1}' \
|
|
||||||
/etc/group ) )
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
complete -F _gid_func groupdel groupmod
|
|
||||||
|
|
||||||
# mount(8) completion. This will pull a list of possible mounts out of
|
# mount(8) completion. This will pull a list of possible mounts out of
|
||||||
# /etc/fstab, unless the word being completed contains a ':', which
|
# /etc/fstab, unless the word being completed contains a ':', which
|
||||||
# would indicate the specification of an NFS server. In that case, we
|
# would indicate the specification of an NFS server. In that case, we
|
||||||
@ -380,8 +366,7 @@ _find()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-group)
|
-group)
|
||||||
COMPREPLY=( $( awk 'BEGIN {FS=":"} \
|
COMPREPLY=( $( compgen -g $cur ) )
|
||||||
{if ($1 ~ /^'$cur'/) print $1}' /etc/group ) )
|
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-?(x)type)
|
-?(x)type)
|
||||||
@ -1294,7 +1279,6 @@ _command()
|
|||||||
if [ $COMP_CWORD -eq 1 ]; then
|
if [ $COMP_CWORD -eq 1 ]; then
|
||||||
COMPREPLY=( $( compgen -c $cur ) )
|
COMPREPLY=( $( compgen -c $cur ) )
|
||||||
else
|
else
|
||||||
# XXX sudo chkconfig should complete just as chkconfig would
|
|
||||||
COMPREPLY=( $( compgen -f $cur ) )
|
COMPREPLY=( $( compgen -f $cur ) )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -1358,7 +1342,7 @@ _p4()
|
|||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
[ "$have" ] && complete -F _p4 -o default p4
|
[ "$have" ] && complete -F _p4 -o default p4 g4
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return 1 if $1 appears to contain a redirection operator. Handles backslash
|
# Return 1 if $1 appears to contain a redirection operator. Handles backslash
|
||||||
|
Loading…
x
Reference in New Issue
Block a user