OpenNetAdmin

Track. Automate. Configure.

Home About Features Community Develop
Download this project as a tar.gz file

Some bash_completion for dcm.pl

Matt

14-04-2011 10:34:50

Here is a bash_completion script for dcm.pl if you are interested. It will help to TAB out the modules available

Just drop it in to a file called /etc/bash_completion.d/dcm.pl


_dcm.pl()
{
local binary current previous modules

binary=$(which dcm.pl)

if [[ -x "${binary}" ]] ; then
COMPREPLY=()

current=${COMP_WORDS[COMP_CWORD]}
previous=${COMP_WORDS[COMP_CWORD - 1]}

if [[ "$previous" == "-r" ]]; then
modules=$( "${binary}" --list | awk '{print $1}'|tail -n +3 )
COMPREPLY=( $(compgen -W "${modules}" -- ${current}) )
else
COMPREPLY=( $( compgen -W '-r -c -u -l -p -v --list --symlink \
--syslog --logfile -nostdout' -- ${current}) )
fi

fi

return 0
}

complete -F _dcm.pl dcm.pl