Upstart

Florian Diesch diesch at spamfence.net
Mon Mar 8 00:07:53 UTC 2010


Jan Claeys <lists at janc.be> writes:

> Op zondag 07-03-2010 om 15:21 uur [tijdzone -0500], schreef Tom H:
>> 999. Could initctl be made to recognize, for example, both
>> avahi-daemon and avahi-daemon.conf? (If I am in /etc/init - it is rare
>> but it happens - and type "stop av//tab//", I end up with "stop
>> avahi-daemon.conf" which, after pressing //enter// results in an
>> "unknown job" message.) 
>
> That sounds like the lack of a specialised bash-completion function?

This seems to do the job (except for completions of arguments for --dest):

--8<---------------cut here---------------start------------->8---
_stop() 
{
        local cur

        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}

        case "$cur" in
            -*)
                COMPREPLY=( $( compgen -W '-n --no-wait --system --dest -q --quiet -v --verbose --help --version' -- $cur ) )
                ;;
            *)
               COMPREPLY=( $(initctl list| awk "/^$cur/ {print \$1}" ) )
                ;;
        esac
  
        return 0

}
complete -F _stop stop

--8<---------------cut here---------------end--------------->8---

   Florian
-- 
GUIs programmieren mit Python und Glade:
<http://www.florian-diesch.de/doc/python-und-glade/>




More information about the Ubuntu-devel-discuss mailing list