_puppetctl_completion()
{
    local cur="${COMP_WORDS[COMP_CWORD]}"
    if [ "$COMP_CWORD" -eq 1 ]; then
        COMPREPLY=( $(compgen -W 'status run noop-run enable disable stop start' -- "$cur") )
    elif [ "${COMP_WORDS[1]}" = stop ]; then
        COMPREPLY=( $(compgen -W '--timeout' -- "$cur") )
    fi
}
complete -F _puppetctl_completion puppetctl
