# Bash completion for the seam-gen from the JBoss Seam project
# Load this file in bash by running
#   source seam-completion
# You can then get tab completion for the Seam commands by running
#   ./seam <TAB>
_seam()
{
    local cur

    COMPREPLY=()
    cur=${COMP_WORDS[COMP_CWORD]}
    local invalid=$( ./seam validate-project 2>&1 | grep -c FAILED ) 
    if [ $invalid != 0 ]; then
        COMPREPLY=( $( compgen -W 'help setup' -- $cur ) )
    else
        COMPREPLY=( $( compgen -W 'help setup create-project update-project delete-project deploy undeploy explode restart unexplode archive clean test new-action new-form new-conversation new-entity new-query generate generate-model generate-ui settings reset' -- $cur ) )
    fi
}
complete -F _seam seam
