- first stab at ypmatch(1) and ypcat(1) completion

This commit is contained in:
ianmacd 2002-12-05 05:31:42 +00:00
parent eb5c0f1aef
commit 9cf86f6f10

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05b
#
# $Id: bash_completion,v 1.477 2002/12/05 05:22:22 ianmacd Exp $
# $Id: bash_completion,v 1.478 2002/12/05 06:31:42 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
@ -4108,6 +4108,27 @@ _look()
}
[ "$have" ] && complete -F _look $default look
# ypcat(1) and ypmatch(1) completion
#
have ypmatch &&
_ypmatch()
{
local cur map
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
if [ $COMP_CWORD = 1 ] || [ $1 = ypcat ]; then
COMPREPLY=( $( compgen -W \
'$( echo $(ypcat -x | cut -d"\"" -f 2))' -- $cur))
return 0
fi
map=${COMP_WORDS[1]}
COMPREPLY=( $( compgen -W '$( ypcat $map | cut -d':' -f 1 )' -- $cur) )
}
[ "$have" ] && complete -F _ypmatch ypmatch ypcat
_filedir_xspec()
{
local IFS cur xspec