diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2010-01-24 19:43:16 +0200 |
---|---|---|
committer | Ville Skyttä <ville.skytta@iki.fi> | 2010-01-24 19:43:16 +0200 |
commit | 359db46260b1b781f0999fa1516cc3a88976b050 (patch) | |
tree | 0a6e8a375843674e1f494cc1e0cfeaa2e85a4354 | |
parent | 5c5d804696ad715c4d8516b061564d0ab5115ab6 (diff) | |
download | bash-completion-359db46260b1b781f0999fa1516cc3a88976b050.tar.gz |
Don't bother looking for showmount if not doing NFS completion.
-rw-r--r-- | contrib/mount | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/contrib/mount b/contrib/mount index 59bbd268..f9fafb17 100644 --- a/contrib/mount +++ b/contrib/mount @@ -9,21 +9,23 @@ have mount && _mount() { - local cur i sm host prev + local cur sm host prev COMPREPLY=() cur=`_get_cword ':'` prev=`_get_pword ':'` [[ "$cur" == \\ ]] && cur="/" - for i in $(type -P showmount) {,/usr}/{,s}bin/showmount; do - [ -x $i ] && sm=$i && break - done + if [[ "$cur" == *:* ]]; then + for sm in $(type -P showmount) {,/usr}/{,s}bin/showmount; do + [ -x $sm ] || continue + COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | \ + awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) ) + return 0 + done + fi - if [[ -n "$sm" && "$cur" == *:* ]]; then - COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | \ - awk 'NR>1 {print $1}' )" -- "${cur#*:}" ) ) - elif [[ "$cur" == //* ]]; then + if [[ "$cur" == //* ]]; then host=${cur#//} host=${host%%/*} if [ -n "$host" ]; then |