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