38dc26
_m2_make_goals()
38dc26
{
38dc26
  plugin=$1
38dc26
  mojos=$2
38dc26
  for mojo in $mojos
38dc26
  do
38dc26
    export goals="$goals $plugin:$mojo"
38dc26
  done
38dc26
}
38dc26
38dc26
_m2_complete()
38dc26
{
38dc26
  local cur goals
38dc26
38dc26
  COMPREPLY=()
38dc26
  cur="${COMP_WORDS[COMP_CWORD]}"
38dc26
  prev="${COMP_WORDS[COMP_CWORD-1]}"
38dc26
38dc26
  case "${prev}" in
38dc26
       -f | --file|-l|--log-file)
38dc26
              COMPREPLY=( $(compgen -f ${cur}) )
38dc26
              return 0
38dc26
       ;;
38dc26
       *);;
38dc26
  esac
38dc26
38dc26
38dc26
  goals='clean compile test install package deploy site verify'
38dc26
  if [[ ${cur} == -* ]] ; then
38dc26
     goals="$goals -am --also-make
38dc26
                   -amd --also-make-dependents
38dc26
                   -B --batch-mode
38dc26
                   -C --strict-checksums
38dc26
                   -c --lax-checksums
38dc26
                   -cpu --check-plugin-updates
38dc26
                   -D --define
38dc26
                   -e --errors
38dc26
                   -emp --encrypt-master-password
38dc26
                   -ep --encrypt-password
38dc26
                   -f --file
38dc26
                   -fae --fail-at-end
38dc26
                   -ff --fail-fast
38dc26
                   -fn --fail-never
38dc26
                   -gs --global-settings
38dc26
                   -h --help
38dc26
                   -l --log-file
38dc26
                   -N --non-recursive
38dc26
                   -npr --no-plugin-registry
38dc26
                   -npu --no-plugin-updates
38dc26
                   -nsu --no-snapshot-updates
38dc26
                   -o --offline
38dc26
                   -P --activate-profiles
38dc26
                   -pl --projects
38dc26
                   -q --quiet
38dc26
                   -rf --resume-from
38dc26
                   -s --settings
38dc26
                   -T --threads
38dc26
                   -t --toolchains
38dc26
                   -U --update-snapshots
38dc26
                   -up --update-plugins
38dc26
                   -V --show-version
38dc26
                   -v --version
38dc26
                   -X --debug
38dc26
                   -Dmaven.test.skip=true
38dc26
                   -Dmaven.compiler.source=1.5
38dc26
                   -Dmaven.compiler.source=1.6
38dc26
                   -Dmaven.compiler.source=1.7
38dc26
                   -Dmaven.compiler.target=1.5
38dc26
                   -Dmaven.compiler.target=1.6
38dc26
                   -Dmaven.compiler.target=1.7
38dc26
                   -Dproject.build.sourceEncoding=UTF-8
38dc26
                   -Dmaven.repo.local=
38dc26
                   -Dmaven.local.depmap.file=
38dc26
                   -Dmaven.local.debug=true
38dc26
                   -Dmaven.local.mode=true"
38dc26
  fi
38dc26
38dc26
  goals=$goals _m2_make_goals "eclipse" "eclipse"
38dc26
  goals=$goals _m2_make_goals "idea" "idea"
38dc26
  goals=$goals _m2_make_goals "assembly" "assembly"
38dc26
  goals=$goals _m2_make_goals "plexus" "app bundle-application bundle-runtime descriptor runtime service"
38dc26
  goals=$goals _m2_make_goals "dependency" "analyze analyze-dep-mgt analyze-only analyze-report analyze-duplicate
38dc26
                                           build-classpath copy copy-dependencies get go-offline list properties
38dc26
                                           purge-local-repository resolve resolve-plugins sources tree unpack
38dc26
                                           unpack-dependencies"
38dc26
  cur=`echo $cur | sed 's/\\\\//g'`
38dc26
  COMPREPLY=($(compgen -W "${goals}" -- ${cur} | sed 's/\\\\//g') )
38dc26
}
38dc26
38dc26
complete -F _m2_complete -o filenames mvn