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