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