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