2009-05-18 23:02:38 +02:00
|
|
|
# bash completion for rpcdebug
|
|
|
|
|
2011-04-05 00:35:51 +03:00
|
|
|
have rpcdebug || return
|
|
|
|
|
2009-05-18 23:02:38 +02:00
|
|
|
_rpcdebug_flags()
|
|
|
|
{
|
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
local i module
|
|
|
|
|
2011-04-21 11:04:51 +03:00
|
|
|
for (( i=0; i < ${#words[@]}; i++ )); do
|
|
|
|
if [[ ${words[i]} == -m ]]; then
|
|
|
|
module=${words[i+1]}
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "$module" ]; then
|
2011-03-21 19:23:57 +02:00
|
|
|
COMPREPLY=( $( compgen -W "$( rpcdebug -vh 2>&1 | \
|
|
|
|
sed -ne 's/^'$module'[[:space:]]\{1,\}//p' )" -- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2009-05-18 23:02:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
_rpcdebug()
|
|
|
|
{
|
2011-04-21 11:04:51 +03:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2009-10-04 19:42:50 +02:00
|
|
|
|
|
|
|
case $prev in
|
|
|
|
-s)
|
|
|
|
_rpcdebug_flags
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-c)
|
|
|
|
_rpcdebug_flags
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
-m)
|
|
|
|
COMPREPLY=( $( compgen -W 'rpc nfs nfsd nlm' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-05-15 15:18:55 +03:00
|
|
|
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" -h ) -s -c' \
|
|
|
|
-- "$cur" ) )
|
2009-10-04 19:42:50 +02:00
|
|
|
fi
|
2011-04-04 22:14:39 +03:00
|
|
|
} &&
|
2009-05-18 23:02:38 +02:00
|
|
|
complete -F _rpcdebug rpcdebug
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
2009-10-04 19:42:50 +02:00
|
|
|
# sh-basic-offset: 4
|
2009-10-01 20:54:51 +03:00
|
|
|
# sh-indent-comment: t
|
2009-10-04 19:42:50 +02:00
|
|
|
# indent-tabs-mode: nil
|
2009-10-01 20:54:51 +03:00
|
|
|
# End:
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|