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