github.com/nak3/source-to-image@v1.1.10-0.20180319140719-2ed55639898d/contrib/completions/zsh/s2i (about)

     1  # Copyright 2016 The Kubernetes Authors.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  __kubectl_bash_source() {
    16  	alias shopt=':'
    17  	alias _expand=_bash_expand
    18  	alias _complete=_bash_comp
    19  	emulate -L sh
    20  	setopt kshglob noshglob braceexpand
    21  
    22  	source "$@"
    23  }
    24  
    25  __kubectl_type() {
    26  	# -t is not supported by zsh
    27  	if [ "$1" == "-t" ]; then
    28  		shift
    29  
    30  		# fake Bash 4 to disable "complete -o nospace". Instead
    31  		# "compopt +-o nospace" is used in the code to toggle trailing
    32  		# spaces. We don't support that, but leave trailing spaces on
    33  		# all the time
    34  		if [ "$1" = "__kubectl_compopt" ]; then
    35  			echo builtin
    36  			return 0
    37  		fi
    38  	fi
    39  	type "$@"
    40  }
    41  
    42  __kubectl_compgen() {
    43  	local completions w
    44  	completions=( $(compgen "$@") ) || return $?
    45  
    46  	# filter by given word as prefix
    47  	while [[ "$1" = -* && "$1" != -- ]]; do
    48  		shift
    49  		shift
    50  	done
    51  	if [[ "$1" == -- ]]; then
    52  		shift
    53  	fi
    54  	for w in "${completions[@]}"; do
    55  		if [[ "${w}" = "$1"* ]]; then
    56  			echo "${w}"
    57  		fi
    58  	done
    59  }
    60  
    61  __kubectl_compopt() {
    62  	true # don't do anything. Not supported by bashcompinit in zsh
    63  }
    64  
    65  __kubectl_declare() {
    66  	if [ "$1" == "-F" ]; then
    67  		whence -w "$@"
    68  	else
    69  		builtin declare "$@"
    70  	fi
    71  }
    72  
    73  __kubectl_ltrim_colon_completions()
    74  {
    75  	if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then
    76  		# Remove colon-word prefix from COMPREPLY items
    77  		local colon_word=${1%${1##*:}}
    78  		local i=${#COMPREPLY[*]}
    79  		while [[ $((--i)) -ge 0 ]]; do
    80  			COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}
    81  		done
    82  	fi
    83  }
    84  
    85  __kubectl_get_comp_words_by_ref() {
    86  	cur="${COMP_WORDS[COMP_CWORD]}"
    87  	prev="${COMP_WORDS[${COMP_CWORD}-1]}"
    88  	words=("${COMP_WORDS[@]}")
    89  	cword=("${COMP_CWORD[@]}")
    90  }
    91  
    92  __kubectl_filedir() {
    93  	local RET OLD_IFS w qw
    94  
    95  	__debug "_filedir $@ cur=$cur"
    96  	if [[ "$1" = \~* ]]; then
    97  		# somehow does not work. Maybe, zsh does not call this at all
    98  		eval echo "$1"
    99  		return 0
   100  	fi
   101  
   102  	OLD_IFS="$IFS"
   103  	IFS=$'\n'
   104  	if [ "$1" = "-d" ]; then
   105  		shift
   106  		RET=( $(compgen -d) )
   107  	else
   108  		RET=( $(compgen -f) )
   109  	fi
   110  	IFS="$OLD_IFS"
   111  
   112  	IFS="," __debug "RET=${RET[@]} len=${#RET[@]}"
   113  
   114  	for w in ${RET[@]}; do
   115  		if [[ ! "${w}" = "${cur}"* ]]; then
   116  			continue
   117  		fi
   118  		if eval "[[ \"\${w}\" = *.$1 || -d \"\${w}\" ]]"; then
   119  			qw="$(__kubectl_quote "${w}")"
   120  			if [ -d "${w}" ]; then
   121  				COMPREPLY+=("${qw}/")
   122  			else
   123  				COMPREPLY+=("${qw}")
   124  			fi
   125  		fi
   126  	done
   127  }
   128  
   129  __kubectl_quote() {
   130      if [[ $1 == \'* || $1 == \"* ]]; then
   131          # Leave out first character
   132          printf %q "${1:1}"
   133      else
   134      	printf %q "$1"
   135      fi
   136  }
   137  
   138  autoload -U +X bashcompinit && bashcompinit
   139  
   140  # use word boundary patterns for BSD or GNU sed
   141  LWORD='[[:<:]]'
   142  RWORD='[[:>:]]'
   143  if sed --help 2>&1 | grep -q GNU; then
   144  	LWORD='\<'
   145  	RWORD='\>'
   146  fi
   147  
   148  __kubectl_convert_bash_to_zsh() {
   149  	sed \
   150  	-e 's/declare -F/whence -w/' \
   151  	-e 's/local \([a-zA-Z0-9_]*\)=/local \1; \1=/' \
   152  	-e 's/flags+=("\(--.*\)=")/flags+=("\1"); two_word_flags+=("\1")/' \
   153  	-e 's/must_have_one_flag+=("\(--.*\)=")/must_have_one_flag+=("\1")/' \
   154  	-e "s/${LWORD}_filedir${RWORD}/__kubectl_filedir/g" \
   155  	-e "s/${LWORD}_get_comp_words_by_ref${RWORD}/__kubectl_get_comp_words_by_ref/g" \
   156  	-e "s/${LWORD}__ltrim_colon_completions${RWORD}/__kubectl_ltrim_colon_completions/g" \
   157  	-e "s/${LWORD}compgen${RWORD}/__kubectl_compgen/g" \
   158  	-e "s/${LWORD}compopt${RWORD}/__kubectl_compopt/g" \
   159  	-e "s/${LWORD}declare${RWORD}/__kubectl_declare/g" \
   160  	-e "s/\\\$(type${RWORD}/\$(__kubectl_type/g" \
   161  	<<'BASH_COMPLETION_EOF'
   162  # bash completion for s2i                                  -*- shell-script -*-
   163  
   164  __debug()
   165  {
   166      if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
   167          echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
   168      fi
   169  }
   170  
   171  # Homebrew on Macs have version 1.3 of bash-completion which doesn't include
   172  # _init_completion. This is a very minimal version of that function.
   173  __my_init_completion()
   174  {
   175      COMPREPLY=()
   176      _get_comp_words_by_ref "$@" cur prev words cword
   177  }
   178  
   179  __index_of_word()
   180  {
   181      local w word=$1
   182      shift
   183      index=0
   184      for w in "$@"; do
   185          [[ $w = "$word" ]] && return
   186          index=$((index+1))
   187      done
   188      index=-1
   189  }
   190  
   191  __contains_word()
   192  {
   193      local w word=$1; shift
   194      for w in "$@"; do
   195          [[ $w = "$word" ]] && return
   196      done
   197      return 1
   198  }
   199  
   200  __handle_reply()
   201  {
   202      __debug "${FUNCNAME[0]}"
   203      case $cur in
   204          -*)
   205              if [[ $(type -t compopt) = "builtin" ]]; then
   206                  compopt -o nospace
   207              fi
   208              local allflags
   209              if [ ${#must_have_one_flag[@]} -ne 0 ]; then
   210                  allflags=("${must_have_one_flag[@]}")
   211              else
   212                  allflags=("${flags[*]} ${two_word_flags[*]}")
   213              fi
   214              COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
   215              if [[ $(type -t compopt) = "builtin" ]]; then
   216                  [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
   217              fi
   218  
   219              # complete after --flag=abc
   220              if [[ $cur == *=* ]]; then
   221                  if [[ $(type -t compopt) = "builtin" ]]; then
   222                      compopt +o nospace
   223                  fi
   224  
   225                  local index flag
   226                  flag="${cur%%=*}"
   227                  __index_of_word "${flag}" "${flags_with_completion[@]}"
   228                  if [[ ${index} -ge 0 ]]; then
   229                      COMPREPLY=()
   230                      PREFIX=""
   231                      cur="${cur#*=}"
   232                      ${flags_completion[${index}]}
   233                      if [ -n "${ZSH_VERSION}" ]; then
   234                          # zfs completion needs --flag= prefix
   235                          eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )"
   236                      fi
   237                  fi
   238              fi
   239              return 0;
   240              ;;
   241      esac
   242  
   243      # check if we are handling a flag with special work handling
   244      local index
   245      __index_of_word "${prev}" "${flags_with_completion[@]}"
   246      if [[ ${index} -ge 0 ]]; then
   247          ${flags_completion[${index}]}
   248          return
   249      fi
   250  
   251      # we are parsing a flag and don't have a special handler, no completion
   252      if [[ ${cur} != "${words[cword]}" ]]; then
   253          return
   254      fi
   255  
   256      local completions
   257      completions=("${commands[@]}")
   258      if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
   259          completions=("${must_have_one_noun[@]}")
   260      fi
   261      if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
   262          completions+=("${must_have_one_flag[@]}")
   263      fi
   264      COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
   265  
   266      if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
   267          COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") )
   268      fi
   269  
   270      if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
   271          declare -F __custom_func >/dev/null && __custom_func
   272      fi
   273  
   274      __ltrim_colon_completions "$cur"
   275  }
   276  
   277  # The arguments should be in the form "ext1|ext2|extn"
   278  __handle_filename_extension_flag()
   279  {
   280      local ext="$1"
   281      _filedir "@(${ext})"
   282  }
   283  
   284  __handle_subdirs_in_dir_flag()
   285  {
   286      local dir="$1"
   287      pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1
   288  }
   289  
   290  __handle_flag()
   291  {
   292      __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
   293  
   294      # if a command required a flag, and we found it, unset must_have_one_flag()
   295      local flagname=${words[c]}
   296      local flagvalue
   297      # if the word contained an =
   298      if [[ ${words[c]} == *"="* ]]; then
   299          flagvalue=${flagname#*=} # take in as flagvalue after the =
   300          flagname=${flagname%%=*} # strip everything after the =
   301          flagname="${flagname}=" # but put the = back
   302      fi
   303      __debug "${FUNCNAME[0]}: looking for ${flagname}"
   304      if __contains_word "${flagname}" "${must_have_one_flag[@]}"; then
   305          must_have_one_flag=()
   306      fi
   307  
   308      # if you set a flag which only applies to this command, don't show subcommands
   309      if __contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then
   310        commands=()
   311      fi
   312  
   313      # keep flag value with flagname as flaghash
   314      if [ -n "${flagvalue}" ] ; then
   315          flaghash[${flagname}]=${flagvalue}
   316      elif [ -n "${words[ $((c+1)) ]}" ] ; then
   317          flaghash[${flagname}]=${words[ $((c+1)) ]}
   318      else
   319          flaghash[${flagname}]="true" # pad "true" for bool flag
   320      fi
   321  
   322      # skip the argument to a two word flag
   323      if __contains_word "${words[c]}" "${two_word_flags[@]}"; then
   324          c=$((c+1))
   325          # if we are looking for a flags value, don't show commands
   326          if [[ $c -eq $cword ]]; then
   327              commands=()
   328          fi
   329      fi
   330  
   331      c=$((c+1))
   332  
   333  }
   334  
   335  __handle_noun()
   336  {
   337      __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
   338  
   339      if __contains_word "${words[c]}" "${must_have_one_noun[@]}"; then
   340          must_have_one_noun=()
   341      elif __contains_word "${words[c]}" "${noun_aliases[@]}"; then
   342          must_have_one_noun=()
   343      fi
   344  
   345      nouns+=("${words[c]}")
   346      c=$((c+1))
   347  }
   348  
   349  __handle_command()
   350  {
   351      __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
   352  
   353      local next_command
   354      if [[ -n ${last_command} ]]; then
   355          next_command="_${last_command}_${words[c]//:/__}"
   356      else
   357          if [[ $c -eq 0 ]]; then
   358              next_command="_$(basename "${words[c]//:/__}")"
   359          else
   360              next_command="_${words[c]//:/__}"
   361          fi
   362      fi
   363      c=$((c+1))
   364      __debug "${FUNCNAME[0]}: looking for ${next_command}"
   365      declare -F $next_command >/dev/null && $next_command
   366  }
   367  
   368  __handle_word()
   369  {
   370      if [[ $c -ge $cword ]]; then
   371          __handle_reply
   372          return
   373      fi
   374      __debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
   375      if [[ "${words[c]}" == -* ]]; then
   376          __handle_flag
   377      elif __contains_word "${words[c]}" "${commands[@]}"; then
   378          __handle_command
   379      elif [[ $c -eq 0 ]] && __contains_word "$(basename "${words[c]}")" "${commands[@]}"; then
   380          __handle_command
   381      else
   382          __handle_noun
   383      fi
   384      __handle_word
   385  }
   386  
   387  _s2i_build()
   388  {
   389      last_command="s2i_build"
   390      commands=()
   391  
   392      flags=()
   393      two_word_flags=()
   394      local_nonpersistent_flags=()
   395      flags_with_completion=()
   396      flags_completion=()
   397  
   398      flags+=("--allowed-uids=")
   399      two_word_flags+=("-u")
   400      local_nonpersistent_flags+=("--allowed-uids=")
   401      flags+=("--application-name=")
   402      two_word_flags+=("-n")
   403      local_nonpersistent_flags+=("--application-name=")
   404      flags+=("--assemble-user=")
   405      local_nonpersistent_flags+=("--assemble-user=")
   406      flags+=("--callback-url=")
   407      local_nonpersistent_flags+=("--callback-url=")
   408      flags+=("--cap-drop=")
   409      local_nonpersistent_flags+=("--cap-drop=")
   410      flags+=("--context-dir=")
   411      local_nonpersistent_flags+=("--context-dir=")
   412      flags+=("--copy")
   413      flags+=("-c")
   414      local_nonpersistent_flags+=("--copy")
   415      flags+=("--description=")
   416      local_nonpersistent_flags+=("--description=")
   417      flags+=("--destination=")
   418      two_word_flags+=("-d")
   419      local_nonpersistent_flags+=("--destination=")
   420      flags+=("--dockercfg-path=")
   421      local_nonpersistent_flags+=("--dockercfg-path=")
   422      flags+=("--env=")
   423      two_word_flags+=("-e")
   424      local_nonpersistent_flags+=("--env=")
   425      flags+=("--environment-file=")
   426      two_word_flags+=("-E")
   427      local_nonpersistent_flags+=("--environment-file=")
   428      flags+=("--exclude=")
   429      local_nonpersistent_flags+=("--exclude=")
   430      flags+=("--ignore-submodules")
   431      local_nonpersistent_flags+=("--ignore-submodules")
   432      flags+=("--incremental")
   433      local_nonpersistent_flags+=("--incremental")
   434      flags+=("--incremental-pull-policy=")
   435      local_nonpersistent_flags+=("--incremental-pull-policy=")
   436      flags+=("--inject=")
   437      two_word_flags+=("-i")
   438      local_nonpersistent_flags+=("--inject=")
   439      flags+=("--location=")
   440      two_word_flags+=("-l")
   441      local_nonpersistent_flags+=("--location=")
   442      flags+=("--network=")
   443      local_nonpersistent_flags+=("--network=")
   444      flags+=("--pull-policy=")
   445      two_word_flags+=("-p")
   446      local_nonpersistent_flags+=("--pull-policy=")
   447      flags+=("--quiet")
   448      flags+=("-q")
   449      local_nonpersistent_flags+=("--quiet")
   450      flags+=("--ref=")
   451      two_word_flags+=("-r")
   452      local_nonpersistent_flags+=("--ref=")
   453      flags+=("--rm")
   454      local_nonpersistent_flags+=("--rm")
   455      flags+=("--run")
   456      local_nonpersistent_flags+=("--run")
   457      flags+=("--runtime-artifact=")
   458      two_word_flags+=("-a")
   459      local_nonpersistent_flags+=("--runtime-artifact=")
   460      flags+=("--runtime-image=")
   461      local_nonpersistent_flags+=("--runtime-image=")
   462      flags+=("--runtime-pull-policy=")
   463      local_nonpersistent_flags+=("--runtime-pull-policy=")
   464      flags+=("--save-temp-dir")
   465      local_nonpersistent_flags+=("--save-temp-dir")
   466      flags+=("--scripts=")
   467      local_nonpersistent_flags+=("--scripts=")
   468      flags+=("--scripts-url=")
   469      two_word_flags+=("-s")
   470      local_nonpersistent_flags+=("--scripts-url=")
   471      flags+=("--use-config")
   472      local_nonpersistent_flags+=("--use-config")
   473      flags+=("--volume=")
   474      two_word_flags+=("-v")
   475      local_nonpersistent_flags+=("--volume=")
   476      flags+=("--ca=")
   477      flags+=("--cert=")
   478      flags+=("--key=")
   479      flags+=("--loglevel=")
   480      flags+=("--tls")
   481      flags+=("--tlsverify")
   482      flags+=("--url=")
   483      two_word_flags+=("-U")
   484  
   485      must_have_one_flag=()
   486      must_have_one_noun=()
   487      noun_aliases=()
   488  }
   489  
   490  _s2i_completion()
   491  {
   492      last_command="s2i_completion"
   493      commands=()
   494  
   495      flags=()
   496      two_word_flags=()
   497      local_nonpersistent_flags=()
   498      flags_with_completion=()
   499      flags_completion=()
   500  
   501      flags+=("--ca=")
   502      flags+=("--cert=")
   503      flags+=("--key=")
   504      flags+=("--loglevel=")
   505      flags+=("--tls")
   506      flags+=("--tlsverify")
   507      flags+=("--url=")
   508      two_word_flags+=("-U")
   509  
   510      must_have_one_flag=()
   511      must_have_one_noun=()
   512      must_have_one_noun+=("bash")
   513      must_have_one_noun+=("zsh")
   514      noun_aliases=()
   515  }
   516  
   517  _s2i_create()
   518  {
   519      last_command="s2i_create"
   520      commands=()
   521  
   522      flags=()
   523      two_word_flags=()
   524      local_nonpersistent_flags=()
   525      flags_with_completion=()
   526      flags_completion=()
   527  
   528      flags+=("--ca=")
   529      flags+=("--cert=")
   530      flags+=("--key=")
   531      flags+=("--loglevel=")
   532      flags+=("--tls")
   533      flags+=("--tlsverify")
   534      flags+=("--url=")
   535      two_word_flags+=("-U")
   536  
   537      must_have_one_flag=()
   538      must_have_one_noun=()
   539      noun_aliases=()
   540  }
   541  
   542  _s2i_rebuild()
   543  {
   544      last_command="s2i_rebuild"
   545      commands=()
   546  
   547      flags=()
   548      two_word_flags=()
   549      local_nonpersistent_flags=()
   550      flags_with_completion=()
   551      flags_completion=()
   552  
   553      flags+=("--callback-url=")
   554      local_nonpersistent_flags+=("--callback-url=")
   555      flags+=("--destination=")
   556      two_word_flags+=("-d")
   557      local_nonpersistent_flags+=("--destination=")
   558      flags+=("--dockercfg-path=")
   559      local_nonpersistent_flags+=("--dockercfg-path=")
   560      flags+=("--incremental")
   561      local_nonpersistent_flags+=("--incremental")
   562      flags+=("--incremental-pull-policy=")
   563      local_nonpersistent_flags+=("--incremental-pull-policy=")
   564      flags+=("--pull-policy=")
   565      two_word_flags+=("-p")
   566      local_nonpersistent_flags+=("--pull-policy=")
   567      flags+=("--quiet")
   568      flags+=("-q")
   569      local_nonpersistent_flags+=("--quiet")
   570      flags+=("--rm")
   571      local_nonpersistent_flags+=("--rm")
   572      flags+=("--runtime-pull-policy=")
   573      local_nonpersistent_flags+=("--runtime-pull-policy=")
   574      flags+=("--save-temp-dir")
   575      local_nonpersistent_flags+=("--save-temp-dir")
   576      flags+=("--ca=")
   577      flags+=("--cert=")
   578      flags+=("--key=")
   579      flags+=("--loglevel=")
   580      flags+=("--tls")
   581      flags+=("--tlsverify")
   582      flags+=("--url=")
   583      two_word_flags+=("-U")
   584  
   585      must_have_one_flag=()
   586      must_have_one_noun=()
   587      noun_aliases=()
   588  }
   589  
   590  _s2i_usage()
   591  {
   592      last_command="s2i_usage"
   593      commands=()
   594  
   595      flags=()
   596      two_word_flags=()
   597      local_nonpersistent_flags=()
   598      flags_with_completion=()
   599      flags_completion=()
   600  
   601      flags+=("--callback-url=")
   602      local_nonpersistent_flags+=("--callback-url=")
   603      flags+=("--destination=")
   604      two_word_flags+=("-d")
   605      local_nonpersistent_flags+=("--destination=")
   606      flags+=("--dockercfg-path=")
   607      local_nonpersistent_flags+=("--dockercfg-path=")
   608      flags+=("--incremental")
   609      local_nonpersistent_flags+=("--incremental")
   610      flags+=("--incremental-pull-policy=")
   611      local_nonpersistent_flags+=("--incremental-pull-policy=")
   612      flags+=("--location=")
   613      two_word_flags+=("-l")
   614      local_nonpersistent_flags+=("--location=")
   615      flags+=("--pull-policy=")
   616      two_word_flags+=("-p")
   617      local_nonpersistent_flags+=("--pull-policy=")
   618      flags+=("--quiet")
   619      flags+=("-q")
   620      local_nonpersistent_flags+=("--quiet")
   621      flags+=("--rm")
   622      local_nonpersistent_flags+=("--rm")
   623      flags+=("--runtime-pull-policy=")
   624      local_nonpersistent_flags+=("--runtime-pull-policy=")
   625      flags+=("--save-temp-dir")
   626      local_nonpersistent_flags+=("--save-temp-dir")
   627      flags+=("--ca=")
   628      flags+=("--cert=")
   629      flags+=("--key=")
   630      flags+=("--loglevel=")
   631      flags+=("--tls")
   632      flags+=("--tlsverify")
   633      flags+=("--url=")
   634      two_word_flags+=("-U")
   635  
   636      must_have_one_flag=()
   637      must_have_one_noun=()
   638      noun_aliases=()
   639  }
   640  
   641  _s2i_version()
   642  {
   643      last_command="s2i_version"
   644      commands=()
   645  
   646      flags=()
   647      two_word_flags=()
   648      local_nonpersistent_flags=()
   649      flags_with_completion=()
   650      flags_completion=()
   651  
   652      flags+=("--ca=")
   653      flags+=("--cert=")
   654      flags+=("--key=")
   655      flags+=("--loglevel=")
   656      flags+=("--tls")
   657      flags+=("--tlsverify")
   658      flags+=("--url=")
   659      two_word_flags+=("-U")
   660  
   661      must_have_one_flag=()
   662      must_have_one_noun=()
   663      noun_aliases=()
   664  }
   665  
   666  _s2i()
   667  {
   668      last_command="s2i"
   669      commands=()
   670      commands+=("build")
   671      commands+=("completion")
   672      commands+=("create")
   673      commands+=("rebuild")
   674      commands+=("usage")
   675      commands+=("version")
   676  
   677      flags=()
   678      two_word_flags=()
   679      local_nonpersistent_flags=()
   680      flags_with_completion=()
   681      flags_completion=()
   682  
   683      flags+=("--ca=")
   684      flags+=("--cert=")
   685      flags+=("--key=")
   686      flags+=("--loglevel=")
   687      flags+=("--tls")
   688      flags+=("--tlsverify")
   689      flags+=("--url=")
   690      two_word_flags+=("-U")
   691  
   692      must_have_one_flag=()
   693      must_have_one_noun=()
   694      noun_aliases=()
   695  }
   696  
   697  __start_s2i()
   698  {
   699      local cur prev words cword
   700      declare -A flaghash 2>/dev/null || :
   701      if declare -F _init_completion >/dev/null 2>&1; then
   702          _init_completion -s || return
   703      else
   704          __my_init_completion -n "=" || return
   705      fi
   706  
   707      local c=0
   708      local flags=()
   709      local two_word_flags=()
   710      local local_nonpersistent_flags=()
   711      local flags_with_completion=()
   712      local flags_completion=()
   713      local commands=("s2i")
   714      local must_have_one_flag=()
   715      local must_have_one_noun=()
   716      local last_command
   717      local nouns=()
   718  
   719      __handle_word
   720  }
   721  
   722  if [[ $(type -t compopt) = "builtin" ]]; then
   723      complete -o default -F __start_s2i s2i
   724  else
   725      complete -o default -o nospace -F __start_s2i s2i
   726  fi
   727  
   728  # ex: ts=4 sw=4 et filetype=sh
   729  
   730  BASH_COMPLETION_EOF
   731  }
   732  
   733  __kubectl_bash_source <(__kubectl_convert_bash_to_zsh)