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