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