aboutsummaryrefslogtreecommitdiffstats
path: root/src/_phing
blob: 83ce274bdfa657a519694de6ba8ea28cb67a17d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#compdef phing
# ------------------------------------------------------------------------------
# Copyright (c) Igor M. Timoshenko <igor.timoshenko@i.ua>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is furnished
# to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
#  Completion script for Phing 3.1.0 (https://www.phing.info/).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
#  * Igor Timoshenko <igor.timoshenko@i.ua>
#
# ------------------------------------------------------------------------------

_phing() {
  local context curcontext="$curcontext" state line ret=1
  integer NORMARG
  typeset -A opt_args

  # Follow https://www.phing.info/guide/chunkhtml/sec.commandlineargs.html for more information
  _arguments -C \
    '(-h -help)'{-h,-help}'[display the help screen]' \
    '(-v -version)'{-v,-version}'[print version information and exit]' \
    '(-l -list)'{-l,-list}'[list all available targets in buildfile]' \
    '(-i -init)'{-i,-init}'[generates an initial buildfile]:file:_files' \
    '(-q -quiet)'{-q,-quiet}'[quiet operation, no output at all]' \
    '(-S -silent)'{-S,-silent}'[print nothing but task outputs and build failures]' \
    '-verbose[verbose, give some more output]' \
    '-debug[output debug information]' \
    '(-e -emacs)'{-e,-emacs}'[produce logging information without adornments]' \
    '-diagnostics[print diagnostics information]' \
    '(-strict -no-strict)-strict[run build in strict mode]' \
    '(-strict -no-strict)-no-strict[run build normally]' \
    '-longtargets[show target descriptions during build]' \
    '-logfile[use given file for log]:file:_files' \
    '-logger[the class which is to perform logging]:class' \
    '*-listener[add an instance of class as a project listener]:class' \
    '(-f -buildfile)'{-f,-buildfile}'[build file]:file:_files' \
    '*-D[set the property to the specified value to be used in the buildfile]' \
    '(-k -keep-going)'{-k,-keep-going}'[execute all targets that do not depend on failed target(s)]' \
    '-propertyfile[load all properties from the specified file]:file:_files' \
    '-propertyfileoverride[values in property file override existing values]' \
    '-find[search for buildfile towards the root of the filesystem and use it]:file:_files' \
    '-inputhandler[the class to use to handle user input]:class' \
    '(- *)'{-v,-version}'[show version]' \
    '1: :->targets' \
    '*:: :->args' \
  && ret=0

  case $state in
    (targets)
      local buildfile=build.xml
      if (( $+opt_args[-buildfile] )); then
        buildfile=${opt_args[-buildfile]}
      elif (($+opt_args[-f] )); then
        buildfile=${opt_args[-f]}
      fi

      if [[ ! -f $buildfile ]]
      then
        ret=0
      else
        local -a targets=($(sed -nE "/<target /s/.*name=[\"'](\w+)[\"'].*/\1/p" $buildfile))
        _describe -t 'targets' 'target' targets && ret=0
      fi
    ;;
    (args)
      if [[ CURRENT -eq NORMARG && ${+opt_args[--match]} -eq 0 ]]
      then
        # If the current argument is the first non-option argument
        # and --match isn't present then a pattern is expected
        _message -e patterns 'pattern' && ret=0
      else
        _files
      fi
    ;;
  esac

  return ret
}

_phing "$@"

# Local Variables:
# mode: Shell-Script
# sh-indentation: 2
# indent-tabs-mode: nil
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et