| 1 |
# Debian GNU/Linux pon/poff(1) completion |
| 2 |
# Copyright 2002 Baruch Even <[email protected]> |
| 3 |
# License: GNU GPL v2 or later |
| 4 |
|
| 5 |
_poff() |
| 6 |
{ |
| 7 |
local prev cur conns |
| 8 |
|
| 9 |
[ -r /etc/ppp/peers/ ] || return 0 |
| 10 |
|
| 11 |
COMPREPLY=() |
| 12 |
prev=${COMP_WORDS[COMP_CWORD-1]} |
| 13 |
cur=${COMP_WORDS[COMP_CWORD]} |
| 14 |
conns=$(\ls --color=none /etc/ppp/peers | egrep -v '(\.bak|~)$') |
| 15 |
|
| 16 |
if [[ "$cur" == -* ]]; then |
| 17 |
COMPREPLY=( $(compgen -W '-r -d -c -a -h -v' -- $cur) ) |
| 18 |
return 0 |
| 19 |
fi |
| 20 |
|
| 21 |
# first parameter on line or first since an option? |
| 22 |
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \ |
| 23 |
[[ "$prev" == -* ]]; then |
| 24 |
COMPREPLY=( $(compgen -o filenames -W "$conns" $cur) ) |
| 25 |
fi |
| 26 |
|
| 27 |
return 0 |
| 28 |
} |
| 29 |
complete -F _poff poff |
| 30 |
|
| 31 |
# vim:ft=sh: |