Hi All, Attached is a new bash completion I have written for the "upstart" init replacement (http://upstart.ubuntu.com).
Please could this be added to the review queue. Thank you in advance. -- Kind regards, James Hunt ______________________________________________________________________ Ubuntu Foundations Team, Canonical.
# bash-completion for the upstart event-based init replacement. # We don't provide completion for 'init' itself for obvious reasons. have initctl && _upstart_conf_events() { initctl list|awk '{print $1}' } && _upstart_named_events() { (cd /etc/init && grep '^emits ' *.conf|sed 's/^emits //g') } && _upstart_events() { (_upstart_conf_events;_upstart_named_events)|tr ' ' '\n'|sort -u } && _upstart_startable_events() { initctl list|cut -d\, -f1|awk '$2 == "stop/waiting" {print $1}' } && _upstart_stoppable_events() { initctl list|cut -d\, -f1|awk '$2 == "start/running" {print $1}' } && _upstart_initctl() { _get_comp_words_by_ref cur prev COMPREPLY=() case "$prev" in start) COMPREPLY=( $(compgen -W "$(_upstart_startable_events)" -- ${cur}) ) return 0 ;; stop) COMPREPLY=( $(compgen -W "$(_upstart_stoppable_events)" -- ${cur}) ) return 0 ;; emit) COMPREPLY=( $(compgen -W "$(_upstart_events)" -- ${cur}) ) return 0 ;; reload|restart|status) COMPREPLY=( $(compgen -W "$(_upstart_conf_events)" -- ${cur}) ) return 0 ;; --help|--version) COMPREPLY=() return 0 ;; esac opts="--help --version -q --quiet -v --verbose --system --dest=" cmds=$(initctl help|grep "^ [^ ]"|awk '{print $1}') COMPREPLY=( $(compgen -W "${opts} ${cmds}" -- ${cur}) ) } && complete -F _upstart_initctl initctl have start && _upstart_start() { COMPREPLY=() _get_comp_words_by_ref cur prev opts="--help --version -q --quiet -v --verbose --system --dest= \ -n --no-wait" case "$prev" in --help|--version) COMPREPLY=() return 0 ;; esac COMPREPLY=( $(compgen -W "$opts $(_upstart_startable_events)" -- ${cur}) ) return 0 } && complete -F _upstart_start start have stop && _upstart_stop() { COMPREPLY=() _get_comp_words_by_ref cur prev opts="--help --version -q --quiet -v --verbose --system --dest= \ -n --no-wait" case "$prev" in --help|--version) COMPREPLY=() return 0 ;; esac COMPREPLY=( $(compgen -W "$opts $(_upstart_stoppable_events)" -- ${cur}) ) return 0 } && complete -F _upstart_stop stop have restart && _upstart_restart() { COMPREPLY=() _get_comp_words_by_ref cur prev opts="--help --version -q --quiet -v --verbose --system --dest= \ -n --no-wait" case "$prev" in --help|--version) COMPREPLY=() return 0 ;; esac COMPREPLY=( $(compgen -W "$opts $(_upstart_events)" -- ${cur}) ) return 0 } && complete -F _upstart_restart restart have status && _upstart_status() { COMPREPLY=() _get_comp_words_by_ref cur prev opts="--help --version -q --quiet -v --verbose --system --dest=" case "$prev" in --help|--version) COMPREPLY=() return 0 ;; esac COMPREPLY=( $(compgen -W "$opts $(_upstart_events)" -- ${cur}) ) return 0 } && complete -F _upstart_status status have reload && _upstart_reload() { COMPREPLY=() _get_comp_words_by_ref cur prev opts="--help --version -q --quiet -v --verbose --system --dest=" case "$prev" in --help|--version) COMPREPLY=() return 0 ;; esac COMPREPLY=( $(compgen -W "$opts $(_upstart_events)" -- ${cur}) ) return 0 } && complete -F _upstart_reload reload
signature.asc
Description: Digital signature
_______________________________________________ Bash-completion-devel mailing list Bash-completion-devel@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel