Add mount -L and -U completion (Raphaël Droz).
This commit is contained in:
parent
5c0e30473f
commit
95cd673b5c
3
CHANGES
3
CHANGES
@ -40,6 +40,9 @@ bash-completion (1.x)
|
||||
[ Guillaume Rousse ]
|
||||
* Split mkinitrd completion to contrib/mkinitrd, improve it.
|
||||
|
||||
[ Raphaël Droz ]
|
||||
* Add mount -L and -U completion.
|
||||
|
||||
-- David Paleino <d.paleino@gmail.com> Wed, 25 Mar 2009 23:18:24 +0100
|
||||
|
||||
bash-completion (1.0)
|
||||
|
@ -855,11 +855,12 @@ complete -F _umount $dirnames umount
|
||||
#
|
||||
_mount()
|
||||
{
|
||||
local cur i sm host
|
||||
local cur i sm host prev
|
||||
|
||||
COMPREPLY=()
|
||||
cur=`_get_cword`
|
||||
[[ "$cur" == \\ ]] && cur="/"
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
|
||||
for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
|
||||
|
||||
@ -884,8 +885,14 @@ _mount()
|
||||
| grep "^$cur" ) )
|
||||
else
|
||||
# probably Linux
|
||||
COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' \
|
||||
if [ $prev = -L ]; then
|
||||
COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*LABEL=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- $cur ) )
|
||||
elif [ $prev = -U ]; then
|
||||
COMPREPLY=( $( compgen -W '$(sed -ne "s/^[[:space:]]*UUID=\([^[:space:]]*\).*/\1/p" /etc/fstab )' -- $cur ) )
|
||||
else
|
||||
COMPREPLY=( $( awk '! /^[ \t]*#/ {if ($2 ~ /\//) print $2}' \
|
||||
/etc/fstab | grep "^$cur" ) )
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user