Browse code

Add bash-completion support

Kenjiro Nakayama authored on 2015/05/06 23:32:23
Showing 12 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,58 @@
0
+package main
1
+
2
+import (
3
+	"fmt"
4
+	"io/ioutil"
5
+	"os"
6
+	"path/filepath"
7
+
8
+	"github.com/openshift/origin/pkg/cmd/admin"
9
+	"github.com/openshift/origin/pkg/cmd/cli"
10
+	"github.com/openshift/origin/pkg/cmd/openshift"
11
+)
12
+
13
+func OutDir(path string) (string, error) {
14
+	outDir, err := filepath.Abs(path)
15
+	if err != nil {
16
+		return "", err
17
+	}
18
+
19
+	stat, err := os.Stat(outDir)
20
+	if err != nil {
21
+		return "", err
22
+	}
23
+
24
+	if !stat.IsDir() {
25
+		return "", fmt.Errorf("output directory %s is not a directory\n", outDir)
26
+	}
27
+	outDir = outDir + "/"
28
+	return outDir, nil
29
+}
30
+
31
+func main() {
32
+	// use os.Args instead of "flags" because "flags" will mess up the man pages!
33
+	path := "rel-eng/completions/bash/"
34
+	if len(os.Args) == 2 {
35
+		path = os.Args[1]
36
+	} else if len(os.Args) > 2 {
37
+		fmt.Fprintf(os.Stderr, "usage: %s [output directory]\n", os.Args[0])
38
+		os.Exit(1)
39
+	}
40
+
41
+	outDir, err := OutDir(path)
42
+	if err != nil {
43
+		fmt.Fprintf(os.Stderr, "failed to get output directory: %v\n", err)
44
+		os.Exit(1)
45
+	}
46
+	outFile_openshift := outDir + "openshift"
47
+	openshift := openshift.NewCommandOpenShift()
48
+	openshift.GenBashCompletionFile(outFile_openshift)
49
+
50
+	outFile_osc := outDir + "osc"
51
+	osc := cli.NewCommandCLI("osc", "openshift cli")
52
+	osc.GenBashCompletionFile(outFile_osc)
53
+
54
+	outFile_osadm := outDir + "osadm"
55
+	osadm := admin.NewCommandAdmin("osadm", "openshift admin", ioutil.Discard)
56
+	osadm.GenBashCompletionFile(outFile_osadm)
57
+}
... ...
@@ -454,3 +454,38 @@ os::build::ldflags() {
454 454
     echo "${ldflags[*]-}"
455 455
   )
456 456
 }
457
+
458
+os::build::gen-doc() {
459
+  local cmd="$1"
460
+  local dest="$2"
461
+  local skipprefix="${3:-}"
462
+
463
+  # We do this in a tmpdir in case the dest has other non-autogenned files
464
+  # We don't want to include them in the list of gen'd files
465
+  local tmpdir="${OS_ROOT}/doc_tmp"
466
+  mkdir "${tmpdir}"
467
+  # generate the new files
468
+  ${cmd} "${tmpdir}"
469
+  # create the list of generated files
470
+  ls "${tmpdir}" | LC_ALL=C sort > "${tmpdir}/.files_generated"
471
+
472
+  # remove all old generated file from the destination
473
+  while read file; do
474
+    if [[ -e "${tmpdir}/${file}" && -n "${skipprefix}" ]]; then
475
+      local original generated
476
+      original=$(grep -v "^${skipprefix}" "${dest}/${file}") || :
477
+      generated=$(grep -v "^${skipprefix}" "${tmpdir}/${file}") || :
478
+      if [[ "${original}" == "${generated}" ]]; then
479
+        # overwrite generated with original.
480
+        mv "${dest}/${file}" "${tmpdir}/${file}"
481
+      fi
482
+    else
483
+      rm "${dest}/${file}" || true
484
+    fi
485
+  done <"${dest}/.files_generated"
486
+
487
+  # put the new generated file into the destination
488
+  find "${tmpdir}" -exec rsync -pt {} "${dest}" \; >/dev/null
489
+  #cleanup
490
+  rm -rf "${tmpdir}"
491
+}
457 492
new file mode 100755
... ...
@@ -0,0 +1,27 @@
0
+#!/bin/bash
1
+
2
+# This script sets up a go workspace locally and builds all go components.
3
+
4
+set -o errexit
5
+set -o nounset
6
+set -o pipefail
7
+
8
+OS_ROOT=$(dirname "${BASH_SOURCE}")/..
9
+source "${OS_ROOT}/hack/common.sh"
10
+
11
+"${OS_ROOT}/hack/build-go.sh" cmd/genbashcomp
12
+
13
+# Find binary
14
+genbashcomp=$( (ls -t _output/local/go/bin/genbashcomp) 2>/dev/null || true | head -1 )
15
+
16
+if [[ ! "$genbashcomp" ]]; then
17
+  {
18
+    echo "It looks as if you don't have a compiled genbashcomp binary"
19
+    echo
20
+    echo "If you are running from a clone of the git repo, please run"
21
+    echo "'./hack/build-go.sh cmd/genbashcomp'."
22
+  } >&2
23
+  exit 1
24
+fi
25
+
26
+os::build::gen-doc "${genbashcomp}" "${OS_ROOT}/rel-eng/completions/bash/"
... ...
@@ -54,6 +54,7 @@ func NewCommandCLI(name, fullName string) *cobra.Command {
54 54
 			c.SetOutput(os.Stdout)
55 55
 			c.Help()
56 56
 		},
57
+		BashCompletionFunction: bashCompletionFunc,
57 58
 	}
58 59
 
59 60
 	f := clientcmd.New(cmds.PersistentFlags())
60 61
new file mode 100644
... ...
@@ -0,0 +1,68 @@
0
+package cli
1
+
2
+const (
3
+	bashCompletionFunc = `# call osc get $1,
4
+__osc_parse_get()
5
+{
6
+
7
+    local template
8
+    template="{{ range .items  }}{{ .metadata.name }} {{ end }}"
9
+    local osc_out
10
+    if osc_out=$(osc get -o template --template="${template}" "$1" 2>/dev/null); then
11
+        COMPREPLY=( $( compgen -W "${osc_out[*]}" -- "$cur" ) )
12
+    fi
13
+}
14
+
15
+__osc_get_resource()
16
+{
17
+    if [[ ${#nouns[@]} -eq 0 ]]; then
18
+        return 1
19
+    fi
20
+    __osc_parse_get ${nouns[${#nouns[@]} -1]}
21
+}
22
+
23
+# $1 is the name of the pod we want to get the list of containers inside
24
+__osc_get_containers()
25
+{
26
+    local template
27
+    template="{{ range .spec.containers  }}{{ .name }} {{ end }}"
28
+    __debug ${FUNCNAME} "nouns are ${nouns[@]}"
29
+
30
+    local len="${#nouns[@]}"
31
+    if [[ ${len} -ne 1 ]]; then
32
+        return
33
+    fi
34
+    local last=${nouns[${len} -1]}
35
+    local osc_out
36
+    if osc_out=$(osc get -o template --template="${template}" pods "${last}" 2>/dev/null); then
37
+        COMPREPLY=( $( compgen -W "${osc_out[*]}" -- "$cur" ) )
38
+    fi
39
+}
40
+
41
+# Require both a pod and a container to be specified
42
+__osc_require_pod_and_container()
43
+{
44
+    if [[ ${#nouns[@]} -eq 0 ]]; then
45
+        __osc_parse_get pods
46
+        return 0
47
+    fi;
48
+    __osc_get_containers
49
+    return 0
50
+}
51
+
52
+__custom_func() {
53
+    case ${last_command} in
54
+        osc_get | osc_describe | osc_delete)
55
+	    __osc_get_resource
56
+            return
57
+            ;;
58
+	osc_log)
59
+	    __osc_require_pod_and_container
60
+	    return
61
+	    ;;
62
+        *)
63
+            ;;
64
+    esac
65
+}
66
+`
67
+)
... ...
@@ -71,9 +71,10 @@ func NewCmdEdit(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Com
71 71
 			cmdutil.CheckErr(err)
72 72
 		},
73 73
 	}
74
+	usage := "Filename, directory, or URL to file to use to edit the resource"
75
+	kubectl.AddJsonFilenameFlag(cmd, &filenames, usage)
74 76
 	cmd.Flags().StringP("output", "o", "yaml", "Output format. One of: yaml|json.")
75 77
 	cmd.Flags().String("output-version", "", "Output the formatted object with the given version (default api-version).")
76
-	cmd.Flags().VarP(&filenames, "filename", "f", "Filename, directory, or URL to file to use to edit the resource.")
77 78
 	return cmd
78 79
 }
79 80
 
... ...
@@ -9,6 +9,7 @@ import (
9 9
 	kcmd "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd"
10 10
 	"github.com/spf13/cobra"
11 11
 
12
+	"github.com/openshift/origin/pkg/cmd/cli/describe"
12 13
 	"github.com/openshift/origin/pkg/cmd/util/clientcmd"
13 14
 )
14 15
 
... ...
@@ -32,9 +33,13 @@ Possible resources include builds, buildConfigs, services, pods, etc.`
32 32
 
33 33
 // NewCmdGet is a wrapper for the Kubernetes cli get command
34 34
 func NewCmdGet(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
35
+	p := describe.NewHumanReadablePrinter(false)
36
+	validArgs := p.HandledResources()
37
+
35 38
 	cmd := kcmd.NewCmdGet(f.Factory, out)
36 39
 	cmd.Long = get_long
37 40
 	cmd.Example = fmt.Sprintf(get_example, fullName)
41
+	cmd.ValidArgs = validArgs
38 42
 	return cmd
39 43
 }
40 44
 
... ...
@@ -195,6 +200,7 @@ func NewCmdDescribe(fullName string, f *clientcmd.Factory, out io.Writer) *cobra
195 195
 	cmd := kcmd.NewCmdDescribe(f.Factory, out)
196 196
 	cmd.Long = describe_long
197 197
 	cmd.Example = fmt.Sprintf(describe_example, fullName)
198
+	cmd.ValidArgs = describe.DescribableResources()
198 199
 	return cmd
199 200
 }
200 201
 
... ...
@@ -28,53 +28,51 @@ import (
28 28
 	templateapi "github.com/openshift/origin/pkg/template/api"
29 29
 )
30 30
 
31
+func describerMap(c *client.Client, kclient kclient.Interface, host string) map[string]kctl.Describer {
32
+	m := map[string]kctl.Describer{
33
+		"Build":                &BuildDescriber{c, kclient},
34
+		"BuildConfig":          &BuildConfigDescriber{c, host},
35
+		"BuildLog":             &BuildLogDescriber{c},
36
+		"DeploymentConfig":     NewDeploymentConfigDescriber(c, kclient),
37
+		"Identity":             &IdentityDescriber{c},
38
+		"Image":                &ImageDescriber{c},
39
+		"ImageStream":          &ImageStreamDescriber{c},
40
+		"ImageStreamTag":       &ImageStreamTagDescriber{c},
41
+		"ImageStreamImage":     &ImageStreamImageDescriber{c},
42
+		"Route":                &RouteDescriber{c},
43
+		"Project":              &ProjectDescriber{c},
44
+		"Template":             &TemplateDescriber{c, meta.NewAccessor(), kapi.Scheme, nil},
45
+		"Policy":               &PolicyDescriber{c},
46
+		"PolicyBinding":        &PolicyBindingDescriber{c},
47
+		"RoleBinding":          &RoleBindingDescriber{c},
48
+		"Role":                 &RoleDescriber{c},
49
+		"ClusterPolicy":        &ClusterPolicyDescriber{c},
50
+		"ClusterPolicyBinding": &ClusterPolicyBindingDescriber{c},
51
+		"ClusterRoleBinding":   &ClusterRoleBindingDescriber{c},
52
+		"ClusterRole":          &ClusterRoleDescriber{c},
53
+		"User":                 &UserDescriber{c},
54
+		"UserIdentityMapping":  &UserIdentityMappingDescriber{c},
55
+	}
56
+	return m
57
+}
58
+
59
+// List of all resource types we can describe
60
+func DescribableResources() []string {
61
+	// Include describable resources in kubernetes
62
+	keys := kctl.DescribableResources()
63
+
64
+	for k := range describerMap(nil, nil, "") {
65
+		resource := strings.ToLower(k)
66
+		keys = append(keys, resource)
67
+	}
68
+	return keys
69
+}
70
+
31 71
 // DescriberFor returns a describer for a given kind of resource
32 72
 func DescriberFor(kind string, c *client.Client, kclient kclient.Interface, host string) (kctl.Describer, bool) {
33
-	switch kind {
34
-	case "Build":
35
-		return &BuildDescriber{c, kclient}, true
36
-	case "BuildConfig":
37
-		return &BuildConfigDescriber{c, host}, true
38
-	case "BuildLog":
39
-		return &BuildLogDescriber{c}, true
40
-	case "DeploymentConfig":
41
-		return NewDeploymentConfigDescriber(c, kclient), true
42
-	case "Identity":
43
-		return &IdentityDescriber{c}, true
44
-	case "Image":
45
-		return &ImageDescriber{c}, true
46
-	case "ImageStream":
47
-		return &ImageStreamDescriber{c}, true
48
-	case "ImageStreamTag":
49
-		return &ImageStreamTagDescriber{c}, true
50
-	case "ImageStreamImage":
51
-		return &ImageStreamImageDescriber{c}, true
52
-	case "Route":
53
-		return &RouteDescriber{c}, true
54
-	case "Project":
55
-		return &ProjectDescriber{c}, true
56
-	case "Template":
57
-		return &TemplateDescriber{c, meta.NewAccessor(), kapi.Scheme, nil}, true
58
-	case "Policy":
59
-		return &PolicyDescriber{c}, true
60
-	case "PolicyBinding":
61
-		return &PolicyBindingDescriber{c}, true
62
-	case "RoleBinding":
63
-		return &RoleBindingDescriber{c}, true
64
-	case "Role":
65
-		return &RoleDescriber{c}, true
66
-	case "ClusterPolicy":
67
-		return &ClusterPolicyDescriber{c}, true
68
-	case "ClusterPolicyBinding":
69
-		return &ClusterPolicyBindingDescriber{c}, true
70
-	case "ClusterRoleBinding":
71
-		return &ClusterRoleBindingDescriber{c}, true
72
-	case "ClusterRole":
73
-		return &ClusterRoleDescriber{c}, true
74
-	case "User":
75
-		return &UserDescriber{c}, true
76
-	case "UserIdentityMapping":
77
-		return &UserIdentityMappingDescriber{c}, true
73
+	f, ok := describerMap(c, kclient, host)[kind]
74
+	if ok {
75
+		return f, true
78 76
 	}
79 77
 	return nil, false
80 78
 }
81 79
new file mode 100644
... ...
@@ -0,0 +1,3 @@
0
+openshift
1
+osadm
2
+osc
0 3
new file mode 100644
... ...
@@ -0,0 +1,3152 @@
0
+#!/bin/bash
1
+
2
+
3
+__debug()
4
+{
5
+    if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
6
+        echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
7
+    fi
8
+}
9
+
10
+__index_of_word()
11
+{
12
+    local w word=$1
13
+    shift
14
+    index=0
15
+    for w in "$@"; do
16
+        [[ $w = "$word" ]] && return
17
+        index=$((index+1))
18
+    done
19
+    index=-1
20
+}
21
+
22
+__contains_word()
23
+{
24
+    local w word=$1; shift
25
+    for w in "$@"; do
26
+        [[ $w = "$word" ]] && return
27
+    done
28
+    return 1
29
+}
30
+
31
+__handle_reply()
32
+{
33
+    __debug "${FUNCNAME}"
34
+    case $cur in
35
+        -*)
36
+            compopt -o nospace
37
+            local allflags
38
+            if [ ${#must_have_one_flag[@]} -ne 0 ]; then
39
+                allflags=("${must_have_one_flag[@]}")
40
+            else
41
+                allflags=("${flags[*]} ${two_word_flags[*]}")
42
+            fi
43
+            COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
44
+            [[ $COMPREPLY == *= ]] || compopt +o nospace
45
+            return 0;
46
+            ;;
47
+    esac
48
+
49
+    # check if we are handling a flag with special work handling
50
+    local index
51
+    __index_of_word "${prev}" "${flags_with_completion[@]}"
52
+    if [[ ${index} -ge 0 ]]; then
53
+        ${flags_completion[${index}]}
54
+        return
55
+    fi
56
+
57
+    # we are parsing a flag and don't have a special handler, no completion
58
+    if [[ ${cur} != "${words[cword]}" ]]; then
59
+        return
60
+    fi
61
+
62
+    local completions
63
+    if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
64
+        completions=("${must_have_one_flag[@]}")
65
+    elif [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
66
+        completions=("${must_have_one_noun[@]}")
67
+    else
68
+        completions=("${commands[@]}")
69
+    fi
70
+    COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
71
+
72
+    if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
73
+        declare -F __custom_func >/dev/null && __custom_func
74
+    fi
75
+}
76
+
77
+# The arguments should be in the form "ext1|ext2|extn"
78
+__handle_filename_extension_flag()
79
+{
80
+    local ext="$1"
81
+    _filedir "@(${ext})"
82
+}
83
+
84
+__handle_flag()
85
+{
86
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
87
+
88
+    # if a command required a flag, and we found it, unset must_have_one_flag()
89
+    local flagname=${words[c]}
90
+    # if the word contained an =
91
+    if [[ ${words[c]} == *"="* ]]; then
92
+        flagname=${flagname%=*} # strip everything after the =
93
+        flagname="${flagname}=" # but put the = back
94
+    fi
95
+    __debug "${FUNCNAME}: looking for ${flagname}"
96
+    if __contains_word "${flagname}" "${must_have_one_flag[@]}"; then
97
+        must_have_one_flag=()
98
+    fi
99
+
100
+    # skip the argument to a two word flag
101
+    if __contains_word "${words[c]}" "${two_word_flags[@]}"; then
102
+        c=$((c+1))
103
+        # if we are looking for a flags value, don't show commands
104
+        if [[ $c -eq $cword ]]; then
105
+            commands=()
106
+        fi
107
+    fi
108
+
109
+    # skip the flag itself
110
+    c=$((c+1))
111
+
112
+}
113
+
114
+__handle_noun()
115
+{
116
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
117
+
118
+    if __contains_word "${words[c]}" "${must_have_one_noun[@]}"; then
119
+        must_have_one_noun=()
120
+    fi
121
+
122
+    nouns+=("${words[c]}")
123
+    c=$((c+1))
124
+}
125
+
126
+__handle_command()
127
+{
128
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
129
+
130
+    local next_command
131
+    if [[ -n ${last_command} ]]; then
132
+        next_command="_${last_command}_${words[c]}"
133
+    else
134
+        next_command="_${words[c]}"
135
+    fi
136
+    c=$((c+1))
137
+    __debug "${FUNCNAME}: looking for ${next_command}"
138
+    declare -F $next_command >/dev/null && $next_command
139
+}
140
+
141
+__handle_word()
142
+{
143
+    if [[ $c -ge $cword ]]; then
144
+        __handle_reply
145
+	return
146
+    fi
147
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
148
+    if [[ "${words[c]}" == -* ]]; then
149
+	__handle_flag
150
+    elif __contains_word "${words[c]}" "${commands[@]}"; then
151
+        __handle_command
152
+    else
153
+        __handle_noun
154
+    fi
155
+    __handle_word
156
+}
157
+
158
+_openshift_start_master()
159
+{
160
+    last_command="openshift_start_master"
161
+    commands=()
162
+
163
+    flags=()
164
+    two_word_flags=()
165
+    flags_with_completion=()
166
+    flags_completion=()
167
+
168
+    flags+=("--config=")
169
+    flags+=("--cors-allowed-origins=")
170
+    flags+=("--create-certs")
171
+    flags+=("--etcd=")
172
+    flags+=("--etcd-dir=")
173
+    flags+=("--help")
174
+    flags+=("-h")
175
+    flags+=("--images=")
176
+    flags+=("--kubeconfig=")
177
+    flags+=("--kubernetes=")
178
+    flags+=("--latest-images")
179
+    flags+=("--listen=")
180
+    flags+=("--master=")
181
+    flags+=("--nodes=")
182
+    flags+=("--portal-net=")
183
+    flags+=("--public-master=")
184
+    flags+=("--write-config=")
185
+
186
+    must_have_one_flag=()
187
+    must_have_one_noun=()
188
+}
189
+
190
+_openshift_start_node()
191
+{
192
+    last_command="openshift_start_node"
193
+    commands=()
194
+
195
+    flags=()
196
+    two_word_flags=()
197
+    flags_with_completion=()
198
+    flags_completion=()
199
+
200
+    flags+=("--config=")
201
+    flags+=("--help")
202
+    flags+=("-h")
203
+    flags+=("--hostname=")
204
+    flags+=("--images=")
205
+    flags+=("--kubeconfig=")
206
+    flags+=("--kubernetes=")
207
+    flags+=("--latest-images")
208
+    flags+=("--listen=")
209
+    flags+=("--network-plugin=")
210
+    flags+=("--volume-dir=")
211
+
212
+    must_have_one_flag=()
213
+    must_have_one_noun=()
214
+}
215
+
216
+_openshift_start()
217
+{
218
+    last_command="openshift_start"
219
+    commands=()
220
+    commands+=("master")
221
+    commands+=("node")
222
+
223
+    flags=()
224
+    two_word_flags=()
225
+    flags_with_completion=()
226
+    flags_completion=()
227
+
228
+    flags+=("--cors-allowed-origins=")
229
+    flags+=("--create-certs")
230
+    flags+=("--etcd=")
231
+    flags+=("--etcd-dir=")
232
+    flags+=("--help")
233
+    flags+=("-h")
234
+    flags+=("--hostname=")
235
+    flags+=("--images=")
236
+    flags+=("--latest-images")
237
+    flags+=("--listen=")
238
+    flags+=("--master=")
239
+    flags+=("--master-config=")
240
+    flags+=("--network-plugin=")
241
+    flags+=("--node-config=")
242
+    flags+=("--nodes=")
243
+    flags+=("--portal-net=")
244
+    flags+=("--public-master=")
245
+    flags+=("--volume-dir=")
246
+    flags+=("--write-config=")
247
+
248
+    must_have_one_flag=()
249
+    must_have_one_noun=()
250
+}
251
+
252
+_openshift_admin_new-project()
253
+{
254
+    last_command="openshift_admin_new-project"
255
+    commands=()
256
+
257
+    flags=()
258
+    two_word_flags=()
259
+    flags_with_completion=()
260
+    flags_completion=()
261
+
262
+    flags+=("--admin=")
263
+    flags+=("--admin-role=")
264
+    flags+=("--description=")
265
+    flags+=("--display-name=")
266
+    flags+=("--help")
267
+    flags+=("-h")
268
+    flags+=("--master-policy-namespace=")
269
+
270
+    must_have_one_flag=()
271
+    must_have_one_noun=()
272
+}
273
+
274
+_openshift_admin_policy_add-role-to-user()
275
+{
276
+    last_command="openshift_admin_policy_add-role-to-user"
277
+    commands=()
278
+
279
+    flags=()
280
+    two_word_flags=()
281
+    flags_with_completion=()
282
+    flags_completion=()
283
+
284
+    flags+=("--help")
285
+    flags+=("-h")
286
+    flags+=("--role-namespace=")
287
+
288
+    must_have_one_flag=()
289
+    must_have_one_noun=()
290
+}
291
+
292
+_openshift_admin_policy_remove-role-from-user()
293
+{
294
+    last_command="openshift_admin_policy_remove-role-from-user"
295
+    commands=()
296
+
297
+    flags=()
298
+    two_word_flags=()
299
+    flags_with_completion=()
300
+    flags_completion=()
301
+
302
+    flags+=("--help")
303
+    flags+=("-h")
304
+    flags+=("--role-namespace=")
305
+
306
+    must_have_one_flag=()
307
+    must_have_one_noun=()
308
+}
309
+
310
+_openshift_admin_policy_remove-user()
311
+{
312
+    last_command="openshift_admin_policy_remove-user"
313
+    commands=()
314
+
315
+    flags=()
316
+    two_word_flags=()
317
+    flags_with_completion=()
318
+    flags_completion=()
319
+
320
+    flags+=("--help")
321
+    flags+=("-h")
322
+
323
+    must_have_one_flag=()
324
+    must_have_one_noun=()
325
+}
326
+
327
+_openshift_admin_policy_add-role-to-group()
328
+{
329
+    last_command="openshift_admin_policy_add-role-to-group"
330
+    commands=()
331
+
332
+    flags=()
333
+    two_word_flags=()
334
+    flags_with_completion=()
335
+    flags_completion=()
336
+
337
+    flags+=("--help")
338
+    flags+=("-h")
339
+    flags+=("--role-namespace=")
340
+
341
+    must_have_one_flag=()
342
+    must_have_one_noun=()
343
+}
344
+
345
+_openshift_admin_policy_remove-role-from-group()
346
+{
347
+    last_command="openshift_admin_policy_remove-role-from-group"
348
+    commands=()
349
+
350
+    flags=()
351
+    two_word_flags=()
352
+    flags_with_completion=()
353
+    flags_completion=()
354
+
355
+    flags+=("--help")
356
+    flags+=("-h")
357
+    flags+=("--role-namespace=")
358
+
359
+    must_have_one_flag=()
360
+    must_have_one_noun=()
361
+}
362
+
363
+_openshift_admin_policy_remove-group()
364
+{
365
+    last_command="openshift_admin_policy_remove-group"
366
+    commands=()
367
+
368
+    flags=()
369
+    two_word_flags=()
370
+    flags_with_completion=()
371
+    flags_completion=()
372
+
373
+    flags+=("--help")
374
+    flags+=("-h")
375
+
376
+    must_have_one_flag=()
377
+    must_have_one_noun=()
378
+}
379
+
380
+_openshift_admin_policy_who-can()
381
+{
382
+    last_command="openshift_admin_policy_who-can"
383
+    commands=()
384
+
385
+    flags=()
386
+    two_word_flags=()
387
+    flags_with_completion=()
388
+    flags_completion=()
389
+
390
+    flags+=("--help")
391
+    flags+=("-h")
392
+
393
+    must_have_one_flag=()
394
+    must_have_one_noun=()
395
+}
396
+
397
+_openshift_admin_policy()
398
+{
399
+    last_command="openshift_admin_policy"
400
+    commands=()
401
+    commands+=("add-role-to-user")
402
+    commands+=("remove-role-from-user")
403
+    commands+=("remove-user")
404
+    commands+=("add-role-to-group")
405
+    commands+=("remove-role-from-group")
406
+    commands+=("remove-group")
407
+    commands+=("who-can")
408
+
409
+    flags=()
410
+    two_word_flags=()
411
+    flags_with_completion=()
412
+    flags_completion=()
413
+
414
+    flags+=("--help")
415
+    flags+=("-h")
416
+
417
+    must_have_one_flag=()
418
+    must_have_one_noun=()
419
+}
420
+
421
+_openshift_admin_ipfailover()
422
+{
423
+    last_command="openshift_admin_ipfailover"
424
+    commands=()
425
+
426
+    flags=()
427
+    two_word_flags=()
428
+    flags_with_completion=()
429
+    flags_completion=()
430
+
431
+    flags+=("--create")
432
+    flags+=("--credentials=")
433
+    flags+=("--help")
434
+    flags+=("-h")
435
+    flags+=("--images=")
436
+    flags+=("--interface=")
437
+    two_word_flags+=("-i")
438
+    flags+=("--latest-images")
439
+    flags+=("--no-headers")
440
+    flags+=("--output=")
441
+    two_word_flags+=("-o")
442
+    flags+=("--output-version=")
443
+    flags+=("--replicas=")
444
+    two_word_flags+=("-r")
445
+    flags+=("--selector=")
446
+    two_word_flags+=("-l")
447
+    flags+=("--template=")
448
+    two_word_flags+=("-t")
449
+    flags+=("--type=")
450
+    flags+=("--virtual-ips=")
451
+    flags+=("--watch-port=")
452
+    two_word_flags+=("-w")
453
+
454
+    must_have_one_flag=()
455
+    must_have_one_noun=()
456
+}
457
+
458
+_openshift_admin_router()
459
+{
460
+    last_command="openshift_admin_router"
461
+    commands=()
462
+
463
+    flags=()
464
+    two_word_flags=()
465
+    flags_with_completion=()
466
+    flags_completion=()
467
+
468
+    flags+=("--create")
469
+    flags+=("--credentials=")
470
+    flags+=("--default-cert=")
471
+    flags+=("--dry-run")
472
+    flags+=("--help")
473
+    flags+=("-h")
474
+    flags+=("--images=")
475
+    flags+=("--labels=")
476
+    flags+=("--latest-images")
477
+    flags+=("--no-headers")
478
+    flags+=("--output=")
479
+    two_word_flags+=("-o")
480
+    flags+=("--output-version=")
481
+    flags+=("--ports=")
482
+    flags+=("--replicas=")
483
+    flags+=("--template=")
484
+    two_word_flags+=("-t")
485
+    flags+=("--type=")
486
+
487
+    must_have_one_flag=()
488
+    must_have_one_noun=()
489
+}
490
+
491
+_openshift_admin_registry()
492
+{
493
+    last_command="openshift_admin_registry"
494
+    commands=()
495
+
496
+    flags=()
497
+    two_word_flags=()
498
+    flags_with_completion=()
499
+    flags_completion=()
500
+
501
+    flags+=("--create")
502
+    flags+=("--credentials=")
503
+    flags+=("--dry-run")
504
+    flags+=("--help")
505
+    flags+=("-h")
506
+    flags+=("--images=")
507
+    flags+=("--labels=")
508
+    flags+=("--latest-images")
509
+    flags+=("--mount-host=")
510
+    flags+=("--no-headers")
511
+    flags+=("--output=")
512
+    two_word_flags+=("-o")
513
+    flags+=("--output-version=")
514
+    flags+=("--ports=")
515
+    flags+=("--replicas=")
516
+    flags+=("--template=")
517
+    two_word_flags+=("-t")
518
+    flags+=("--type=")
519
+    flags+=("--volume=")
520
+
521
+    must_have_one_flag=()
522
+    must_have_one_noun=()
523
+}
524
+
525
+_openshift_admin_build-chain()
526
+{
527
+    last_command="openshift_admin_build-chain"
528
+    commands=()
529
+
530
+    flags=()
531
+    two_word_flags=()
532
+    flags_with_completion=()
533
+    flags_completion=()
534
+
535
+    flags+=("--all")
536
+    flags+=("--all-tags")
537
+    flags+=("--help")
538
+    flags+=("-h")
539
+    flags+=("--output=")
540
+    two_word_flags+=("-o")
541
+
542
+    must_have_one_flag=()
543
+    must_have_one_noun=()
544
+}
545
+
546
+_openshift_admin_config_view()
547
+{
548
+    last_command="openshift_admin_config_view"
549
+    commands=()
550
+
551
+    flags=()
552
+    two_word_flags=()
553
+    flags_with_completion=()
554
+    flags_completion=()
555
+
556
+    flags+=("--flatten")
557
+    flags+=("--help")
558
+    flags+=("-h")
559
+    flags+=("--merge")
560
+    flags+=("--minify")
561
+    flags+=("--no-headers")
562
+    flags+=("--output=")
563
+    two_word_flags+=("-o")
564
+    flags+=("--output-version=")
565
+    flags+=("--raw")
566
+    flags+=("--template=")
567
+    two_word_flags+=("-t")
568
+
569
+    must_have_one_flag=()
570
+    must_have_one_noun=()
571
+}
572
+
573
+_openshift_admin_config_set-cluster()
574
+{
575
+    last_command="openshift_admin_config_set-cluster"
576
+    commands=()
577
+
578
+    flags=()
579
+    two_word_flags=()
580
+    flags_with_completion=()
581
+    flags_completion=()
582
+
583
+    flags+=("--api-version=")
584
+    flags+=("--certificate-authority=")
585
+    flags+=("--embed-certs")
586
+    flags+=("--help")
587
+    flags+=("-h")
588
+    flags+=("--insecure-skip-tls-verify")
589
+    flags+=("--server=")
590
+
591
+    must_have_one_flag=()
592
+    must_have_one_noun=()
593
+}
594
+
595
+_openshift_admin_config_set-credentials()
596
+{
597
+    last_command="openshift_admin_config_set-credentials"
598
+    commands=()
599
+
600
+    flags=()
601
+    two_word_flags=()
602
+    flags_with_completion=()
603
+    flags_completion=()
604
+
605
+    flags+=("--auth-path=")
606
+    flags+=("--client-certificate=")
607
+    flags+=("--client-key=")
608
+    flags+=("--embed-certs")
609
+    flags+=("--help")
610
+    flags+=("-h")
611
+    flags+=("--password=")
612
+    flags+=("--token=")
613
+    flags+=("--username=")
614
+
615
+    must_have_one_flag=()
616
+    must_have_one_noun=()
617
+}
618
+
619
+_openshift_admin_config_set-context()
620
+{
621
+    last_command="openshift_admin_config_set-context"
622
+    commands=()
623
+
624
+    flags=()
625
+    two_word_flags=()
626
+    flags_with_completion=()
627
+    flags_completion=()
628
+
629
+    flags+=("--cluster=")
630
+    flags+=("--help")
631
+    flags+=("-h")
632
+    flags+=("--namespace=")
633
+    flags+=("--user=")
634
+
635
+    must_have_one_flag=()
636
+    must_have_one_noun=()
637
+}
638
+
639
+_openshift_admin_config_set()
640
+{
641
+    last_command="openshift_admin_config_set"
642
+    commands=()
643
+
644
+    flags=()
645
+    two_word_flags=()
646
+    flags_with_completion=()
647
+    flags_completion=()
648
+
649
+    flags+=("--help")
650
+    flags+=("-h")
651
+
652
+    must_have_one_flag=()
653
+    must_have_one_noun=()
654
+}
655
+
656
+_openshift_admin_config_unset()
657
+{
658
+    last_command="openshift_admin_config_unset"
659
+    commands=()
660
+
661
+    flags=()
662
+    two_word_flags=()
663
+    flags_with_completion=()
664
+    flags_completion=()
665
+
666
+    flags+=("--help")
667
+    flags+=("-h")
668
+
669
+    must_have_one_flag=()
670
+    must_have_one_noun=()
671
+}
672
+
673
+_openshift_admin_config_use-context()
674
+{
675
+    last_command="openshift_admin_config_use-context"
676
+    commands=()
677
+
678
+    flags=()
679
+    two_word_flags=()
680
+    flags_with_completion=()
681
+    flags_completion=()
682
+
683
+    flags+=("--help")
684
+    flags+=("-h")
685
+
686
+    must_have_one_flag=()
687
+    must_have_one_noun=()
688
+}
689
+
690
+_openshift_admin_config()
691
+{
692
+    last_command="openshift_admin_config"
693
+    commands=()
694
+    commands+=("view")
695
+    commands+=("set-cluster")
696
+    commands+=("set-credentials")
697
+    commands+=("set-context")
698
+    commands+=("set")
699
+    commands+=("unset")
700
+    commands+=("use-context")
701
+
702
+    flags=()
703
+    two_word_flags=()
704
+    flags_with_completion=()
705
+    flags_completion=()
706
+
707
+    flags+=("--config=")
708
+    flags+=("--help")
709
+    flags+=("-h")
710
+
711
+    must_have_one_flag=()
712
+    must_have_one_noun=()
713
+}
714
+
715
+_openshift_admin_create-kubeconfig()
716
+{
717
+    last_command="openshift_admin_create-kubeconfig"
718
+    commands=()
719
+
720
+    flags=()
721
+    two_word_flags=()
722
+    flags_with_completion=()
723
+    flags_completion=()
724
+
725
+    flags+=("--certificate-authority=")
726
+    flags+=("--client-certificate=")
727
+    flags+=("--client-key=")
728
+    flags+=("--cluster=")
729
+    flags+=("--context=")
730
+    flags+=("--help")
731
+    flags+=("-h")
732
+    flags+=("--kubeconfig=")
733
+    flags+=("--master=")
734
+    flags+=("--namespace=")
735
+    flags+=("--public-master=")
736
+    flags+=("--user=")
737
+
738
+    must_have_one_flag=()
739
+    must_have_one_noun=()
740
+}
741
+
742
+_openshift_admin_create-bootstrap-policy-file()
743
+{
744
+    last_command="openshift_admin_create-bootstrap-policy-file"
745
+    commands=()
746
+
747
+    flags=()
748
+    two_word_flags=()
749
+    flags_with_completion=()
750
+    flags_completion=()
751
+
752
+    flags+=("--filename=")
753
+    flags+=("--help")
754
+    flags+=("-h")
755
+    flags+=("--master-namespace=")
756
+    flags+=("--openshift-namespace=")
757
+
758
+    must_have_one_flag=()
759
+    must_have_one_noun=()
760
+}
761
+
762
+_openshift_admin_overwrite-policy()
763
+{
764
+    last_command="openshift_admin_overwrite-policy"
765
+    commands=()
766
+
767
+    flags=()
768
+    two_word_flags=()
769
+    flags_with_completion=()
770
+    flags_completion=()
771
+
772
+    flags+=("--filename=")
773
+    flags+=("--force")
774
+    flags+=("-f")
775
+    flags+=("--help")
776
+    flags+=("-h")
777
+    flags+=("--master-config=")
778
+
779
+    must_have_one_flag=()
780
+    must_have_one_noun=()
781
+}
782
+
783
+_openshift_admin_create-node-config()
784
+{
785
+    last_command="openshift_admin_create-node-config"
786
+    commands=()
787
+
788
+    flags=()
789
+    two_word_flags=()
790
+    flags_with_completion=()
791
+    flags_completion=()
792
+
793
+    flags+=("--allow-disabled-docker")
794
+    flags+=("--certificate-authority=")
795
+    flags+=("--client-certificate=")
796
+    flags+=("--client-key=")
797
+    flags+=("--dns-domain=")
798
+    flags+=("--dns-ip=")
799
+    flags+=("--help")
800
+    flags+=("-h")
801
+    flags+=("--hostnames=")
802
+    flags+=("--images=")
803
+    flags+=("--latest-images")
804
+    flags+=("--listen=")
805
+    flags+=("--master=")
806
+    flags+=("--node=")
807
+    flags+=("--node-client-certificate-authority=")
808
+    flags+=("--node-dir=")
809
+    flags+=("--server-certificate=")
810
+    flags+=("--server-key=")
811
+    flags+=("--signer-cert=")
812
+    flags+=("--signer-key=")
813
+    flags+=("--signer-serial=")
814
+    flags+=("--volume-dir=")
815
+
816
+    must_have_one_flag=()
817
+    must_have_one_noun=()
818
+}
819
+
820
+_openshift_admin_create-master-certs()
821
+{
822
+    last_command="openshift_admin_create-master-certs"
823
+    commands=()
824
+
825
+    flags=()
826
+    two_word_flags=()
827
+    flags_with_completion=()
828
+    flags_completion=()
829
+
830
+    flags+=("--cert-dir=")
831
+    flags+=("--help")
832
+    flags+=("-h")
833
+    flags+=("--hostnames=")
834
+    flags+=("--master=")
835
+    flags+=("--overwrite")
836
+    flags+=("--public-master=")
837
+    flags+=("--signer-name=")
838
+
839
+    must_have_one_flag=()
840
+    must_have_one_noun=()
841
+}
842
+
843
+_openshift_admin_create-api-client-config()
844
+{
845
+    last_command="openshift_admin_create-api-client-config"
846
+    commands=()
847
+
848
+    flags=()
849
+    two_word_flags=()
850
+    flags_with_completion=()
851
+    flags_completion=()
852
+
853
+    flags+=("--certificate-authority=")
854
+    flags+=("--client-dir=")
855
+    flags+=("--groups=")
856
+    flags+=("--help")
857
+    flags+=("-h")
858
+    flags+=("--master=")
859
+    flags+=("--public-master=")
860
+    flags+=("--signer-cert=")
861
+    flags+=("--signer-key=")
862
+    flags+=("--signer-serial=")
863
+    flags+=("--user=")
864
+
865
+    must_have_one_flag=()
866
+    must_have_one_noun=()
867
+}
868
+
869
+_openshift_admin_create-server-cert()
870
+{
871
+    last_command="openshift_admin_create-server-cert"
872
+    commands=()
873
+
874
+    flags=()
875
+    two_word_flags=()
876
+    flags_with_completion=()
877
+    flags_completion=()
878
+
879
+    flags+=("--cert=")
880
+    flags+=("--help")
881
+    flags+=("-h")
882
+    flags+=("--hostnames=")
883
+    flags+=("--key=")
884
+    flags+=("--overwrite")
885
+    flags+=("--signer-cert=")
886
+    flags+=("--signer-key=")
887
+    flags+=("--signer-serial=")
888
+
889
+    must_have_one_flag=()
890
+    must_have_one_noun=()
891
+}
892
+
893
+_openshift_admin_create-signer-cert()
894
+{
895
+    last_command="openshift_admin_create-signer-cert"
896
+    commands=()
897
+
898
+    flags=()
899
+    two_word_flags=()
900
+    flags_with_completion=()
901
+    flags_completion=()
902
+
903
+    flags+=("--cert=")
904
+    flags+=("--help")
905
+    flags+=("-h")
906
+    flags+=("--key=")
907
+    flags+=("--name=")
908
+    flags+=("--overwrite")
909
+    flags+=("--serial=")
910
+
911
+    must_have_one_flag=()
912
+    must_have_one_noun=()
913
+}
914
+
915
+_openshift_admin_options()
916
+{
917
+    last_command="openshift_admin_options"
918
+    commands=()
919
+
920
+    flags=()
921
+    two_word_flags=()
922
+    flags_with_completion=()
923
+    flags_completion=()
924
+
925
+    flags+=("--help")
926
+    flags+=("-h")
927
+
928
+    must_have_one_flag=()
929
+    must_have_one_noun=()
930
+}
931
+
932
+_openshift_admin()
933
+{
934
+    last_command="openshift_admin"
935
+    commands=()
936
+    commands+=("new-project")
937
+    commands+=("policy")
938
+    commands+=("ipfailover")
939
+    commands+=("router")
940
+    commands+=("registry")
941
+    commands+=("build-chain")
942
+    commands+=("config")
943
+    commands+=("create-kubeconfig")
944
+    commands+=("create-bootstrap-policy-file")
945
+    commands+=("overwrite-policy")
946
+    commands+=("create-node-config")
947
+    commands+=("create-master-certs")
948
+    commands+=("create-api-client-config")
949
+    commands+=("create-server-cert")
950
+    commands+=("create-signer-cert")
951
+    commands+=("options")
952
+
953
+    flags=()
954
+    two_word_flags=()
955
+    flags_with_completion=()
956
+    flags_completion=()
957
+
958
+    flags+=("--allow_dynamic_housekeeping")
959
+    flags+=("--alsologtostderr")
960
+    flags+=("--api-version=")
961
+    flags+=("--auth-path=")
962
+    flags+=("--boot_id_file=")
963
+    flags+=("--certificate-authority=")
964
+    flags+=("--client-certificate=")
965
+    flags+=("--client-key=")
966
+    flags+=("--cluster=")
967
+    flags+=("--config=")
968
+    flags+=("--container_hints=")
969
+    flags+=("--context=")
970
+    flags+=("--docker=")
971
+    flags+=("--docker_root=")
972
+    flags+=("--docker_run=")
973
+    flags+=("--enable_load_reader")
974
+    flags+=("--global_housekeeping_interval=")
975
+    flags+=("--google-json-key=")
976
+    flags+=("--help")
977
+    flags+=("-h")
978
+    flags+=("--housekeeping_interval=")
979
+    flags+=("--httptest.serve=")
980
+    flags+=("--insecure-skip-tls-verify")
981
+    flags+=("--log_backtrace_at=")
982
+    flags+=("--log_cadvisor_usage")
983
+    flags+=("--log_dir=")
984
+    flags+=("--log_flush_frequency=")
985
+    flags+=("--logtostderr")
986
+    flags+=("--machine_id_file=")
987
+    flags+=("--match-server-version")
988
+    flags+=("--max_housekeeping_interval=")
989
+    flags+=("--namespace=")
990
+    two_word_flags+=("-n")
991
+    flags+=("--server=")
992
+    flags+=("--stderrthreshold=")
993
+    flags+=("--token=")
994
+    flags+=("--user=")
995
+    flags+=("--v=")
996
+    flags+=("--validate")
997
+    flags+=("--vmodule=")
998
+
999
+    must_have_one_flag=()
1000
+    must_have_one_noun=()
1001
+}
1002
+
1003
+_openshift_cli_login()
1004
+{
1005
+    last_command="openshift_cli_login"
1006
+    commands=()
1007
+
1008
+    flags=()
1009
+    two_word_flags=()
1010
+    flags_with_completion=()
1011
+    flags_completion=()
1012
+
1013
+    flags+=("--help")
1014
+    flags+=("-h")
1015
+    flags+=("--password=")
1016
+    two_word_flags+=("-p")
1017
+    flags+=("--username=")
1018
+    two_word_flags+=("-u")
1019
+
1020
+    must_have_one_flag=()
1021
+    must_have_one_noun=()
1022
+}
1023
+
1024
+_openshift_cli_logout()
1025
+{
1026
+    last_command="openshift_cli_logout"
1027
+    commands=()
1028
+
1029
+    flags=()
1030
+    two_word_flags=()
1031
+    flags_with_completion=()
1032
+    flags_completion=()
1033
+
1034
+    flags+=("--help")
1035
+    flags+=("-h")
1036
+
1037
+    must_have_one_flag=()
1038
+    must_have_one_noun=()
1039
+}
1040
+
1041
+_openshift_cli_project()
1042
+{
1043
+    last_command="openshift_cli_project"
1044
+    commands=()
1045
+
1046
+    flags=()
1047
+    two_word_flags=()
1048
+    flags_with_completion=()
1049
+    flags_completion=()
1050
+
1051
+    flags+=("--help")
1052
+    flags+=("-h")
1053
+
1054
+    must_have_one_flag=()
1055
+    must_have_one_noun=()
1056
+}
1057
+
1058
+_openshift_cli_new-project()
1059
+{
1060
+    last_command="openshift_cli_new-project"
1061
+    commands=()
1062
+
1063
+    flags=()
1064
+    two_word_flags=()
1065
+    flags_with_completion=()
1066
+    flags_completion=()
1067
+
1068
+    flags+=("--description=")
1069
+    flags+=("--display-name=")
1070
+    flags+=("--help")
1071
+    flags+=("-h")
1072
+
1073
+    must_have_one_flag=()
1074
+    must_have_one_noun=()
1075
+}
1076
+
1077
+_openshift_cli_new-app()
1078
+{
1079
+    last_command="openshift_cli_new-app"
1080
+    commands=()
1081
+
1082
+    flags=()
1083
+    two_word_flags=()
1084
+    flags_with_completion=()
1085
+    flags_completion=()
1086
+
1087
+    flags+=("--build=")
1088
+    flags+=("--code=")
1089
+    flags+=("--docker-image=")
1090
+    flags+=("--env=")
1091
+    two_word_flags+=("-e")
1092
+    flags+=("--group=")
1093
+    flags+=("--help")
1094
+    flags+=("-h")
1095
+    flags+=("--image=")
1096
+    two_word_flags+=("-i")
1097
+    flags+=("--labels=")
1098
+    two_word_flags+=("-l")
1099
+    flags+=("--name=")
1100
+    flags+=("--no-headers")
1101
+    flags+=("--output=")
1102
+    two_word_flags+=("-o")
1103
+    flags+=("--output-template=")
1104
+    flags+=("--output-version=")
1105
+    flags+=("--param=")
1106
+    two_word_flags+=("-p")
1107
+    flags+=("--template=")
1108
+
1109
+    must_have_one_flag=()
1110
+    must_have_one_noun=()
1111
+}
1112
+
1113
+_openshift_cli_status()
1114
+{
1115
+    last_command="openshift_cli_status"
1116
+    commands=()
1117
+
1118
+    flags=()
1119
+    two_word_flags=()
1120
+    flags_with_completion=()
1121
+    flags_completion=()
1122
+
1123
+    flags+=("--help")
1124
+    flags+=("-h")
1125
+
1126
+    must_have_one_flag=()
1127
+    must_have_one_noun=()
1128
+}
1129
+
1130
+_openshift_cli_start-build()
1131
+{
1132
+    last_command="openshift_cli_start-build"
1133
+    commands=()
1134
+
1135
+    flags=()
1136
+    two_word_flags=()
1137
+    flags_with_completion=()
1138
+    flags_completion=()
1139
+
1140
+    flags+=("--follow")
1141
+    flags+=("--from-build=")
1142
+    flags+=("--from-webhook=")
1143
+    flags+=("--git-post-receive=")
1144
+    flags+=("--help")
1145
+    flags+=("-h")
1146
+    flags+=("--list-webhooks=")
1147
+
1148
+    must_have_one_flag=()
1149
+    must_have_one_noun=()
1150
+}
1151
+
1152
+_openshift_cli_cancel-build()
1153
+{
1154
+    last_command="openshift_cli_cancel-build"
1155
+    commands=()
1156
+
1157
+    flags=()
1158
+    two_word_flags=()
1159
+    flags_with_completion=()
1160
+    flags_completion=()
1161
+
1162
+    flags+=("--dump-logs")
1163
+    flags+=("--help")
1164
+    flags+=("-h")
1165
+    flags+=("--restart")
1166
+
1167
+    must_have_one_flag=()
1168
+    must_have_one_noun=()
1169
+}
1170
+
1171
+_openshift_cli_build-logs()
1172
+{
1173
+    last_command="openshift_cli_build-logs"
1174
+    commands=()
1175
+
1176
+    flags=()
1177
+    two_word_flags=()
1178
+    flags_with_completion=()
1179
+    flags_completion=()
1180
+
1181
+    flags+=("--follow")
1182
+    flags+=("-f")
1183
+    flags+=("--help")
1184
+    flags+=("-h")
1185
+    flags+=("--nowait")
1186
+    flags+=("-w")
1187
+
1188
+    must_have_one_flag=()
1189
+    must_have_one_noun=()
1190
+}
1191
+
1192
+_openshift_cli_deploy()
1193
+{
1194
+    last_command="openshift_cli_deploy"
1195
+    commands=()
1196
+
1197
+    flags=()
1198
+    two_word_flags=()
1199
+    flags_with_completion=()
1200
+    flags_completion=()
1201
+
1202
+    flags+=("--help")
1203
+    flags+=("-h")
1204
+    flags+=("--latest")
1205
+    flags+=("--retry")
1206
+
1207
+    must_have_one_flag=()
1208
+    must_have_one_noun=()
1209
+}
1210
+
1211
+_openshift_cli_rollback()
1212
+{
1213
+    last_command="openshift_cli_rollback"
1214
+    commands=()
1215
+
1216
+    flags=()
1217
+    two_word_flags=()
1218
+    flags_with_completion=()
1219
+    flags_completion=()
1220
+
1221
+    flags+=("--change-scaling-settings")
1222
+    flags+=("--change-strategy")
1223
+    flags+=("--change-triggers")
1224
+    flags+=("--dry-run")
1225
+    flags+=("-d")
1226
+    flags+=("--help")
1227
+    flags+=("-h")
1228
+    flags+=("--output=")
1229
+    two_word_flags+=("-o")
1230
+    flags+=("--template=")
1231
+    two_word_flags+=("-t")
1232
+
1233
+    must_have_one_flag=()
1234
+    must_have_one_noun=()
1235
+}
1236
+
1237
+_openshift_cli_get()
1238
+{
1239
+    last_command="openshift_cli_get"
1240
+    commands=()
1241
+
1242
+    flags=()
1243
+    two_word_flags=()
1244
+    flags_with_completion=()
1245
+    flags_completion=()
1246
+
1247
+    flags+=("--help")
1248
+    flags+=("-h")
1249
+    flags+=("--no-headers")
1250
+    flags+=("--output=")
1251
+    two_word_flags+=("-o")
1252
+    flags+=("--output-version=")
1253
+    flags+=("--selector=")
1254
+    two_word_flags+=("-l")
1255
+    flags+=("--template=")
1256
+    two_word_flags+=("-t")
1257
+    flags+=("--watch")
1258
+    flags+=("-w")
1259
+    flags+=("--watch-only")
1260
+
1261
+    must_have_one_flag=()
1262
+    must_have_one_noun=()
1263
+    must_have_one_noun+=("build")
1264
+    must_have_one_noun+=("buildconfig")
1265
+    must_have_one_noun+=("clusterpolicy")
1266
+    must_have_one_noun+=("clusterpolicybinding")
1267
+    must_have_one_noun+=("clusterrole")
1268
+    must_have_one_noun+=("clusterrolebinding")
1269
+    must_have_one_noun+=("componentstatus")
1270
+    must_have_one_noun+=("deployment")
1271
+    must_have_one_noun+=("deploymentconfig")
1272
+    must_have_one_noun+=("endpoints")
1273
+    must_have_one_noun+=("event")
1274
+    must_have_one_noun+=("identity")
1275
+    must_have_one_noun+=("image")
1276
+    must_have_one_noun+=("imagerepository")
1277
+    must_have_one_noun+=("imagerepositorytag")
1278
+    must_have_one_noun+=("imagestream")
1279
+    must_have_one_noun+=("imagestreamimage")
1280
+    must_have_one_noun+=("imagestreamtag")
1281
+    must_have_one_noun+=("ispersonalsubjectaccessreview")
1282
+    must_have_one_noun+=("limitrange")
1283
+    must_have_one_noun+=("namespace")
1284
+    must_have_one_noun+=("node")
1285
+    must_have_one_noun+=("oauthaccesstoken")
1286
+    must_have_one_noun+=("oauthauthorizetoken")
1287
+    must_have_one_noun+=("oauthclient")
1288
+    must_have_one_noun+=("oauthclientauthorization")
1289
+    must_have_one_noun+=("persistentvolume")
1290
+    must_have_one_noun+=("persistentvolumeclaim")
1291
+    must_have_one_noun+=("pod")
1292
+    must_have_one_noun+=("podtemplate")
1293
+    must_have_one_noun+=("policy")
1294
+    must_have_one_noun+=("policybinding")
1295
+    must_have_one_noun+=("project")
1296
+    must_have_one_noun+=("replicationcontroller")
1297
+    must_have_one_noun+=("resourcequota")
1298
+    must_have_one_noun+=("role")
1299
+    must_have_one_noun+=("rolebinding")
1300
+    must_have_one_noun+=("route")
1301
+    must_have_one_noun+=("secret")
1302
+    must_have_one_noun+=("service")
1303
+    must_have_one_noun+=("template")
1304
+    must_have_one_noun+=("user")
1305
+    must_have_one_noun+=("useridentitymapping")
1306
+}
1307
+
1308
+_openshift_cli_describe()
1309
+{
1310
+    last_command="openshift_cli_describe"
1311
+    commands=()
1312
+
1313
+    flags=()
1314
+    two_word_flags=()
1315
+    flags_with_completion=()
1316
+    flags_completion=()
1317
+
1318
+    flags+=("--help")
1319
+    flags+=("-h")
1320
+
1321
+    must_have_one_flag=()
1322
+    must_have_one_noun=()
1323
+    must_have_one_noun+=("build")
1324
+    must_have_one_noun+=("buildconfig")
1325
+    must_have_one_noun+=("buildlog")
1326
+    must_have_one_noun+=("clusterpolicy")
1327
+    must_have_one_noun+=("clusterpolicybinding")
1328
+    must_have_one_noun+=("clusterrole")
1329
+    must_have_one_noun+=("clusterrolebinding")
1330
+    must_have_one_noun+=("deployment")
1331
+    must_have_one_noun+=("deploymentconfig")
1332
+    must_have_one_noun+=("identity")
1333
+    must_have_one_noun+=("image")
1334
+    must_have_one_noun+=("imagestream")
1335
+    must_have_one_noun+=("imagestreamimage")
1336
+    must_have_one_noun+=("imagestreamtag")
1337
+    must_have_one_noun+=("limitrange")
1338
+    must_have_one_noun+=("minion")
1339
+    must_have_one_noun+=("node")
1340
+    must_have_one_noun+=("persistentvolume")
1341
+    must_have_one_noun+=("persistentvolumeclaim")
1342
+    must_have_one_noun+=("pod")
1343
+    must_have_one_noun+=("policy")
1344
+    must_have_one_noun+=("policybinding")
1345
+    must_have_one_noun+=("project")
1346
+    must_have_one_noun+=("replicationcontroller")
1347
+    must_have_one_noun+=("resourcequota")
1348
+    must_have_one_noun+=("role")
1349
+    must_have_one_noun+=("rolebinding")
1350
+    must_have_one_noun+=("route")
1351
+    must_have_one_noun+=("service")
1352
+    must_have_one_noun+=("template")
1353
+    must_have_one_noun+=("user")
1354
+    must_have_one_noun+=("useridentitymapping")
1355
+}
1356
+
1357
+_openshift_cli_create()
1358
+{
1359
+    last_command="openshift_cli_create"
1360
+    commands=()
1361
+
1362
+    flags=()
1363
+    two_word_flags=()
1364
+    flags_with_completion=()
1365
+    flags_completion=()
1366
+
1367
+    flags+=("--filename=")
1368
+    flags_with_completion+=("--filename")
1369
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1370
+    two_word_flags+=("-f")
1371
+    flags_with_completion+=("-f")
1372
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1373
+    flags+=("--help")
1374
+    flags+=("-h")
1375
+
1376
+    must_have_one_flag=()
1377
+    must_have_one_flag+=("--filename=")
1378
+    must_have_one_flag+=("-f")
1379
+    must_have_one_noun=()
1380
+}
1381
+
1382
+_openshift_cli_process()
1383
+{
1384
+    last_command="openshift_cli_process"
1385
+    commands=()
1386
+
1387
+    flags=()
1388
+    two_word_flags=()
1389
+    flags_with_completion=()
1390
+    flags_completion=()
1391
+
1392
+    flags+=("--filename=")
1393
+    two_word_flags+=("-f")
1394
+    flags+=("--help")
1395
+    flags+=("-h")
1396
+    flags+=("--labels=")
1397
+    two_word_flags+=("-l")
1398
+    flags+=("--no-headers")
1399
+    flags+=("--output=")
1400
+    two_word_flags+=("-o")
1401
+    flags+=("--output-version=")
1402
+    flags+=("--parameters")
1403
+    flags+=("--template=")
1404
+    two_word_flags+=("-t")
1405
+    flags+=("--value=")
1406
+    two_word_flags+=("-v")
1407
+
1408
+    must_have_one_flag=()
1409
+    must_have_one_noun=()
1410
+}
1411
+
1412
+_openshift_cli_edit()
1413
+{
1414
+    last_command="openshift_cli_edit"
1415
+    commands=()
1416
+
1417
+    flags=()
1418
+    two_word_flags=()
1419
+    flags_with_completion=()
1420
+    flags_completion=()
1421
+
1422
+    flags+=("--filename=")
1423
+    flags_with_completion+=("--filename")
1424
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1425
+    two_word_flags+=("-f")
1426
+    flags_with_completion+=("-f")
1427
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1428
+    flags+=("--help")
1429
+    flags+=("-h")
1430
+    flags+=("--output=")
1431
+    two_word_flags+=("-o")
1432
+    flags+=("--output-version=")
1433
+
1434
+    must_have_one_flag=()
1435
+    must_have_one_noun=()
1436
+}
1437
+
1438
+_openshift_cli_update()
1439
+{
1440
+    last_command="openshift_cli_update"
1441
+    commands=()
1442
+
1443
+    flags=()
1444
+    two_word_flags=()
1445
+    flags_with_completion=()
1446
+    flags_completion=()
1447
+
1448
+    flags+=("--filename=")
1449
+    flags_with_completion+=("--filename")
1450
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1451
+    two_word_flags+=("-f")
1452
+    flags_with_completion+=("-f")
1453
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1454
+    flags+=("--help")
1455
+    flags+=("-h")
1456
+    flags+=("--patch=")
1457
+
1458
+    must_have_one_flag=()
1459
+    must_have_one_flag+=("--filename=")
1460
+    must_have_one_flag+=("-f")
1461
+    must_have_one_flag+=("--patch=")
1462
+    must_have_one_noun=()
1463
+}
1464
+
1465
+_openshift_cli_delete()
1466
+{
1467
+    last_command="openshift_cli_delete"
1468
+    commands=()
1469
+
1470
+    flags=()
1471
+    two_word_flags=()
1472
+    flags_with_completion=()
1473
+    flags_completion=()
1474
+
1475
+    flags+=("--all")
1476
+    flags+=("--cascade")
1477
+    flags+=("--filename=")
1478
+    flags_with_completion+=("--filename")
1479
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1480
+    two_word_flags+=("-f")
1481
+    flags_with_completion+=("-f")
1482
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1483
+    flags+=("--grace-period=")
1484
+    flags+=("--help")
1485
+    flags+=("-h")
1486
+    flags+=("--selector=")
1487
+    two_word_flags+=("-l")
1488
+
1489
+    must_have_one_flag=()
1490
+    must_have_one_noun=()
1491
+}
1492
+
1493
+_openshift_cli_log()
1494
+{
1495
+    last_command="openshift_cli_log"
1496
+    commands=()
1497
+
1498
+    flags=()
1499
+    two_word_flags=()
1500
+    flags_with_completion=()
1501
+    flags_completion=()
1502
+
1503
+    flags+=("--follow")
1504
+    flags+=("-f")
1505
+    flags+=("--help")
1506
+    flags+=("-h")
1507
+    flags+=("--interactive")
1508
+
1509
+    must_have_one_flag=()
1510
+    must_have_one_noun=()
1511
+}
1512
+
1513
+_openshift_cli_exec()
1514
+{
1515
+    last_command="openshift_cli_exec"
1516
+    commands=()
1517
+
1518
+    flags=()
1519
+    two_word_flags=()
1520
+    flags_with_completion=()
1521
+    flags_completion=()
1522
+
1523
+    flags+=("--container=")
1524
+    two_word_flags+=("-c")
1525
+    flags+=("--help")
1526
+    flags+=("-h")
1527
+    flags+=("--pod=")
1528
+    two_word_flags+=("-p")
1529
+    flags+=("--stdin")
1530
+    flags+=("-i")
1531
+    flags+=("--tty")
1532
+    flags+=("-t")
1533
+
1534
+    must_have_one_flag=()
1535
+    must_have_one_flag+=("--container=")
1536
+    must_have_one_flag+=("-c")
1537
+    must_have_one_flag+=("--pod=")
1538
+    must_have_one_flag+=("-p")
1539
+    must_have_one_noun=()
1540
+}
1541
+
1542
+_openshift_cli_port-forward()
1543
+{
1544
+    last_command="openshift_cli_port-forward"
1545
+    commands=()
1546
+
1547
+    flags=()
1548
+    two_word_flags=()
1549
+    flags_with_completion=()
1550
+    flags_completion=()
1551
+
1552
+    flags+=("--help")
1553
+    flags+=("-h")
1554
+    flags+=("--pod=")
1555
+    two_word_flags+=("-p")
1556
+
1557
+    must_have_one_flag=()
1558
+    must_have_one_flag+=("--pod=")
1559
+    must_have_one_flag+=("-p")
1560
+    must_have_one_noun=()
1561
+}
1562
+
1563
+_openshift_cli_proxy()
1564
+{
1565
+    last_command="openshift_cli_proxy"
1566
+    commands=()
1567
+
1568
+    flags=()
1569
+    two_word_flags=()
1570
+    flags_with_completion=()
1571
+    flags_completion=()
1572
+
1573
+    flags+=("--api-prefix=")
1574
+    flags+=("--help")
1575
+    flags+=("-h")
1576
+    flags+=("--port=")
1577
+    two_word_flags+=("-p")
1578
+    flags+=("--www=")
1579
+    two_word_flags+=("-w")
1580
+    flags+=("--www-prefix=")
1581
+    two_word_flags+=("-P")
1582
+
1583
+    must_have_one_flag=()
1584
+    must_have_one_noun=()
1585
+}
1586
+
1587
+_openshift_cli_config_view()
1588
+{
1589
+    last_command="openshift_cli_config_view"
1590
+    commands=()
1591
+
1592
+    flags=()
1593
+    two_word_flags=()
1594
+    flags_with_completion=()
1595
+    flags_completion=()
1596
+
1597
+    flags+=("--flatten")
1598
+    flags+=("--help")
1599
+    flags+=("-h")
1600
+    flags+=("--merge")
1601
+    flags+=("--minify")
1602
+    flags+=("--no-headers")
1603
+    flags+=("--output=")
1604
+    two_word_flags+=("-o")
1605
+    flags+=("--output-version=")
1606
+    flags+=("--raw")
1607
+    flags+=("--template=")
1608
+    two_word_flags+=("-t")
1609
+
1610
+    must_have_one_flag=()
1611
+    must_have_one_noun=()
1612
+}
1613
+
1614
+_openshift_cli_config_set-cluster()
1615
+{
1616
+    last_command="openshift_cli_config_set-cluster"
1617
+    commands=()
1618
+
1619
+    flags=()
1620
+    two_word_flags=()
1621
+    flags_with_completion=()
1622
+    flags_completion=()
1623
+
1624
+    flags+=("--api-version=")
1625
+    flags+=("--certificate-authority=")
1626
+    flags+=("--embed-certs")
1627
+    flags+=("--help")
1628
+    flags+=("-h")
1629
+    flags+=("--insecure-skip-tls-verify")
1630
+    flags+=("--server=")
1631
+
1632
+    must_have_one_flag=()
1633
+    must_have_one_noun=()
1634
+}
1635
+
1636
+_openshift_cli_config_set-credentials()
1637
+{
1638
+    last_command="openshift_cli_config_set-credentials"
1639
+    commands=()
1640
+
1641
+    flags=()
1642
+    two_word_flags=()
1643
+    flags_with_completion=()
1644
+    flags_completion=()
1645
+
1646
+    flags+=("--auth-path=")
1647
+    flags+=("--client-certificate=")
1648
+    flags+=("--client-key=")
1649
+    flags+=("--embed-certs")
1650
+    flags+=("--help")
1651
+    flags+=("-h")
1652
+    flags+=("--password=")
1653
+    flags+=("--token=")
1654
+    flags+=("--username=")
1655
+
1656
+    must_have_one_flag=()
1657
+    must_have_one_noun=()
1658
+}
1659
+
1660
+_openshift_cli_config_set-context()
1661
+{
1662
+    last_command="openshift_cli_config_set-context"
1663
+    commands=()
1664
+
1665
+    flags=()
1666
+    two_word_flags=()
1667
+    flags_with_completion=()
1668
+    flags_completion=()
1669
+
1670
+    flags+=("--cluster=")
1671
+    flags+=("--help")
1672
+    flags+=("-h")
1673
+    flags+=("--namespace=")
1674
+    flags+=("--user=")
1675
+
1676
+    must_have_one_flag=()
1677
+    must_have_one_noun=()
1678
+}
1679
+
1680
+_openshift_cli_config_set()
1681
+{
1682
+    last_command="openshift_cli_config_set"
1683
+    commands=()
1684
+
1685
+    flags=()
1686
+    two_word_flags=()
1687
+    flags_with_completion=()
1688
+    flags_completion=()
1689
+
1690
+    flags+=("--help")
1691
+    flags+=("-h")
1692
+
1693
+    must_have_one_flag=()
1694
+    must_have_one_noun=()
1695
+}
1696
+
1697
+_openshift_cli_config_unset()
1698
+{
1699
+    last_command="openshift_cli_config_unset"
1700
+    commands=()
1701
+
1702
+    flags=()
1703
+    two_word_flags=()
1704
+    flags_with_completion=()
1705
+    flags_completion=()
1706
+
1707
+    flags+=("--help")
1708
+    flags+=("-h")
1709
+
1710
+    must_have_one_flag=()
1711
+    must_have_one_noun=()
1712
+}
1713
+
1714
+_openshift_cli_config_use-context()
1715
+{
1716
+    last_command="openshift_cli_config_use-context"
1717
+    commands=()
1718
+
1719
+    flags=()
1720
+    two_word_flags=()
1721
+    flags_with_completion=()
1722
+    flags_completion=()
1723
+
1724
+    flags+=("--help")
1725
+    flags+=("-h")
1726
+
1727
+    must_have_one_flag=()
1728
+    must_have_one_noun=()
1729
+}
1730
+
1731
+_openshift_cli_config()
1732
+{
1733
+    last_command="openshift_cli_config"
1734
+    commands=()
1735
+    commands+=("view")
1736
+    commands+=("set-cluster")
1737
+    commands+=("set-credentials")
1738
+    commands+=("set-context")
1739
+    commands+=("set")
1740
+    commands+=("unset")
1741
+    commands+=("use-context")
1742
+
1743
+    flags=()
1744
+    two_word_flags=()
1745
+    flags_with_completion=()
1746
+    flags_completion=()
1747
+
1748
+    flags+=("--config=")
1749
+    flags+=("--help")
1750
+    flags+=("-h")
1751
+
1752
+    must_have_one_flag=()
1753
+    must_have_one_noun=()
1754
+}
1755
+
1756
+_openshift_cli_options()
1757
+{
1758
+    last_command="openshift_cli_options"
1759
+    commands=()
1760
+
1761
+    flags=()
1762
+    two_word_flags=()
1763
+    flags_with_completion=()
1764
+    flags_completion=()
1765
+
1766
+    flags+=("--help")
1767
+    flags+=("-h")
1768
+
1769
+    must_have_one_flag=()
1770
+    must_have_one_noun=()
1771
+}
1772
+
1773
+_openshift_cli()
1774
+{
1775
+    last_command="openshift_cli"
1776
+    commands=()
1777
+    commands+=("login")
1778
+    commands+=("logout")
1779
+    commands+=("project")
1780
+    commands+=("new-project")
1781
+    commands+=("new-app")
1782
+    commands+=("status")
1783
+    commands+=("start-build")
1784
+    commands+=("cancel-build")
1785
+    commands+=("build-logs")
1786
+    commands+=("deploy")
1787
+    commands+=("rollback")
1788
+    commands+=("get")
1789
+    commands+=("describe")
1790
+    commands+=("create")
1791
+    commands+=("process")
1792
+    commands+=("edit")
1793
+    commands+=("update")
1794
+    commands+=("delete")
1795
+    commands+=("log")
1796
+    commands+=("exec")
1797
+    commands+=("port-forward")
1798
+    commands+=("proxy")
1799
+    commands+=("config")
1800
+    commands+=("options")
1801
+
1802
+    flags=()
1803
+    two_word_flags=()
1804
+    flags_with_completion=()
1805
+    flags_completion=()
1806
+
1807
+    flags+=("--allow_dynamic_housekeeping")
1808
+    flags+=("--alsologtostderr")
1809
+    flags+=("--api-version=")
1810
+    flags+=("--auth-path=")
1811
+    flags+=("--boot_id_file=")
1812
+    flags+=("--certificate-authority=")
1813
+    flags+=("--client-certificate=")
1814
+    flags+=("--client-key=")
1815
+    flags+=("--cluster=")
1816
+    flags+=("--config=")
1817
+    flags+=("--container_hints=")
1818
+    flags+=("--context=")
1819
+    flags+=("--docker=")
1820
+    flags+=("--docker_root=")
1821
+    flags+=("--docker_run=")
1822
+    flags+=("--enable_load_reader")
1823
+    flags+=("--global_housekeeping_interval=")
1824
+    flags+=("--google-json-key=")
1825
+    flags+=("--help")
1826
+    flags+=("-h")
1827
+    flags+=("--housekeeping_interval=")
1828
+    flags+=("--httptest.serve=")
1829
+    flags+=("--insecure-skip-tls-verify")
1830
+    flags+=("--log_backtrace_at=")
1831
+    flags+=("--log_cadvisor_usage")
1832
+    flags+=("--log_dir=")
1833
+    flags+=("--log_flush_frequency=")
1834
+    flags+=("--logtostderr")
1835
+    flags+=("--machine_id_file=")
1836
+    flags+=("--match-server-version")
1837
+    flags+=("--max_housekeeping_interval=")
1838
+    flags+=("--namespace=")
1839
+    two_word_flags+=("-n")
1840
+    flags+=("--server=")
1841
+    flags+=("--stderrthreshold=")
1842
+    flags+=("--token=")
1843
+    flags+=("--user=")
1844
+    flags+=("--v=")
1845
+    flags+=("--validate")
1846
+    flags+=("--vmodule=")
1847
+
1848
+    must_have_one_flag=()
1849
+    must_have_one_noun=()
1850
+}
1851
+
1852
+_openshift_kube_get()
1853
+{
1854
+    last_command="openshift_kube_get"
1855
+    commands=()
1856
+
1857
+    flags=()
1858
+    two_word_flags=()
1859
+    flags_with_completion=()
1860
+    flags_completion=()
1861
+
1862
+    flags+=("--help")
1863
+    flags+=("-h")
1864
+    flags+=("--no-headers")
1865
+    flags+=("--output=")
1866
+    two_word_flags+=("-o")
1867
+    flags+=("--output-version=")
1868
+    flags+=("--selector=")
1869
+    two_word_flags+=("-l")
1870
+    flags+=("--template=")
1871
+    two_word_flags+=("-t")
1872
+    flags+=("--watch")
1873
+    flags+=("-w")
1874
+    flags+=("--watch-only")
1875
+
1876
+    must_have_one_flag=()
1877
+    must_have_one_noun=()
1878
+    must_have_one_noun+=("componentstatus")
1879
+    must_have_one_noun+=("endpoints")
1880
+    must_have_one_noun+=("event")
1881
+    must_have_one_noun+=("limitrange")
1882
+    must_have_one_noun+=("namespace")
1883
+    must_have_one_noun+=("node")
1884
+    must_have_one_noun+=("persistentvolume")
1885
+    must_have_one_noun+=("persistentvolumeclaim")
1886
+    must_have_one_noun+=("pod")
1887
+    must_have_one_noun+=("podtemplate")
1888
+    must_have_one_noun+=("replicationcontroller")
1889
+    must_have_one_noun+=("resourcequota")
1890
+    must_have_one_noun+=("secret")
1891
+    must_have_one_noun+=("service")
1892
+    must_have_one_noun+=("status")
1893
+}
1894
+
1895
+_openshift_kube_describe()
1896
+{
1897
+    last_command="openshift_kube_describe"
1898
+    commands=()
1899
+
1900
+    flags=()
1901
+    two_word_flags=()
1902
+    flags_with_completion=()
1903
+    flags_completion=()
1904
+
1905
+    flags+=("--help")
1906
+    flags+=("-h")
1907
+
1908
+    must_have_one_flag=()
1909
+    must_have_one_noun=()
1910
+    must_have_one_noun+=("limitrange")
1911
+    must_have_one_noun+=("minion")
1912
+    must_have_one_noun+=("node")
1913
+    must_have_one_noun+=("persistentvolume")
1914
+    must_have_one_noun+=("persistentvolumeclaim")
1915
+    must_have_one_noun+=("pod")
1916
+    must_have_one_noun+=("replicationcontroller")
1917
+    must_have_one_noun+=("resourcequota")
1918
+    must_have_one_noun+=("service")
1919
+}
1920
+
1921
+_openshift_kube_create()
1922
+{
1923
+    last_command="openshift_kube_create"
1924
+    commands=()
1925
+
1926
+    flags=()
1927
+    two_word_flags=()
1928
+    flags_with_completion=()
1929
+    flags_completion=()
1930
+
1931
+    flags+=("--filename=")
1932
+    flags_with_completion+=("--filename")
1933
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1934
+    two_word_flags+=("-f")
1935
+    flags_with_completion+=("-f")
1936
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1937
+    flags+=("--help")
1938
+    flags+=("-h")
1939
+
1940
+    must_have_one_flag=()
1941
+    must_have_one_flag+=("--filename=")
1942
+    must_have_one_flag+=("-f")
1943
+    must_have_one_noun=()
1944
+}
1945
+
1946
+_openshift_kube_update()
1947
+{
1948
+    last_command="openshift_kube_update"
1949
+    commands=()
1950
+
1951
+    flags=()
1952
+    two_word_flags=()
1953
+    flags_with_completion=()
1954
+    flags_completion=()
1955
+
1956
+    flags+=("--filename=")
1957
+    flags_with_completion+=("--filename")
1958
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1959
+    two_word_flags+=("-f")
1960
+    flags_with_completion+=("-f")
1961
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1962
+    flags+=("--help")
1963
+    flags+=("-h")
1964
+    flags+=("--patch=")
1965
+
1966
+    must_have_one_flag=()
1967
+    must_have_one_flag+=("--filename=")
1968
+    must_have_one_flag+=("-f")
1969
+    must_have_one_flag+=("--patch=")
1970
+    must_have_one_noun=()
1971
+}
1972
+
1973
+_openshift_kube_delete()
1974
+{
1975
+    last_command="openshift_kube_delete"
1976
+    commands=()
1977
+
1978
+    flags=()
1979
+    two_word_flags=()
1980
+    flags_with_completion=()
1981
+    flags_completion=()
1982
+
1983
+    flags+=("--all")
1984
+    flags+=("--cascade")
1985
+    flags+=("--filename=")
1986
+    flags_with_completion+=("--filename")
1987
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1988
+    two_word_flags+=("-f")
1989
+    flags_with_completion+=("-f")
1990
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
1991
+    flags+=("--grace-period=")
1992
+    flags+=("--help")
1993
+    flags+=("-h")
1994
+    flags+=("--selector=")
1995
+    two_word_flags+=("-l")
1996
+
1997
+    must_have_one_flag=()
1998
+    must_have_one_noun=()
1999
+}
2000
+
2001
+_openshift_kube_namespace()
2002
+{
2003
+    last_command="openshift_kube_namespace"
2004
+    commands=()
2005
+
2006
+    flags=()
2007
+    two_word_flags=()
2008
+    flags_with_completion=()
2009
+    flags_completion=()
2010
+
2011
+    flags+=("--help")
2012
+    flags+=("-h")
2013
+
2014
+    must_have_one_flag=()
2015
+    must_have_one_noun=()
2016
+}
2017
+
2018
+_openshift_kube_log()
2019
+{
2020
+    last_command="openshift_kube_log"
2021
+    commands=()
2022
+
2023
+    flags=()
2024
+    two_word_flags=()
2025
+    flags_with_completion=()
2026
+    flags_completion=()
2027
+
2028
+    flags+=("--follow")
2029
+    flags+=("-f")
2030
+    flags+=("--help")
2031
+    flags+=("-h")
2032
+    flags+=("--interactive")
2033
+
2034
+    must_have_one_flag=()
2035
+    must_have_one_noun=()
2036
+}
2037
+
2038
+_openshift_kube_rolling-update()
2039
+{
2040
+    last_command="openshift_kube_rolling-update"
2041
+    commands=()
2042
+
2043
+    flags=()
2044
+    two_word_flags=()
2045
+    flags_with_completion=()
2046
+    flags_completion=()
2047
+
2048
+    flags+=("--deployment-label-key=")
2049
+    flags+=("--dry-run")
2050
+    flags+=("--filename=")
2051
+    two_word_flags+=("-f")
2052
+    flags+=("--help")
2053
+    flags+=("-h")
2054
+    flags+=("--image=")
2055
+    flags+=("--no-headers")
2056
+    flags+=("--output=")
2057
+    two_word_flags+=("-o")
2058
+    flags+=("--output-version=")
2059
+    flags+=("--poll-interval=")
2060
+    flags+=("--template=")
2061
+    two_word_flags+=("-t")
2062
+    flags+=("--timeout=")
2063
+    flags+=("--update-period=")
2064
+
2065
+    must_have_one_flag=()
2066
+    must_have_one_noun=()
2067
+}
2068
+
2069
+_openshift_kube_resize()
2070
+{
2071
+    last_command="openshift_kube_resize"
2072
+    commands=()
2073
+
2074
+    flags=()
2075
+    two_word_flags=()
2076
+    flags_with_completion=()
2077
+    flags_completion=()
2078
+
2079
+    flags+=("--current-replicas=")
2080
+    flags+=("--help")
2081
+    flags+=("-h")
2082
+    flags+=("--replicas=")
2083
+    flags+=("--resource-version=")
2084
+
2085
+    must_have_one_flag=()
2086
+    must_have_one_flag+=("--replicas=")
2087
+    must_have_one_noun=()
2088
+}
2089
+
2090
+_openshift_kube_exec()
2091
+{
2092
+    last_command="openshift_kube_exec"
2093
+    commands=()
2094
+
2095
+    flags=()
2096
+    two_word_flags=()
2097
+    flags_with_completion=()
2098
+    flags_completion=()
2099
+
2100
+    flags+=("--container=")
2101
+    two_word_flags+=("-c")
2102
+    flags+=("--help")
2103
+    flags+=("-h")
2104
+    flags+=("--pod=")
2105
+    two_word_flags+=("-p")
2106
+    flags+=("--stdin")
2107
+    flags+=("-i")
2108
+    flags+=("--tty")
2109
+    flags+=("-t")
2110
+
2111
+    must_have_one_flag=()
2112
+    must_have_one_flag+=("--container=")
2113
+    must_have_one_flag+=("-c")
2114
+    must_have_one_flag+=("--pod=")
2115
+    must_have_one_flag+=("-p")
2116
+    must_have_one_noun=()
2117
+}
2118
+
2119
+_openshift_kube_port-forward()
2120
+{
2121
+    last_command="openshift_kube_port-forward"
2122
+    commands=()
2123
+
2124
+    flags=()
2125
+    two_word_flags=()
2126
+    flags_with_completion=()
2127
+    flags_completion=()
2128
+
2129
+    flags+=("--help")
2130
+    flags+=("-h")
2131
+    flags+=("--pod=")
2132
+    two_word_flags+=("-p")
2133
+
2134
+    must_have_one_flag=()
2135
+    must_have_one_flag+=("--pod=")
2136
+    must_have_one_flag+=("-p")
2137
+    must_have_one_noun=()
2138
+}
2139
+
2140
+_openshift_kube_proxy()
2141
+{
2142
+    last_command="openshift_kube_proxy"
2143
+    commands=()
2144
+
2145
+    flags=()
2146
+    two_word_flags=()
2147
+    flags_with_completion=()
2148
+    flags_completion=()
2149
+
2150
+    flags+=("--api-prefix=")
2151
+    flags+=("--help")
2152
+    flags+=("-h")
2153
+    flags+=("--port=")
2154
+    two_word_flags+=("-p")
2155
+    flags+=("--www=")
2156
+    two_word_flags+=("-w")
2157
+    flags+=("--www-prefix=")
2158
+    two_word_flags+=("-P")
2159
+
2160
+    must_have_one_flag=()
2161
+    must_have_one_noun=()
2162
+}
2163
+
2164
+_openshift_kube_run-container()
2165
+{
2166
+    last_command="openshift_kube_run-container"
2167
+    commands=()
2168
+
2169
+    flags=()
2170
+    two_word_flags=()
2171
+    flags_with_completion=()
2172
+    flags_completion=()
2173
+
2174
+    flags+=("--dry-run")
2175
+    flags+=("--generator=")
2176
+    flags+=("--help")
2177
+    flags+=("-h")
2178
+    flags+=("--hostport=")
2179
+    flags+=("--image=")
2180
+    flags+=("--labels=")
2181
+    two_word_flags+=("-l")
2182
+    flags+=("--no-headers")
2183
+    flags+=("--output=")
2184
+    two_word_flags+=("-o")
2185
+    flags+=("--output-version=")
2186
+    flags+=("--overrides=")
2187
+    flags+=("--port=")
2188
+    flags+=("--replicas=")
2189
+    two_word_flags+=("-r")
2190
+    flags+=("--template=")
2191
+    two_word_flags+=("-t")
2192
+
2193
+    must_have_one_flag=()
2194
+    must_have_one_flag+=("--image=")
2195
+    must_have_one_noun=()
2196
+}
2197
+
2198
+_openshift_kube_stop()
2199
+{
2200
+    last_command="openshift_kube_stop"
2201
+    commands=()
2202
+
2203
+    flags=()
2204
+    two_word_flags=()
2205
+    flags_with_completion=()
2206
+    flags_completion=()
2207
+
2208
+    flags+=("--all")
2209
+    flags+=("--filename=")
2210
+    flags_with_completion+=("--filename")
2211
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
2212
+    two_word_flags+=("-f")
2213
+    flags_with_completion+=("-f")
2214
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
2215
+    flags+=("--grace-period=")
2216
+    flags+=("--help")
2217
+    flags+=("-h")
2218
+    flags+=("--selector=")
2219
+    two_word_flags+=("-l")
2220
+
2221
+    must_have_one_flag=()
2222
+    must_have_one_noun=()
2223
+}
2224
+
2225
+_openshift_kube_expose()
2226
+{
2227
+    last_command="openshift_kube_expose"
2228
+    commands=()
2229
+
2230
+    flags=()
2231
+    two_word_flags=()
2232
+    flags_with_completion=()
2233
+    flags_completion=()
2234
+
2235
+    flags+=("--container-port=")
2236
+    flags+=("--create-external-load-balancer")
2237
+    flags+=("--dry-run")
2238
+    flags+=("--generator=")
2239
+    flags+=("--help")
2240
+    flags+=("-h")
2241
+    flags+=("--labels=")
2242
+    two_word_flags+=("-l")
2243
+    flags+=("--no-headers")
2244
+    flags+=("--output=")
2245
+    two_word_flags+=("-o")
2246
+    flags+=("--output-version=")
2247
+    flags+=("--overrides=")
2248
+    flags+=("--port=")
2249
+    flags+=("--protocol=")
2250
+    flags+=("--public-ip=")
2251
+    flags+=("--selector=")
2252
+    flags+=("--service-name=")
2253
+    flags+=("--target-port=")
2254
+    flags+=("--template=")
2255
+    two_word_flags+=("-t")
2256
+
2257
+    must_have_one_flag=()
2258
+    must_have_one_flag+=("--port=")
2259
+    must_have_one_noun=()
2260
+}
2261
+
2262
+_openshift_kube_label()
2263
+{
2264
+    last_command="openshift_kube_label"
2265
+    commands=()
2266
+
2267
+    flags=()
2268
+    two_word_flags=()
2269
+    flags_with_completion=()
2270
+    flags_completion=()
2271
+
2272
+    flags+=("--all")
2273
+    flags+=("--help")
2274
+    flags+=("-h")
2275
+    flags+=("--no-headers")
2276
+    flags+=("--output=")
2277
+    two_word_flags+=("-o")
2278
+    flags+=("--output-version=")
2279
+    flags+=("--overwrite")
2280
+    flags+=("--resource-version=")
2281
+    flags+=("--selector=")
2282
+    two_word_flags+=("-l")
2283
+    flags+=("--template=")
2284
+    two_word_flags+=("-t")
2285
+
2286
+    must_have_one_flag=()
2287
+    must_have_one_noun=()
2288
+}
2289
+
2290
+_openshift_kube_config_view()
2291
+{
2292
+    last_command="openshift_kube_config_view"
2293
+    commands=()
2294
+
2295
+    flags=()
2296
+    two_word_flags=()
2297
+    flags_with_completion=()
2298
+    flags_completion=()
2299
+
2300
+    flags+=("--flatten")
2301
+    flags+=("--help")
2302
+    flags+=("-h")
2303
+    flags+=("--merge")
2304
+    flags+=("--minify")
2305
+    flags+=("--no-headers")
2306
+    flags+=("--output=")
2307
+    two_word_flags+=("-o")
2308
+    flags+=("--output-version=")
2309
+    flags+=("--raw")
2310
+    flags+=("--template=")
2311
+    two_word_flags+=("-t")
2312
+
2313
+    must_have_one_flag=()
2314
+    must_have_one_noun=()
2315
+}
2316
+
2317
+_openshift_kube_config_set-cluster()
2318
+{
2319
+    last_command="openshift_kube_config_set-cluster"
2320
+    commands=()
2321
+
2322
+    flags=()
2323
+    two_word_flags=()
2324
+    flags_with_completion=()
2325
+    flags_completion=()
2326
+
2327
+    flags+=("--api-version=")
2328
+    flags+=("--certificate-authority=")
2329
+    flags+=("--embed-certs")
2330
+    flags+=("--help")
2331
+    flags+=("-h")
2332
+    flags+=("--insecure-skip-tls-verify")
2333
+    flags+=("--server=")
2334
+
2335
+    must_have_one_flag=()
2336
+    must_have_one_noun=()
2337
+}
2338
+
2339
+_openshift_kube_config_set-credentials()
2340
+{
2341
+    last_command="openshift_kube_config_set-credentials"
2342
+    commands=()
2343
+
2344
+    flags=()
2345
+    two_word_flags=()
2346
+    flags_with_completion=()
2347
+    flags_completion=()
2348
+
2349
+    flags+=("--auth-path=")
2350
+    flags+=("--client-certificate=")
2351
+    flags+=("--client-key=")
2352
+    flags+=("--embed-certs")
2353
+    flags+=("--help")
2354
+    flags+=("-h")
2355
+    flags+=("--password=")
2356
+    flags+=("--token=")
2357
+    flags+=("--username=")
2358
+
2359
+    must_have_one_flag=()
2360
+    must_have_one_noun=()
2361
+}
2362
+
2363
+_openshift_kube_config_set-context()
2364
+{
2365
+    last_command="openshift_kube_config_set-context"
2366
+    commands=()
2367
+
2368
+    flags=()
2369
+    two_word_flags=()
2370
+    flags_with_completion=()
2371
+    flags_completion=()
2372
+
2373
+    flags+=("--cluster=")
2374
+    flags+=("--help")
2375
+    flags+=("-h")
2376
+    flags+=("--namespace=")
2377
+    flags+=("--user=")
2378
+
2379
+    must_have_one_flag=()
2380
+    must_have_one_noun=()
2381
+}
2382
+
2383
+_openshift_kube_config_set()
2384
+{
2385
+    last_command="openshift_kube_config_set"
2386
+    commands=()
2387
+
2388
+    flags=()
2389
+    two_word_flags=()
2390
+    flags_with_completion=()
2391
+    flags_completion=()
2392
+
2393
+    flags+=("--help")
2394
+    flags+=("-h")
2395
+
2396
+    must_have_one_flag=()
2397
+    must_have_one_noun=()
2398
+}
2399
+
2400
+_openshift_kube_config_unset()
2401
+{
2402
+    last_command="openshift_kube_config_unset"
2403
+    commands=()
2404
+
2405
+    flags=()
2406
+    two_word_flags=()
2407
+    flags_with_completion=()
2408
+    flags_completion=()
2409
+
2410
+    flags+=("--help")
2411
+    flags+=("-h")
2412
+
2413
+    must_have_one_flag=()
2414
+    must_have_one_noun=()
2415
+}
2416
+
2417
+_openshift_kube_config_use-context()
2418
+{
2419
+    last_command="openshift_kube_config_use-context"
2420
+    commands=()
2421
+
2422
+    flags=()
2423
+    two_word_flags=()
2424
+    flags_with_completion=()
2425
+    flags_completion=()
2426
+
2427
+    flags+=("--help")
2428
+    flags+=("-h")
2429
+
2430
+    must_have_one_flag=()
2431
+    must_have_one_noun=()
2432
+}
2433
+
2434
+_openshift_kube_config()
2435
+{
2436
+    last_command="openshift_kube_config"
2437
+    commands=()
2438
+    commands+=("view")
2439
+    commands+=("set-cluster")
2440
+    commands+=("set-credentials")
2441
+    commands+=("set-context")
2442
+    commands+=("set")
2443
+    commands+=("unset")
2444
+    commands+=("use-context")
2445
+
2446
+    flags=()
2447
+    two_word_flags=()
2448
+    flags_with_completion=()
2449
+    flags_completion=()
2450
+
2451
+    flags+=("--help")
2452
+    flags+=("-h")
2453
+    flags+=("--kubeconfig=")
2454
+
2455
+    must_have_one_flag=()
2456
+    must_have_one_noun=()
2457
+}
2458
+
2459
+_openshift_kube_cluster-info()
2460
+{
2461
+    last_command="openshift_kube_cluster-info"
2462
+    commands=()
2463
+
2464
+    flags=()
2465
+    two_word_flags=()
2466
+    flags_with_completion=()
2467
+    flags_completion=()
2468
+
2469
+    flags+=("--help")
2470
+    flags+=("-h")
2471
+
2472
+    must_have_one_flag=()
2473
+    must_have_one_noun=()
2474
+}
2475
+
2476
+_openshift_kube_api-versions()
2477
+{
2478
+    last_command="openshift_kube_api-versions"
2479
+    commands=()
2480
+
2481
+    flags=()
2482
+    two_word_flags=()
2483
+    flags_with_completion=()
2484
+    flags_completion=()
2485
+
2486
+    flags+=("--help")
2487
+    flags+=("-h")
2488
+
2489
+    must_have_one_flag=()
2490
+    must_have_one_noun=()
2491
+}
2492
+
2493
+_openshift_kube_version()
2494
+{
2495
+    last_command="openshift_kube_version"
2496
+    commands=()
2497
+
2498
+    flags=()
2499
+    two_word_flags=()
2500
+    flags_with_completion=()
2501
+    flags_completion=()
2502
+
2503
+    flags+=("--client")
2504
+    flags+=("-c")
2505
+    flags+=("--help")
2506
+    flags+=("-h")
2507
+
2508
+    must_have_one_flag=()
2509
+    must_have_one_noun=()
2510
+}
2511
+
2512
+_openshift_kube_options()
2513
+{
2514
+    last_command="openshift_kube_options"
2515
+    commands=()
2516
+
2517
+    flags=()
2518
+    two_word_flags=()
2519
+    flags_with_completion=()
2520
+    flags_completion=()
2521
+
2522
+    flags+=("--help")
2523
+    flags+=("-h")
2524
+
2525
+    must_have_one_flag=()
2526
+    must_have_one_noun=()
2527
+}
2528
+
2529
+_openshift_kube()
2530
+{
2531
+    last_command="openshift_kube"
2532
+    commands=()
2533
+    commands+=("get")
2534
+    commands+=("describe")
2535
+    commands+=("create")
2536
+    commands+=("update")
2537
+    commands+=("delete")
2538
+    commands+=("namespace")
2539
+    commands+=("log")
2540
+    commands+=("rolling-update")
2541
+    commands+=("resize")
2542
+    commands+=("exec")
2543
+    commands+=("port-forward")
2544
+    commands+=("proxy")
2545
+    commands+=("run-container")
2546
+    commands+=("stop")
2547
+    commands+=("expose")
2548
+    commands+=("label")
2549
+    commands+=("config")
2550
+    commands+=("cluster-info")
2551
+    commands+=("api-versions")
2552
+    commands+=("version")
2553
+    commands+=("options")
2554
+
2555
+    flags=()
2556
+    two_word_flags=()
2557
+    flags_with_completion=()
2558
+    flags_completion=()
2559
+
2560
+    flags+=("--allow_dynamic_housekeeping")
2561
+    flags+=("--alsologtostderr")
2562
+    flags+=("--api-version=")
2563
+    flags+=("--auth-path=")
2564
+    flags+=("--boot_id_file=")
2565
+    flags+=("--certificate-authority=")
2566
+    flags+=("--client-certificate=")
2567
+    flags+=("--client-key=")
2568
+    flags+=("--cluster=")
2569
+    flags+=("--config=")
2570
+    flags+=("--container_hints=")
2571
+    flags+=("--context=")
2572
+    flags+=("--docker=")
2573
+    flags+=("--docker_root=")
2574
+    flags+=("--docker_run=")
2575
+    flags+=("--enable_load_reader")
2576
+    flags+=("--global_housekeeping_interval=")
2577
+    flags+=("--google-json-key=")
2578
+    flags+=("--help")
2579
+    flags+=("-h")
2580
+    flags+=("--housekeeping_interval=")
2581
+    flags+=("--httptest.serve=")
2582
+    flags+=("--insecure-skip-tls-verify")
2583
+    flags+=("--log_backtrace_at=")
2584
+    flags+=("--log_cadvisor_usage")
2585
+    flags+=("--log_dir=")
2586
+    flags+=("--log_flush_frequency=")
2587
+    flags+=("--logtostderr")
2588
+    flags+=("--machine_id_file=")
2589
+    flags+=("--match-server-version")
2590
+    flags+=("--max_housekeeping_interval=")
2591
+    flags+=("--namespace=")
2592
+    two_word_flags+=("-n")
2593
+    flags+=("--server=")
2594
+    flags+=("--stderrthreshold=")
2595
+    flags+=("--token=")
2596
+    flags+=("--user=")
2597
+    flags+=("--v=")
2598
+    flags+=("--validate")
2599
+    flags+=("--vmodule=")
2600
+
2601
+    must_have_one_flag=()
2602
+    must_have_one_noun=()
2603
+}
2604
+
2605
+_openshift_ex_tokens_validate-token()
2606
+{
2607
+    last_command="openshift_ex_tokens_validate-token"
2608
+    commands=()
2609
+
2610
+    flags=()
2611
+    two_word_flags=()
2612
+    flags_with_completion=()
2613
+    flags_completion=()
2614
+
2615
+    flags+=("--help")
2616
+    flags+=("-h")
2617
+    flags+=("--token=")
2618
+
2619
+    must_have_one_flag=()
2620
+    must_have_one_noun=()
2621
+}
2622
+
2623
+_openshift_ex_tokens_request-token()
2624
+{
2625
+    last_command="openshift_ex_tokens_request-token"
2626
+    commands=()
2627
+
2628
+    flags=()
2629
+    two_word_flags=()
2630
+    flags_with_completion=()
2631
+    flags_completion=()
2632
+
2633
+    flags+=("--help")
2634
+    flags+=("-h")
2635
+
2636
+    must_have_one_flag=()
2637
+    must_have_one_noun=()
2638
+}
2639
+
2640
+_openshift_ex_tokens_whoami()
2641
+{
2642
+    last_command="openshift_ex_tokens_whoami"
2643
+    commands=()
2644
+
2645
+    flags=()
2646
+    two_word_flags=()
2647
+    flags_with_completion=()
2648
+    flags_completion=()
2649
+
2650
+    flags+=("--help")
2651
+    flags+=("-h")
2652
+    flags+=("--token=")
2653
+
2654
+    must_have_one_flag=()
2655
+    must_have_one_noun=()
2656
+}
2657
+
2658
+_openshift_ex_tokens()
2659
+{
2660
+    last_command="openshift_ex_tokens"
2661
+    commands=()
2662
+    commands+=("validate-token")
2663
+    commands+=("request-token")
2664
+    commands+=("whoami")
2665
+
2666
+    flags=()
2667
+    two_word_flags=()
2668
+    flags_with_completion=()
2669
+    flags_completion=()
2670
+
2671
+    flags+=("--help")
2672
+    flags+=("-h")
2673
+
2674
+    must_have_one_flag=()
2675
+    must_have_one_noun=()
2676
+}
2677
+
2678
+_openshift_ex_ipfailover()
2679
+{
2680
+    last_command="openshift_ex_ipfailover"
2681
+    commands=()
2682
+
2683
+    flags=()
2684
+    two_word_flags=()
2685
+    flags_with_completion=()
2686
+    flags_completion=()
2687
+
2688
+    flags+=("--create")
2689
+    flags+=("--credentials=")
2690
+    flags+=("--help")
2691
+    flags+=("-h")
2692
+    flags+=("--images=")
2693
+    flags+=("--interface=")
2694
+    two_word_flags+=("-i")
2695
+    flags+=("--latest-images")
2696
+    flags+=("--no-headers")
2697
+    flags+=("--output=")
2698
+    two_word_flags+=("-o")
2699
+    flags+=("--output-version=")
2700
+    flags+=("--replicas=")
2701
+    two_word_flags+=("-r")
2702
+    flags+=("--selector=")
2703
+    two_word_flags+=("-l")
2704
+    flags+=("--template=")
2705
+    two_word_flags+=("-t")
2706
+    flags+=("--type=")
2707
+    flags+=("--virtual-ips=")
2708
+    flags+=("--watch-port=")
2709
+    two_word_flags+=("-w")
2710
+
2711
+    must_have_one_flag=()
2712
+    must_have_one_noun=()
2713
+}
2714
+
2715
+_openshift_ex_router()
2716
+{
2717
+    last_command="openshift_ex_router"
2718
+    commands=()
2719
+
2720
+    flags=()
2721
+    two_word_flags=()
2722
+    flags_with_completion=()
2723
+    flags_completion=()
2724
+
2725
+    flags+=("--create")
2726
+    flags+=("--credentials=")
2727
+    flags+=("--default-cert=")
2728
+    flags+=("--dry-run")
2729
+    flags+=("--help")
2730
+    flags+=("-h")
2731
+    flags+=("--images=")
2732
+    flags+=("--labels=")
2733
+    flags+=("--latest-images")
2734
+    flags+=("--no-headers")
2735
+    flags+=("--output=")
2736
+    two_word_flags+=("-o")
2737
+    flags+=("--output-version=")
2738
+    flags+=("--ports=")
2739
+    flags+=("--replicas=")
2740
+    flags+=("--template=")
2741
+    two_word_flags+=("-t")
2742
+    flags+=("--type=")
2743
+
2744
+    must_have_one_flag=()
2745
+    must_have_one_noun=()
2746
+}
2747
+
2748
+_openshift_ex_registry()
2749
+{
2750
+    last_command="openshift_ex_registry"
2751
+    commands=()
2752
+
2753
+    flags=()
2754
+    two_word_flags=()
2755
+    flags_with_completion=()
2756
+    flags_completion=()
2757
+
2758
+    flags+=("--create")
2759
+    flags+=("--credentials=")
2760
+    flags+=("--dry-run")
2761
+    flags+=("--help")
2762
+    flags+=("-h")
2763
+    flags+=("--images=")
2764
+    flags+=("--labels=")
2765
+    flags+=("--latest-images")
2766
+    flags+=("--mount-host=")
2767
+    flags+=("--no-headers")
2768
+    flags+=("--output=")
2769
+    two_word_flags+=("-o")
2770
+    flags+=("--output-version=")
2771
+    flags+=("--ports=")
2772
+    flags+=("--replicas=")
2773
+    flags+=("--template=")
2774
+    two_word_flags+=("-t")
2775
+    flags+=("--type=")
2776
+    flags+=("--volume=")
2777
+
2778
+    must_have_one_flag=()
2779
+    must_have_one_noun=()
2780
+}
2781
+
2782
+_openshift_ex_build-chain()
2783
+{
2784
+    last_command="openshift_ex_build-chain"
2785
+    commands=()
2786
+
2787
+    flags=()
2788
+    two_word_flags=()
2789
+    flags_with_completion=()
2790
+    flags_completion=()
2791
+
2792
+    flags+=("--all")
2793
+    flags+=("--all-tags")
2794
+    flags+=("--help")
2795
+    flags+=("-h")
2796
+    flags+=("--output=")
2797
+    two_word_flags+=("-o")
2798
+
2799
+    must_have_one_flag=()
2800
+    must_have_one_noun=()
2801
+}
2802
+
2803
+_openshift_ex_bundle-secret()
2804
+{
2805
+    last_command="openshift_ex_bundle-secret"
2806
+    commands=()
2807
+
2808
+    flags=()
2809
+    two_word_flags=()
2810
+    flags_with_completion=()
2811
+    flags_completion=()
2812
+
2813
+    flags+=("--help")
2814
+    flags+=("-h")
2815
+    flags+=("--no-headers")
2816
+    flags+=("--output=")
2817
+    two_word_flags+=("-o")
2818
+    flags+=("--output-version=")
2819
+    flags+=("--quiet")
2820
+    flags+=("-q")
2821
+    flags+=("--source=")
2822
+    two_word_flags+=("-f")
2823
+    flags+=("--template=")
2824
+    two_word_flags+=("-t")
2825
+
2826
+    must_have_one_flag=()
2827
+    must_have_one_noun=()
2828
+}
2829
+
2830
+_openshift_ex_options()
2831
+{
2832
+    last_command="openshift_ex_options"
2833
+    commands=()
2834
+
2835
+    flags=()
2836
+    two_word_flags=()
2837
+    flags_with_completion=()
2838
+    flags_completion=()
2839
+
2840
+    flags+=("--help")
2841
+    flags+=("-h")
2842
+
2843
+    must_have_one_flag=()
2844
+    must_have_one_noun=()
2845
+}
2846
+
2847
+_openshift_ex()
2848
+{
2849
+    last_command="openshift_ex"
2850
+    commands=()
2851
+    commands+=("tokens")
2852
+    commands+=("ipfailover")
2853
+    commands+=("router")
2854
+    commands+=("registry")
2855
+    commands+=("build-chain")
2856
+    commands+=("bundle-secret")
2857
+    commands+=("options")
2858
+
2859
+    flags=()
2860
+    two_word_flags=()
2861
+    flags_with_completion=()
2862
+    flags_completion=()
2863
+
2864
+    flags+=("--allow_dynamic_housekeeping")
2865
+    flags+=("--alsologtostderr")
2866
+    flags+=("--api-version=")
2867
+    flags+=("--auth-path=")
2868
+    flags+=("--boot_id_file=")
2869
+    flags+=("--certificate-authority=")
2870
+    flags+=("--client-certificate=")
2871
+    flags+=("--client-key=")
2872
+    flags+=("--cluster=")
2873
+    flags+=("--config=")
2874
+    flags+=("--container_hints=")
2875
+    flags+=("--context=")
2876
+    flags+=("--docker=")
2877
+    flags+=("--docker_root=")
2878
+    flags+=("--docker_run=")
2879
+    flags+=("--enable_load_reader")
2880
+    flags+=("--global_housekeeping_interval=")
2881
+    flags+=("--google-json-key=")
2882
+    flags+=("--help")
2883
+    flags+=("-h")
2884
+    flags+=("--housekeeping_interval=")
2885
+    flags+=("--httptest.serve=")
2886
+    flags+=("--insecure-skip-tls-verify")
2887
+    flags+=("--log_backtrace_at=")
2888
+    flags+=("--log_cadvisor_usage")
2889
+    flags+=("--log_dir=")
2890
+    flags+=("--log_flush_frequency=")
2891
+    flags+=("--logtostderr")
2892
+    flags+=("--machine_id_file=")
2893
+    flags+=("--match-server-version")
2894
+    flags+=("--max_housekeeping_interval=")
2895
+    flags+=("--namespace=")
2896
+    two_word_flags+=("-n")
2897
+    flags+=("--server=")
2898
+    flags+=("--stderrthreshold=")
2899
+    flags+=("--token=")
2900
+    flags+=("--user=")
2901
+    flags+=("--v=")
2902
+    flags+=("--validate")
2903
+    flags+=("--vmodule=")
2904
+
2905
+    must_have_one_flag=()
2906
+    must_have_one_noun=()
2907
+}
2908
+
2909
+_openshift_version()
2910
+{
2911
+    last_command="openshift_version"
2912
+    commands=()
2913
+
2914
+    flags=()
2915
+    two_word_flags=()
2916
+    flags_with_completion=()
2917
+    flags_completion=()
2918
+
2919
+    flags+=("--help")
2920
+    flags+=("-h")
2921
+
2922
+    must_have_one_flag=()
2923
+    must_have_one_noun=()
2924
+}
2925
+
2926
+_openshift_infra_router_version()
2927
+{
2928
+    last_command="openshift_infra_router_version"
2929
+    commands=()
2930
+
2931
+    flags=()
2932
+    two_word_flags=()
2933
+    flags_with_completion=()
2934
+    flags_completion=()
2935
+
2936
+    flags+=("--help")
2937
+    flags+=("-h")
2938
+
2939
+    must_have_one_flag=()
2940
+    must_have_one_noun=()
2941
+}
2942
+
2943
+_openshift_infra_router()
2944
+{
2945
+    last_command="openshift_infra_router"
2946
+    commands=()
2947
+    commands+=("version")
2948
+
2949
+    flags=()
2950
+    two_word_flags=()
2951
+    flags_with_completion=()
2952
+    flags_completion=()
2953
+
2954
+    flags+=("--certificate-authority=")
2955
+    flags+=("--client-certificate=")
2956
+    flags+=("--client-key=")
2957
+    flags+=("--help")
2958
+    flags+=("-h")
2959
+    flags+=("--insecure-skip-tls-verify")
2960
+    flags+=("--kubernetes=")
2961
+    flags+=("--master=")
2962
+    flags+=("--reload=")
2963
+    flags+=("--template=")
2964
+    flags+=("--token=")
2965
+
2966
+    must_have_one_flag=()
2967
+    must_have_one_noun=()
2968
+}
2969
+
2970
+_openshift_infra_deploy_version()
2971
+{
2972
+    last_command="openshift_infra_deploy_version"
2973
+    commands=()
2974
+
2975
+    flags=()
2976
+    two_word_flags=()
2977
+    flags_with_completion=()
2978
+    flags_completion=()
2979
+
2980
+    flags+=("--help")
2981
+    flags+=("-h")
2982
+
2983
+    must_have_one_flag=()
2984
+    must_have_one_noun=()
2985
+}
2986
+
2987
+_openshift_infra_deploy()
2988
+{
2989
+    last_command="openshift_infra_deploy"
2990
+    commands=()
2991
+    commands+=("version")
2992
+
2993
+    flags=()
2994
+    two_word_flags=()
2995
+    flags_with_completion=()
2996
+    flags_completion=()
2997
+
2998
+    flags+=("--certificate-authority=")
2999
+    flags+=("--client-certificate=")
3000
+    flags+=("--client-key=")
3001
+    flags+=("--deployment=")
3002
+    flags+=("--help")
3003
+    flags+=("-h")
3004
+    flags+=("--insecure-skip-tls-verify")
3005
+    flags+=("--kubernetes=")
3006
+    flags+=("--master=")
3007
+    flags+=("--namespace=")
3008
+    flags+=("--token=")
3009
+
3010
+    must_have_one_flag=()
3011
+    must_have_one_noun=()
3012
+}
3013
+
3014
+_openshift_infra_sti-build_version()
3015
+{
3016
+    last_command="openshift_infra_sti-build_version"
3017
+    commands=()
3018
+
3019
+    flags=()
3020
+    two_word_flags=()
3021
+    flags_with_completion=()
3022
+    flags_completion=()
3023
+
3024
+    flags+=("--help")
3025
+    flags+=("-h")
3026
+
3027
+    must_have_one_flag=()
3028
+    must_have_one_noun=()
3029
+}
3030
+
3031
+_openshift_infra_sti-build()
3032
+{
3033
+    last_command="openshift_infra_sti-build"
3034
+    commands=()
3035
+    commands+=("version")
3036
+
3037
+    flags=()
3038
+    two_word_flags=()
3039
+    flags_with_completion=()
3040
+    flags_completion=()
3041
+
3042
+    flags+=("--help")
3043
+    flags+=("-h")
3044
+
3045
+    must_have_one_flag=()
3046
+    must_have_one_noun=()
3047
+}
3048
+
3049
+_openshift_infra_docker-build_version()
3050
+{
3051
+    last_command="openshift_infra_docker-build_version"
3052
+    commands=()
3053
+
3054
+    flags=()
3055
+    two_word_flags=()
3056
+    flags_with_completion=()
3057
+    flags_completion=()
3058
+
3059
+    flags+=("--help")
3060
+    flags+=("-h")
3061
+
3062
+    must_have_one_flag=()
3063
+    must_have_one_noun=()
3064
+}
3065
+
3066
+_openshift_infra_docker-build()
3067
+{
3068
+    last_command="openshift_infra_docker-build"
3069
+    commands=()
3070
+    commands+=("version")
3071
+
3072
+    flags=()
3073
+    two_word_flags=()
3074
+    flags_with_completion=()
3075
+    flags_completion=()
3076
+
3077
+    flags+=("--help")
3078
+    flags+=("-h")
3079
+
3080
+    must_have_one_flag=()
3081
+    must_have_one_noun=()
3082
+}
3083
+
3084
+_openshift_infra()
3085
+{
3086
+    last_command="openshift_infra"
3087
+    commands=()
3088
+    commands+=("router")
3089
+    commands+=("deploy")
3090
+    commands+=("sti-build")
3091
+    commands+=("docker-build")
3092
+
3093
+    flags=()
3094
+    two_word_flags=()
3095
+    flags_with_completion=()
3096
+    flags_completion=()
3097
+
3098
+    flags+=("--help")
3099
+    flags+=("-h")
3100
+
3101
+    must_have_one_flag=()
3102
+    must_have_one_noun=()
3103
+}
3104
+
3105
+_openshift()
3106
+{
3107
+    last_command="openshift"
3108
+    commands=()
3109
+    commands+=("start")
3110
+    commands+=("admin")
3111
+    commands+=("cli")
3112
+    commands+=("kube")
3113
+    commands+=("ex")
3114
+    commands+=("version")
3115
+    commands+=("infra")
3116
+
3117
+    flags=()
3118
+    two_word_flags=()
3119
+    flags_with_completion=()
3120
+    flags_completion=()
3121
+
3122
+    flags+=("--google-json-key=")
3123
+    flags+=("--help")
3124
+    flags+=("-h")
3125
+    flags+=("--log_flush_frequency=")
3126
+
3127
+    must_have_one_flag=()
3128
+    must_have_one_noun=()
3129
+}
3130
+
3131
+__start_openshift()
3132
+{
3133
+    local cur prev words cword
3134
+    _init_completion -s || return
3135
+
3136
+    local c=0
3137
+    local flags=()
3138
+    local two_word_flags=()
3139
+    local flags_with_completion=()
3140
+    local flags_completion=()
3141
+    local commands=("openshift")
3142
+    local must_have_one_flag=()
3143
+    local must_have_one_noun=()
3144
+    local last_command
3145
+    local nouns=()
3146
+
3147
+    __handle_word
3148
+}
3149
+
3150
+complete -F __start_openshift openshift
3151
+# ex: ts=4 sw=4 et filetype=sh
0 3152
new file mode 100644
... ...
@@ -0,0 +1,930 @@
0
+#!/bin/bash
1
+
2
+
3
+__debug()
4
+{
5
+    if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
6
+        echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
7
+    fi
8
+}
9
+
10
+__index_of_word()
11
+{
12
+    local w word=$1
13
+    shift
14
+    index=0
15
+    for w in "$@"; do
16
+        [[ $w = "$word" ]] && return
17
+        index=$((index+1))
18
+    done
19
+    index=-1
20
+}
21
+
22
+__contains_word()
23
+{
24
+    local w word=$1; shift
25
+    for w in "$@"; do
26
+        [[ $w = "$word" ]] && return
27
+    done
28
+    return 1
29
+}
30
+
31
+__handle_reply()
32
+{
33
+    __debug "${FUNCNAME}"
34
+    case $cur in
35
+        -*)
36
+            compopt -o nospace
37
+            local allflags
38
+            if [ ${#must_have_one_flag[@]} -ne 0 ]; then
39
+                allflags=("${must_have_one_flag[@]}")
40
+            else
41
+                allflags=("${flags[*]} ${two_word_flags[*]}")
42
+            fi
43
+            COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
44
+            [[ $COMPREPLY == *= ]] || compopt +o nospace
45
+            return 0;
46
+            ;;
47
+    esac
48
+
49
+    # check if we are handling a flag with special work handling
50
+    local index
51
+    __index_of_word "${prev}" "${flags_with_completion[@]}"
52
+    if [[ ${index} -ge 0 ]]; then
53
+        ${flags_completion[${index}]}
54
+        return
55
+    fi
56
+
57
+    # we are parsing a flag and don't have a special handler, no completion
58
+    if [[ ${cur} != "${words[cword]}" ]]; then
59
+        return
60
+    fi
61
+
62
+    local completions
63
+    if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
64
+        completions=("${must_have_one_flag[@]}")
65
+    elif [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
66
+        completions=("${must_have_one_noun[@]}")
67
+    else
68
+        completions=("${commands[@]}")
69
+    fi
70
+    COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
71
+
72
+    if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
73
+        declare -F __custom_func >/dev/null && __custom_func
74
+    fi
75
+}
76
+
77
+# The arguments should be in the form "ext1|ext2|extn"
78
+__handle_filename_extension_flag()
79
+{
80
+    local ext="$1"
81
+    _filedir "@(${ext})"
82
+}
83
+
84
+__handle_flag()
85
+{
86
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
87
+
88
+    # if a command required a flag, and we found it, unset must_have_one_flag()
89
+    local flagname=${words[c]}
90
+    # if the word contained an =
91
+    if [[ ${words[c]} == *"="* ]]; then
92
+        flagname=${flagname%=*} # strip everything after the =
93
+        flagname="${flagname}=" # but put the = back
94
+    fi
95
+    __debug "${FUNCNAME}: looking for ${flagname}"
96
+    if __contains_word "${flagname}" "${must_have_one_flag[@]}"; then
97
+        must_have_one_flag=()
98
+    fi
99
+
100
+    # skip the argument to a two word flag
101
+    if __contains_word "${words[c]}" "${two_word_flags[@]}"; then
102
+        c=$((c+1))
103
+        # if we are looking for a flags value, don't show commands
104
+        if [[ $c -eq $cword ]]; then
105
+            commands=()
106
+        fi
107
+    fi
108
+
109
+    # skip the flag itself
110
+    c=$((c+1))
111
+
112
+}
113
+
114
+__handle_noun()
115
+{
116
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
117
+
118
+    if __contains_word "${words[c]}" "${must_have_one_noun[@]}"; then
119
+        must_have_one_noun=()
120
+    fi
121
+
122
+    nouns+=("${words[c]}")
123
+    c=$((c+1))
124
+}
125
+
126
+__handle_command()
127
+{
128
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
129
+
130
+    local next_command
131
+    if [[ -n ${last_command} ]]; then
132
+        next_command="_${last_command}_${words[c]}"
133
+    else
134
+        next_command="_${words[c]}"
135
+    fi
136
+    c=$((c+1))
137
+    __debug "${FUNCNAME}: looking for ${next_command}"
138
+    declare -F $next_command >/dev/null && $next_command
139
+}
140
+
141
+__handle_word()
142
+{
143
+    if [[ $c -ge $cword ]]; then
144
+        __handle_reply
145
+	return
146
+    fi
147
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
148
+    if [[ "${words[c]}" == -* ]]; then
149
+	__handle_flag
150
+    elif __contains_word "${words[c]}" "${commands[@]}"; then
151
+        __handle_command
152
+    else
153
+        __handle_noun
154
+    fi
155
+    __handle_word
156
+}
157
+
158
+_osadm_new-project()
159
+{
160
+    last_command="osadm_new-project"
161
+    commands=()
162
+
163
+    flags=()
164
+    two_word_flags=()
165
+    flags_with_completion=()
166
+    flags_completion=()
167
+
168
+    flags+=("--admin=")
169
+    flags+=("--admin-role=")
170
+    flags+=("--description=")
171
+    flags+=("--display-name=")
172
+    flags+=("--help")
173
+    flags+=("-h")
174
+    flags+=("--master-policy-namespace=")
175
+
176
+    must_have_one_flag=()
177
+    must_have_one_noun=()
178
+}
179
+
180
+_osadm_policy_add-role-to-user()
181
+{
182
+    last_command="osadm_policy_add-role-to-user"
183
+    commands=()
184
+
185
+    flags=()
186
+    two_word_flags=()
187
+    flags_with_completion=()
188
+    flags_completion=()
189
+
190
+    flags+=("--help")
191
+    flags+=("-h")
192
+    flags+=("--role-namespace=")
193
+
194
+    must_have_one_flag=()
195
+    must_have_one_noun=()
196
+}
197
+
198
+_osadm_policy_remove-role-from-user()
199
+{
200
+    last_command="osadm_policy_remove-role-from-user"
201
+    commands=()
202
+
203
+    flags=()
204
+    two_word_flags=()
205
+    flags_with_completion=()
206
+    flags_completion=()
207
+
208
+    flags+=("--help")
209
+    flags+=("-h")
210
+    flags+=("--role-namespace=")
211
+
212
+    must_have_one_flag=()
213
+    must_have_one_noun=()
214
+}
215
+
216
+_osadm_policy_remove-user()
217
+{
218
+    last_command="osadm_policy_remove-user"
219
+    commands=()
220
+
221
+    flags=()
222
+    two_word_flags=()
223
+    flags_with_completion=()
224
+    flags_completion=()
225
+
226
+    flags+=("--help")
227
+    flags+=("-h")
228
+
229
+    must_have_one_flag=()
230
+    must_have_one_noun=()
231
+}
232
+
233
+_osadm_policy_add-role-to-group()
234
+{
235
+    last_command="osadm_policy_add-role-to-group"
236
+    commands=()
237
+
238
+    flags=()
239
+    two_word_flags=()
240
+    flags_with_completion=()
241
+    flags_completion=()
242
+
243
+    flags+=("--help")
244
+    flags+=("-h")
245
+    flags+=("--role-namespace=")
246
+
247
+    must_have_one_flag=()
248
+    must_have_one_noun=()
249
+}
250
+
251
+_osadm_policy_remove-role-from-group()
252
+{
253
+    last_command="osadm_policy_remove-role-from-group"
254
+    commands=()
255
+
256
+    flags=()
257
+    two_word_flags=()
258
+    flags_with_completion=()
259
+    flags_completion=()
260
+
261
+    flags+=("--help")
262
+    flags+=("-h")
263
+    flags+=("--role-namespace=")
264
+
265
+    must_have_one_flag=()
266
+    must_have_one_noun=()
267
+}
268
+
269
+_osadm_policy_remove-group()
270
+{
271
+    last_command="osadm_policy_remove-group"
272
+    commands=()
273
+
274
+    flags=()
275
+    two_word_flags=()
276
+    flags_with_completion=()
277
+    flags_completion=()
278
+
279
+    flags+=("--help")
280
+    flags+=("-h")
281
+
282
+    must_have_one_flag=()
283
+    must_have_one_noun=()
284
+}
285
+
286
+_osadm_policy_who-can()
287
+{
288
+    last_command="osadm_policy_who-can"
289
+    commands=()
290
+
291
+    flags=()
292
+    two_word_flags=()
293
+    flags_with_completion=()
294
+    flags_completion=()
295
+
296
+    flags+=("--help")
297
+    flags+=("-h")
298
+
299
+    must_have_one_flag=()
300
+    must_have_one_noun=()
301
+}
302
+
303
+_osadm_policy()
304
+{
305
+    last_command="osadm_policy"
306
+    commands=()
307
+    commands+=("add-role-to-user")
308
+    commands+=("remove-role-from-user")
309
+    commands+=("remove-user")
310
+    commands+=("add-role-to-group")
311
+    commands+=("remove-role-from-group")
312
+    commands+=("remove-group")
313
+    commands+=("who-can")
314
+
315
+    flags=()
316
+    two_word_flags=()
317
+    flags_with_completion=()
318
+    flags_completion=()
319
+
320
+    flags+=("--help")
321
+    flags+=("-h")
322
+
323
+    must_have_one_flag=()
324
+    must_have_one_noun=()
325
+}
326
+
327
+_osadm_ipfailover()
328
+{
329
+    last_command="osadm_ipfailover"
330
+    commands=()
331
+
332
+    flags=()
333
+    two_word_flags=()
334
+    flags_with_completion=()
335
+    flags_completion=()
336
+
337
+    flags+=("--create")
338
+    flags+=("--credentials=")
339
+    flags+=("--help")
340
+    flags+=("-h")
341
+    flags+=("--images=")
342
+    flags+=("--interface=")
343
+    two_word_flags+=("-i")
344
+    flags+=("--latest-images")
345
+    flags+=("--no-headers")
346
+    flags+=("--output=")
347
+    two_word_flags+=("-o")
348
+    flags+=("--output-version=")
349
+    flags+=("--replicas=")
350
+    two_word_flags+=("-r")
351
+    flags+=("--selector=")
352
+    two_word_flags+=("-l")
353
+    flags+=("--template=")
354
+    two_word_flags+=("-t")
355
+    flags+=("--type=")
356
+    flags+=("--virtual-ips=")
357
+    flags+=("--watch-port=")
358
+    two_word_flags+=("-w")
359
+
360
+    must_have_one_flag=()
361
+    must_have_one_noun=()
362
+}
363
+
364
+_osadm_router()
365
+{
366
+    last_command="osadm_router"
367
+    commands=()
368
+
369
+    flags=()
370
+    two_word_flags=()
371
+    flags_with_completion=()
372
+    flags_completion=()
373
+
374
+    flags+=("--create")
375
+    flags+=("--credentials=")
376
+    flags+=("--default-cert=")
377
+    flags+=("--dry-run")
378
+    flags+=("--help")
379
+    flags+=("-h")
380
+    flags+=("--images=")
381
+    flags+=("--labels=")
382
+    flags+=("--latest-images")
383
+    flags+=("--no-headers")
384
+    flags+=("--output=")
385
+    two_word_flags+=("-o")
386
+    flags+=("--output-version=")
387
+    flags+=("--ports=")
388
+    flags+=("--replicas=")
389
+    flags+=("--template=")
390
+    two_word_flags+=("-t")
391
+    flags+=("--type=")
392
+
393
+    must_have_one_flag=()
394
+    must_have_one_noun=()
395
+}
396
+
397
+_osadm_registry()
398
+{
399
+    last_command="osadm_registry"
400
+    commands=()
401
+
402
+    flags=()
403
+    two_word_flags=()
404
+    flags_with_completion=()
405
+    flags_completion=()
406
+
407
+    flags+=("--create")
408
+    flags+=("--credentials=")
409
+    flags+=("--dry-run")
410
+    flags+=("--help")
411
+    flags+=("-h")
412
+    flags+=("--images=")
413
+    flags+=("--labels=")
414
+    flags+=("--latest-images")
415
+    flags+=("--mount-host=")
416
+    flags+=("--no-headers")
417
+    flags+=("--output=")
418
+    two_word_flags+=("-o")
419
+    flags+=("--output-version=")
420
+    flags+=("--ports=")
421
+    flags+=("--replicas=")
422
+    flags+=("--template=")
423
+    two_word_flags+=("-t")
424
+    flags+=("--type=")
425
+    flags+=("--volume=")
426
+
427
+    must_have_one_flag=()
428
+    must_have_one_noun=()
429
+}
430
+
431
+_osadm_build-chain()
432
+{
433
+    last_command="osadm_build-chain"
434
+    commands=()
435
+
436
+    flags=()
437
+    two_word_flags=()
438
+    flags_with_completion=()
439
+    flags_completion=()
440
+
441
+    flags+=("--all")
442
+    flags+=("--all-tags")
443
+    flags+=("--help")
444
+    flags+=("-h")
445
+    flags+=("--output=")
446
+    two_word_flags+=("-o")
447
+
448
+    must_have_one_flag=()
449
+    must_have_one_noun=()
450
+}
451
+
452
+_osadm_config_view()
453
+{
454
+    last_command="osadm_config_view"
455
+    commands=()
456
+
457
+    flags=()
458
+    two_word_flags=()
459
+    flags_with_completion=()
460
+    flags_completion=()
461
+
462
+    flags+=("--flatten")
463
+    flags+=("--help")
464
+    flags+=("-h")
465
+    flags+=("--merge")
466
+    flags+=("--minify")
467
+    flags+=("--no-headers")
468
+    flags+=("--output=")
469
+    two_word_flags+=("-o")
470
+    flags+=("--output-version=")
471
+    flags+=("--raw")
472
+    flags+=("--template=")
473
+    two_word_flags+=("-t")
474
+
475
+    must_have_one_flag=()
476
+    must_have_one_noun=()
477
+}
478
+
479
+_osadm_config_set-cluster()
480
+{
481
+    last_command="osadm_config_set-cluster"
482
+    commands=()
483
+
484
+    flags=()
485
+    two_word_flags=()
486
+    flags_with_completion=()
487
+    flags_completion=()
488
+
489
+    flags+=("--api-version=")
490
+    flags+=("--certificate-authority=")
491
+    flags+=("--embed-certs")
492
+    flags+=("--help")
493
+    flags+=("-h")
494
+    flags+=("--insecure-skip-tls-verify")
495
+    flags+=("--server=")
496
+
497
+    must_have_one_flag=()
498
+    must_have_one_noun=()
499
+}
500
+
501
+_osadm_config_set-credentials()
502
+{
503
+    last_command="osadm_config_set-credentials"
504
+    commands=()
505
+
506
+    flags=()
507
+    two_word_flags=()
508
+    flags_with_completion=()
509
+    flags_completion=()
510
+
511
+    flags+=("--auth-path=")
512
+    flags+=("--client-certificate=")
513
+    flags+=("--client-key=")
514
+    flags+=("--embed-certs")
515
+    flags+=("--help")
516
+    flags+=("-h")
517
+    flags+=("--password=")
518
+    flags+=("--token=")
519
+    flags+=("--username=")
520
+
521
+    must_have_one_flag=()
522
+    must_have_one_noun=()
523
+}
524
+
525
+_osadm_config_set-context()
526
+{
527
+    last_command="osadm_config_set-context"
528
+    commands=()
529
+
530
+    flags=()
531
+    two_word_flags=()
532
+    flags_with_completion=()
533
+    flags_completion=()
534
+
535
+    flags+=("--cluster=")
536
+    flags+=("--help")
537
+    flags+=("-h")
538
+    flags+=("--namespace=")
539
+    flags+=("--user=")
540
+
541
+    must_have_one_flag=()
542
+    must_have_one_noun=()
543
+}
544
+
545
+_osadm_config_set()
546
+{
547
+    last_command="osadm_config_set"
548
+    commands=()
549
+
550
+    flags=()
551
+    two_word_flags=()
552
+    flags_with_completion=()
553
+    flags_completion=()
554
+
555
+    flags+=("--help")
556
+    flags+=("-h")
557
+
558
+    must_have_one_flag=()
559
+    must_have_one_noun=()
560
+}
561
+
562
+_osadm_config_unset()
563
+{
564
+    last_command="osadm_config_unset"
565
+    commands=()
566
+
567
+    flags=()
568
+    two_word_flags=()
569
+    flags_with_completion=()
570
+    flags_completion=()
571
+
572
+    flags+=("--help")
573
+    flags+=("-h")
574
+
575
+    must_have_one_flag=()
576
+    must_have_one_noun=()
577
+}
578
+
579
+_osadm_config_use-context()
580
+{
581
+    last_command="osadm_config_use-context"
582
+    commands=()
583
+
584
+    flags=()
585
+    two_word_flags=()
586
+    flags_with_completion=()
587
+    flags_completion=()
588
+
589
+    flags+=("--help")
590
+    flags+=("-h")
591
+
592
+    must_have_one_flag=()
593
+    must_have_one_noun=()
594
+}
595
+
596
+_osadm_config()
597
+{
598
+    last_command="osadm_config"
599
+    commands=()
600
+    commands+=("view")
601
+    commands+=("set-cluster")
602
+    commands+=("set-credentials")
603
+    commands+=("set-context")
604
+    commands+=("set")
605
+    commands+=("unset")
606
+    commands+=("use-context")
607
+
608
+    flags=()
609
+    two_word_flags=()
610
+    flags_with_completion=()
611
+    flags_completion=()
612
+
613
+    flags+=("--config=")
614
+    flags+=("--help")
615
+    flags+=("-h")
616
+
617
+    must_have_one_flag=()
618
+    must_have_one_noun=()
619
+}
620
+
621
+_osadm_create-kubeconfig()
622
+{
623
+    last_command="osadm_create-kubeconfig"
624
+    commands=()
625
+
626
+    flags=()
627
+    two_word_flags=()
628
+    flags_with_completion=()
629
+    flags_completion=()
630
+
631
+    flags+=("--certificate-authority=")
632
+    flags+=("--client-certificate=")
633
+    flags+=("--client-key=")
634
+    flags+=("--cluster=")
635
+    flags+=("--context=")
636
+    flags+=("--help")
637
+    flags+=("-h")
638
+    flags+=("--kubeconfig=")
639
+    flags+=("--master=")
640
+    flags+=("--namespace=")
641
+    flags+=("--public-master=")
642
+    flags+=("--user=")
643
+
644
+    must_have_one_flag=()
645
+    must_have_one_noun=()
646
+}
647
+
648
+_osadm_create-bootstrap-policy-file()
649
+{
650
+    last_command="osadm_create-bootstrap-policy-file"
651
+    commands=()
652
+
653
+    flags=()
654
+    two_word_flags=()
655
+    flags_with_completion=()
656
+    flags_completion=()
657
+
658
+    flags+=("--filename=")
659
+    flags+=("--help")
660
+    flags+=("-h")
661
+    flags+=("--master-namespace=")
662
+    flags+=("--openshift-namespace=")
663
+
664
+    must_have_one_flag=()
665
+    must_have_one_noun=()
666
+}
667
+
668
+_osadm_overwrite-policy()
669
+{
670
+    last_command="osadm_overwrite-policy"
671
+    commands=()
672
+
673
+    flags=()
674
+    two_word_flags=()
675
+    flags_with_completion=()
676
+    flags_completion=()
677
+
678
+    flags+=("--filename=")
679
+    flags+=("--force")
680
+    flags+=("-f")
681
+    flags+=("--help")
682
+    flags+=("-h")
683
+    flags+=("--master-config=")
684
+
685
+    must_have_one_flag=()
686
+    must_have_one_noun=()
687
+}
688
+
689
+_osadm_create-node-config()
690
+{
691
+    last_command="osadm_create-node-config"
692
+    commands=()
693
+
694
+    flags=()
695
+    two_word_flags=()
696
+    flags_with_completion=()
697
+    flags_completion=()
698
+
699
+    flags+=("--allow-disabled-docker")
700
+    flags+=("--certificate-authority=")
701
+    flags+=("--client-certificate=")
702
+    flags+=("--client-key=")
703
+    flags+=("--dns-domain=")
704
+    flags+=("--dns-ip=")
705
+    flags+=("--help")
706
+    flags+=("-h")
707
+    flags+=("--hostnames=")
708
+    flags+=("--images=")
709
+    flags+=("--latest-images")
710
+    flags+=("--listen=")
711
+    flags+=("--master=")
712
+    flags+=("--node=")
713
+    flags+=("--node-client-certificate-authority=")
714
+    flags+=("--node-dir=")
715
+    flags+=("--server-certificate=")
716
+    flags+=("--server-key=")
717
+    flags+=("--signer-cert=")
718
+    flags+=("--signer-key=")
719
+    flags+=("--signer-serial=")
720
+    flags+=("--volume-dir=")
721
+
722
+    must_have_one_flag=()
723
+    must_have_one_noun=()
724
+}
725
+
726
+_osadm_create-master-certs()
727
+{
728
+    last_command="osadm_create-master-certs"
729
+    commands=()
730
+
731
+    flags=()
732
+    two_word_flags=()
733
+    flags_with_completion=()
734
+    flags_completion=()
735
+
736
+    flags+=("--cert-dir=")
737
+    flags+=("--help")
738
+    flags+=("-h")
739
+    flags+=("--hostnames=")
740
+    flags+=("--master=")
741
+    flags+=("--overwrite")
742
+    flags+=("--public-master=")
743
+    flags+=("--signer-name=")
744
+
745
+    must_have_one_flag=()
746
+    must_have_one_noun=()
747
+}
748
+
749
+_osadm_create-api-client-config()
750
+{
751
+    last_command="osadm_create-api-client-config"
752
+    commands=()
753
+
754
+    flags=()
755
+    two_word_flags=()
756
+    flags_with_completion=()
757
+    flags_completion=()
758
+
759
+    flags+=("--certificate-authority=")
760
+    flags+=("--client-dir=")
761
+    flags+=("--groups=")
762
+    flags+=("--help")
763
+    flags+=("-h")
764
+    flags+=("--master=")
765
+    flags+=("--public-master=")
766
+    flags+=("--signer-cert=")
767
+    flags+=("--signer-key=")
768
+    flags+=("--signer-serial=")
769
+    flags+=("--user=")
770
+
771
+    must_have_one_flag=()
772
+    must_have_one_noun=()
773
+}
774
+
775
+_osadm_create-server-cert()
776
+{
777
+    last_command="osadm_create-server-cert"
778
+    commands=()
779
+
780
+    flags=()
781
+    two_word_flags=()
782
+    flags_with_completion=()
783
+    flags_completion=()
784
+
785
+    flags+=("--cert=")
786
+    flags+=("--help")
787
+    flags+=("-h")
788
+    flags+=("--hostnames=")
789
+    flags+=("--key=")
790
+    flags+=("--overwrite")
791
+    flags+=("--signer-cert=")
792
+    flags+=("--signer-key=")
793
+    flags+=("--signer-serial=")
794
+
795
+    must_have_one_flag=()
796
+    must_have_one_noun=()
797
+}
798
+
799
+_osadm_create-signer-cert()
800
+{
801
+    last_command="osadm_create-signer-cert"
802
+    commands=()
803
+
804
+    flags=()
805
+    two_word_flags=()
806
+    flags_with_completion=()
807
+    flags_completion=()
808
+
809
+    flags+=("--cert=")
810
+    flags+=("--help")
811
+    flags+=("-h")
812
+    flags+=("--key=")
813
+    flags+=("--name=")
814
+    flags+=("--overwrite")
815
+    flags+=("--serial=")
816
+
817
+    must_have_one_flag=()
818
+    must_have_one_noun=()
819
+}
820
+
821
+_osadm_options()
822
+{
823
+    last_command="osadm_options"
824
+    commands=()
825
+
826
+    flags=()
827
+    two_word_flags=()
828
+    flags_with_completion=()
829
+    flags_completion=()
830
+
831
+    flags+=("--help")
832
+    flags+=("-h")
833
+
834
+    must_have_one_flag=()
835
+    must_have_one_noun=()
836
+}
837
+
838
+_osadm()
839
+{
840
+    last_command="osadm"
841
+    commands=()
842
+    commands+=("new-project")
843
+    commands+=("policy")
844
+    commands+=("ipfailover")
845
+    commands+=("router")
846
+    commands+=("registry")
847
+    commands+=("build-chain")
848
+    commands+=("config")
849
+    commands+=("create-kubeconfig")
850
+    commands+=("create-bootstrap-policy-file")
851
+    commands+=("overwrite-policy")
852
+    commands+=("create-node-config")
853
+    commands+=("create-master-certs")
854
+    commands+=("create-api-client-config")
855
+    commands+=("create-server-cert")
856
+    commands+=("create-signer-cert")
857
+    commands+=("options")
858
+
859
+    flags=()
860
+    two_word_flags=()
861
+    flags_with_completion=()
862
+    flags_completion=()
863
+
864
+    flags+=("--allow_dynamic_housekeeping")
865
+    flags+=("--alsologtostderr")
866
+    flags+=("--api-version=")
867
+    flags+=("--auth-path=")
868
+    flags+=("--boot_id_file=")
869
+    flags+=("--certificate-authority=")
870
+    flags+=("--client-certificate=")
871
+    flags+=("--client-key=")
872
+    flags+=("--cluster=")
873
+    flags+=("--config=")
874
+    flags+=("--container_hints=")
875
+    flags+=("--context=")
876
+    flags+=("--docker=")
877
+    flags+=("--docker_root=")
878
+    flags+=("--docker_run=")
879
+    flags+=("--enable_load_reader")
880
+    flags+=("--global_housekeeping_interval=")
881
+    flags+=("--google-json-key=")
882
+    flags+=("--help")
883
+    flags+=("-h")
884
+    flags+=("--housekeeping_interval=")
885
+    flags+=("--httptest.serve=")
886
+    flags+=("--insecure-skip-tls-verify")
887
+    flags+=("--log_backtrace_at=")
888
+    flags+=("--log_cadvisor_usage")
889
+    flags+=("--log_dir=")
890
+    flags+=("--log_flush_frequency=")
891
+    flags+=("--logtostderr")
892
+    flags+=("--machine_id_file=")
893
+    flags+=("--match-server-version")
894
+    flags+=("--max_housekeeping_interval=")
895
+    flags+=("--namespace=")
896
+    two_word_flags+=("-n")
897
+    flags+=("--server=")
898
+    flags+=("--stderrthreshold=")
899
+    flags+=("--token=")
900
+    flags+=("--user=")
901
+    flags+=("--v=")
902
+    flags+=("--validate")
903
+    flags+=("--vmodule=")
904
+
905
+    must_have_one_flag=()
906
+    must_have_one_noun=()
907
+}
908
+
909
+__start_osadm()
910
+{
911
+    local cur prev words cword
912
+    _init_completion -s || return
913
+
914
+    local c=0
915
+    local flags=()
916
+    local two_word_flags=()
917
+    local flags_with_completion=()
918
+    local flags_completion=()
919
+    local commands=("osadm")
920
+    local must_have_one_flag=()
921
+    local must_have_one_noun=()
922
+    local last_command
923
+    local nouns=()
924
+
925
+    __handle_word
926
+}
927
+
928
+complete -F __start_osadm osadm
929
+# ex: ts=4 sw=4 et filetype=sh
0 930
new file mode 100644
... ...
@@ -0,0 +1,1091 @@
0
+#!/bin/bash
1
+
2
+
3
+__debug()
4
+{
5
+    if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
6
+        echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
7
+    fi
8
+}
9
+
10
+__index_of_word()
11
+{
12
+    local w word=$1
13
+    shift
14
+    index=0
15
+    for w in "$@"; do
16
+        [[ $w = "$word" ]] && return
17
+        index=$((index+1))
18
+    done
19
+    index=-1
20
+}
21
+
22
+__contains_word()
23
+{
24
+    local w word=$1; shift
25
+    for w in "$@"; do
26
+        [[ $w = "$word" ]] && return
27
+    done
28
+    return 1
29
+}
30
+
31
+__handle_reply()
32
+{
33
+    __debug "${FUNCNAME}"
34
+    case $cur in
35
+        -*)
36
+            compopt -o nospace
37
+            local allflags
38
+            if [ ${#must_have_one_flag[@]} -ne 0 ]; then
39
+                allflags=("${must_have_one_flag[@]}")
40
+            else
41
+                allflags=("${flags[*]} ${two_word_flags[*]}")
42
+            fi
43
+            COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
44
+            [[ $COMPREPLY == *= ]] || compopt +o nospace
45
+            return 0;
46
+            ;;
47
+    esac
48
+
49
+    # check if we are handling a flag with special work handling
50
+    local index
51
+    __index_of_word "${prev}" "${flags_with_completion[@]}"
52
+    if [[ ${index} -ge 0 ]]; then
53
+        ${flags_completion[${index}]}
54
+        return
55
+    fi
56
+
57
+    # we are parsing a flag and don't have a special handler, no completion
58
+    if [[ ${cur} != "${words[cword]}" ]]; then
59
+        return
60
+    fi
61
+
62
+    local completions
63
+    if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
64
+        completions=("${must_have_one_flag[@]}")
65
+    elif [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
66
+        completions=("${must_have_one_noun[@]}")
67
+    else
68
+        completions=("${commands[@]}")
69
+    fi
70
+    COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
71
+
72
+    if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
73
+        declare -F __custom_func >/dev/null && __custom_func
74
+    fi
75
+}
76
+
77
+# The arguments should be in the form "ext1|ext2|extn"
78
+__handle_filename_extension_flag()
79
+{
80
+    local ext="$1"
81
+    _filedir "@(${ext})"
82
+}
83
+
84
+__handle_flag()
85
+{
86
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
87
+
88
+    # if a command required a flag, and we found it, unset must_have_one_flag()
89
+    local flagname=${words[c]}
90
+    # if the word contained an =
91
+    if [[ ${words[c]} == *"="* ]]; then
92
+        flagname=${flagname%=*} # strip everything after the =
93
+        flagname="${flagname}=" # but put the = back
94
+    fi
95
+    __debug "${FUNCNAME}: looking for ${flagname}"
96
+    if __contains_word "${flagname}" "${must_have_one_flag[@]}"; then
97
+        must_have_one_flag=()
98
+    fi
99
+
100
+    # skip the argument to a two word flag
101
+    if __contains_word "${words[c]}" "${two_word_flags[@]}"; then
102
+        c=$((c+1))
103
+        # if we are looking for a flags value, don't show commands
104
+        if [[ $c -eq $cword ]]; then
105
+            commands=()
106
+        fi
107
+    fi
108
+
109
+    # skip the flag itself
110
+    c=$((c+1))
111
+
112
+}
113
+
114
+__handle_noun()
115
+{
116
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
117
+
118
+    if __contains_word "${words[c]}" "${must_have_one_noun[@]}"; then
119
+        must_have_one_noun=()
120
+    fi
121
+
122
+    nouns+=("${words[c]}")
123
+    c=$((c+1))
124
+}
125
+
126
+__handle_command()
127
+{
128
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
129
+
130
+    local next_command
131
+    if [[ -n ${last_command} ]]; then
132
+        next_command="_${last_command}_${words[c]}"
133
+    else
134
+        next_command="_${words[c]}"
135
+    fi
136
+    c=$((c+1))
137
+    __debug "${FUNCNAME}: looking for ${next_command}"
138
+    declare -F $next_command >/dev/null && $next_command
139
+}
140
+
141
+__handle_word()
142
+{
143
+    if [[ $c -ge $cword ]]; then
144
+        __handle_reply
145
+	return
146
+    fi
147
+    __debug "${FUNCNAME}: c is $c words[c] is ${words[c]}"
148
+    if [[ "${words[c]}" == -* ]]; then
149
+	__handle_flag
150
+    elif __contains_word "${words[c]}" "${commands[@]}"; then
151
+        __handle_command
152
+    else
153
+        __handle_noun
154
+    fi
155
+    __handle_word
156
+}
157
+
158
+# call osc get $1,
159
+__osc_parse_get()
160
+{
161
+    local template
162
+    template="{{ range .items  }}{{ .metadata.name }} {{ end }}"
163
+    local osc_out
164
+    if osc_out=$(osc get -o template --template="${template}" "$1" 2>/dev/null); then
165
+        COMPREPLY=( $( compgen -W "${osc_out[*]}" -- "$cur" ) )
166
+    fi
167
+}
168
+
169
+__osc_get_resource()
170
+{
171
+    if [[ ${#nouns[@]} -eq 0 ]]; then
172
+        return 1
173
+    fi
174
+    __osc_parse_get ${nouns[${#nouns[@]} -1]}
175
+}
176
+
177
+# $1 is the name of the pod we want to get the list of containers inside
178
+__osc_get_containers()
179
+{
180
+    local template
181
+    template="{{ range .spec.containers  }}{{ .name }} {{ end }}"
182
+    __debug ${FUNCNAME} "nouns are ${nouns[@]}"
183
+
184
+    local len="${#nouns[@]}"
185
+    if [[ ${len} -ne 1 ]]; then
186
+        return
187
+    fi
188
+    local last=${nouns[${len} -1]}
189
+    local osc_out
190
+    if osc_out=$(osc get -o template --template="${template}" pods "${last}" 2>/dev/null); then
191
+        COMPREPLY=( $( compgen -W "${osc_out[*]}" -- "$cur" ) )
192
+    fi
193
+}
194
+
195
+# Require both a pod and a container to be specified
196
+__osc_require_pod_and_container()
197
+{
198
+    if [[ ${#nouns[@]} -eq 0 ]]; then
199
+        __osc_parse_get pods
200
+        return 0
201
+    fi;
202
+    __osc_get_containers
203
+    return 0
204
+}
205
+
206
+__custom_func() {
207
+    case ${last_command} in
208
+        osc_get | osc_describe | osc_delete)
209
+	    __osc_get_resource
210
+            return
211
+            ;;
212
+	osc_log)
213
+	    __osc_require_pod_and_container
214
+	    return
215
+	    ;;
216
+        *)
217
+            ;;
218
+    esac
219
+}
220
+
221
+_osc_login()
222
+{
223
+    last_command="osc_login"
224
+    commands=()
225
+
226
+    flags=()
227
+    two_word_flags=()
228
+    flags_with_completion=()
229
+    flags_completion=()
230
+
231
+    flags+=("--help")
232
+    flags+=("-h")
233
+    flags+=("--password=")
234
+    two_word_flags+=("-p")
235
+    flags+=("--username=")
236
+    two_word_flags+=("-u")
237
+
238
+    must_have_one_flag=()
239
+    must_have_one_noun=()
240
+}
241
+
242
+_osc_logout()
243
+{
244
+    last_command="osc_logout"
245
+    commands=()
246
+
247
+    flags=()
248
+    two_word_flags=()
249
+    flags_with_completion=()
250
+    flags_completion=()
251
+
252
+    flags+=("--help")
253
+    flags+=("-h")
254
+
255
+    must_have_one_flag=()
256
+    must_have_one_noun=()
257
+}
258
+
259
+_osc_project()
260
+{
261
+    last_command="osc_project"
262
+    commands=()
263
+
264
+    flags=()
265
+    two_word_flags=()
266
+    flags_with_completion=()
267
+    flags_completion=()
268
+
269
+    flags+=("--help")
270
+    flags+=("-h")
271
+
272
+    must_have_one_flag=()
273
+    must_have_one_noun=()
274
+}
275
+
276
+_osc_new-project()
277
+{
278
+    last_command="osc_new-project"
279
+    commands=()
280
+
281
+    flags=()
282
+    two_word_flags=()
283
+    flags_with_completion=()
284
+    flags_completion=()
285
+
286
+    flags+=("--description=")
287
+    flags+=("--display-name=")
288
+    flags+=("--help")
289
+    flags+=("-h")
290
+
291
+    must_have_one_flag=()
292
+    must_have_one_noun=()
293
+}
294
+
295
+_osc_new-app()
296
+{
297
+    last_command="osc_new-app"
298
+    commands=()
299
+
300
+    flags=()
301
+    two_word_flags=()
302
+    flags_with_completion=()
303
+    flags_completion=()
304
+
305
+    flags+=("--build=")
306
+    flags+=("--code=")
307
+    flags+=("--docker-image=")
308
+    flags+=("--env=")
309
+    two_word_flags+=("-e")
310
+    flags+=("--group=")
311
+    flags+=("--help")
312
+    flags+=("-h")
313
+    flags+=("--image=")
314
+    two_word_flags+=("-i")
315
+    flags+=("--labels=")
316
+    two_word_flags+=("-l")
317
+    flags+=("--name=")
318
+    flags+=("--no-headers")
319
+    flags+=("--output=")
320
+    two_word_flags+=("-o")
321
+    flags+=("--output-template=")
322
+    flags+=("--output-version=")
323
+    flags+=("--param=")
324
+    two_word_flags+=("-p")
325
+    flags+=("--template=")
326
+
327
+    must_have_one_flag=()
328
+    must_have_one_noun=()
329
+}
330
+
331
+_osc_status()
332
+{
333
+    last_command="osc_status"
334
+    commands=()
335
+
336
+    flags=()
337
+    two_word_flags=()
338
+    flags_with_completion=()
339
+    flags_completion=()
340
+
341
+    flags+=("--help")
342
+    flags+=("-h")
343
+
344
+    must_have_one_flag=()
345
+    must_have_one_noun=()
346
+}
347
+
348
+_osc_start-build()
349
+{
350
+    last_command="osc_start-build"
351
+    commands=()
352
+
353
+    flags=()
354
+    two_word_flags=()
355
+    flags_with_completion=()
356
+    flags_completion=()
357
+
358
+    flags+=("--follow")
359
+    flags+=("--from-build=")
360
+    flags+=("--from-webhook=")
361
+    flags+=("--git-post-receive=")
362
+    flags+=("--help")
363
+    flags+=("-h")
364
+    flags+=("--list-webhooks=")
365
+
366
+    must_have_one_flag=()
367
+    must_have_one_noun=()
368
+}
369
+
370
+_osc_cancel-build()
371
+{
372
+    last_command="osc_cancel-build"
373
+    commands=()
374
+
375
+    flags=()
376
+    two_word_flags=()
377
+    flags_with_completion=()
378
+    flags_completion=()
379
+
380
+    flags+=("--dump-logs")
381
+    flags+=("--help")
382
+    flags+=("-h")
383
+    flags+=("--restart")
384
+
385
+    must_have_one_flag=()
386
+    must_have_one_noun=()
387
+}
388
+
389
+_osc_build-logs()
390
+{
391
+    last_command="osc_build-logs"
392
+    commands=()
393
+
394
+    flags=()
395
+    two_word_flags=()
396
+    flags_with_completion=()
397
+    flags_completion=()
398
+
399
+    flags+=("--follow")
400
+    flags+=("-f")
401
+    flags+=("--help")
402
+    flags+=("-h")
403
+    flags+=("--nowait")
404
+    flags+=("-w")
405
+
406
+    must_have_one_flag=()
407
+    must_have_one_noun=()
408
+}
409
+
410
+_osc_deploy()
411
+{
412
+    last_command="osc_deploy"
413
+    commands=()
414
+
415
+    flags=()
416
+    two_word_flags=()
417
+    flags_with_completion=()
418
+    flags_completion=()
419
+
420
+    flags+=("--help")
421
+    flags+=("-h")
422
+    flags+=("--latest")
423
+    flags+=("--retry")
424
+
425
+    must_have_one_flag=()
426
+    must_have_one_noun=()
427
+}
428
+
429
+_osc_rollback()
430
+{
431
+    last_command="osc_rollback"
432
+    commands=()
433
+
434
+    flags=()
435
+    two_word_flags=()
436
+    flags_with_completion=()
437
+    flags_completion=()
438
+
439
+    flags+=("--change-scaling-settings")
440
+    flags+=("--change-strategy")
441
+    flags+=("--change-triggers")
442
+    flags+=("--dry-run")
443
+    flags+=("-d")
444
+    flags+=("--help")
445
+    flags+=("-h")
446
+    flags+=("--output=")
447
+    two_word_flags+=("-o")
448
+    flags+=("--template=")
449
+    two_word_flags+=("-t")
450
+
451
+    must_have_one_flag=()
452
+    must_have_one_noun=()
453
+}
454
+
455
+_osc_get()
456
+{
457
+    last_command="osc_get"
458
+    commands=()
459
+
460
+    flags=()
461
+    two_word_flags=()
462
+    flags_with_completion=()
463
+    flags_completion=()
464
+
465
+    flags+=("--help")
466
+    flags+=("-h")
467
+    flags+=("--no-headers")
468
+    flags+=("--output=")
469
+    two_word_flags+=("-o")
470
+    flags+=("--output-version=")
471
+    flags+=("--selector=")
472
+    two_word_flags+=("-l")
473
+    flags+=("--template=")
474
+    two_word_flags+=("-t")
475
+    flags+=("--watch")
476
+    flags+=("-w")
477
+    flags+=("--watch-only")
478
+
479
+    must_have_one_flag=()
480
+    must_have_one_noun=()
481
+    must_have_one_noun+=("build")
482
+    must_have_one_noun+=("buildconfig")
483
+    must_have_one_noun+=("clusterpolicy")
484
+    must_have_one_noun+=("clusterpolicybinding")
485
+    must_have_one_noun+=("clusterrole")
486
+    must_have_one_noun+=("clusterrolebinding")
487
+    must_have_one_noun+=("componentstatus")
488
+    must_have_one_noun+=("deployment")
489
+    must_have_one_noun+=("deploymentconfig")
490
+    must_have_one_noun+=("endpoints")
491
+    must_have_one_noun+=("event")
492
+    must_have_one_noun+=("identity")
493
+    must_have_one_noun+=("image")
494
+    must_have_one_noun+=("imagerepository")
495
+    must_have_one_noun+=("imagerepositorytag")
496
+    must_have_one_noun+=("imagestream")
497
+    must_have_one_noun+=("imagestreamimage")
498
+    must_have_one_noun+=("imagestreamtag")
499
+    must_have_one_noun+=("ispersonalsubjectaccessreview")
500
+    must_have_one_noun+=("limitrange")
501
+    must_have_one_noun+=("namespace")
502
+    must_have_one_noun+=("node")
503
+    must_have_one_noun+=("oauthaccesstoken")
504
+    must_have_one_noun+=("oauthauthorizetoken")
505
+    must_have_one_noun+=("oauthclient")
506
+    must_have_one_noun+=("oauthclientauthorization")
507
+    must_have_one_noun+=("persistentvolume")
508
+    must_have_one_noun+=("persistentvolumeclaim")
509
+    must_have_one_noun+=("pod")
510
+    must_have_one_noun+=("podtemplate")
511
+    must_have_one_noun+=("policy")
512
+    must_have_one_noun+=("policybinding")
513
+    must_have_one_noun+=("project")
514
+    must_have_one_noun+=("replicationcontroller")
515
+    must_have_one_noun+=("resourcequota")
516
+    must_have_one_noun+=("role")
517
+    must_have_one_noun+=("rolebinding")
518
+    must_have_one_noun+=("route")
519
+    must_have_one_noun+=("secret")
520
+    must_have_one_noun+=("service")
521
+    must_have_one_noun+=("template")
522
+    must_have_one_noun+=("user")
523
+    must_have_one_noun+=("useridentitymapping")
524
+}
525
+
526
+_osc_describe()
527
+{
528
+    last_command="osc_describe"
529
+    commands=()
530
+
531
+    flags=()
532
+    two_word_flags=()
533
+    flags_with_completion=()
534
+    flags_completion=()
535
+
536
+    flags+=("--help")
537
+    flags+=("-h")
538
+
539
+    must_have_one_flag=()
540
+    must_have_one_noun=()
541
+    must_have_one_noun+=("build")
542
+    must_have_one_noun+=("buildconfig")
543
+    must_have_one_noun+=("buildlog")
544
+    must_have_one_noun+=("clusterpolicy")
545
+    must_have_one_noun+=("clusterpolicybinding")
546
+    must_have_one_noun+=("clusterrole")
547
+    must_have_one_noun+=("clusterrolebinding")
548
+    must_have_one_noun+=("deployment")
549
+    must_have_one_noun+=("deploymentconfig")
550
+    must_have_one_noun+=("identity")
551
+    must_have_one_noun+=("image")
552
+    must_have_one_noun+=("imagestream")
553
+    must_have_one_noun+=("imagestreamimage")
554
+    must_have_one_noun+=("imagestreamtag")
555
+    must_have_one_noun+=("limitrange")
556
+    must_have_one_noun+=("minion")
557
+    must_have_one_noun+=("node")
558
+    must_have_one_noun+=("persistentvolume")
559
+    must_have_one_noun+=("persistentvolumeclaim")
560
+    must_have_one_noun+=("pod")
561
+    must_have_one_noun+=("policy")
562
+    must_have_one_noun+=("policybinding")
563
+    must_have_one_noun+=("project")
564
+    must_have_one_noun+=("replicationcontroller")
565
+    must_have_one_noun+=("resourcequota")
566
+    must_have_one_noun+=("role")
567
+    must_have_one_noun+=("rolebinding")
568
+    must_have_one_noun+=("route")
569
+    must_have_one_noun+=("service")
570
+    must_have_one_noun+=("template")
571
+    must_have_one_noun+=("user")
572
+    must_have_one_noun+=("useridentitymapping")
573
+}
574
+
575
+_osc_create()
576
+{
577
+    last_command="osc_create"
578
+    commands=()
579
+
580
+    flags=()
581
+    two_word_flags=()
582
+    flags_with_completion=()
583
+    flags_completion=()
584
+
585
+    flags+=("--filename=")
586
+    flags_with_completion+=("--filename")
587
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
588
+    two_word_flags+=("-f")
589
+    flags_with_completion+=("-f")
590
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
591
+    flags+=("--help")
592
+    flags+=("-h")
593
+
594
+    must_have_one_flag=()
595
+    must_have_one_flag+=("--filename=")
596
+    must_have_one_flag+=("-f")
597
+    must_have_one_noun=()
598
+}
599
+
600
+_osc_process()
601
+{
602
+    last_command="osc_process"
603
+    commands=()
604
+
605
+    flags=()
606
+    two_word_flags=()
607
+    flags_with_completion=()
608
+    flags_completion=()
609
+
610
+    flags+=("--filename=")
611
+    two_word_flags+=("-f")
612
+    flags+=("--help")
613
+    flags+=("-h")
614
+    flags+=("--labels=")
615
+    two_word_flags+=("-l")
616
+    flags+=("--no-headers")
617
+    flags+=("--output=")
618
+    two_word_flags+=("-o")
619
+    flags+=("--output-version=")
620
+    flags+=("--parameters")
621
+    flags+=("--template=")
622
+    two_word_flags+=("-t")
623
+    flags+=("--value=")
624
+    two_word_flags+=("-v")
625
+
626
+    must_have_one_flag=()
627
+    must_have_one_noun=()
628
+}
629
+
630
+_osc_edit()
631
+{
632
+    last_command="osc_edit"
633
+    commands=()
634
+
635
+    flags=()
636
+    two_word_flags=()
637
+    flags_with_completion=()
638
+    flags_completion=()
639
+
640
+    flags+=("--filename=")
641
+    flags_with_completion+=("--filename")
642
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
643
+    two_word_flags+=("-f")
644
+    flags_with_completion+=("-f")
645
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
646
+    flags+=("--help")
647
+    flags+=("-h")
648
+    flags+=("--output=")
649
+    two_word_flags+=("-o")
650
+    flags+=("--output-version=")
651
+
652
+    must_have_one_flag=()
653
+    must_have_one_noun=()
654
+}
655
+
656
+_osc_update()
657
+{
658
+    last_command="osc_update"
659
+    commands=()
660
+
661
+    flags=()
662
+    two_word_flags=()
663
+    flags_with_completion=()
664
+    flags_completion=()
665
+
666
+    flags+=("--filename=")
667
+    flags_with_completion+=("--filename")
668
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
669
+    two_word_flags+=("-f")
670
+    flags_with_completion+=("-f")
671
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
672
+    flags+=("--help")
673
+    flags+=("-h")
674
+    flags+=("--patch=")
675
+
676
+    must_have_one_flag=()
677
+    must_have_one_flag+=("--filename=")
678
+    must_have_one_flag+=("-f")
679
+    must_have_one_flag+=("--patch=")
680
+    must_have_one_noun=()
681
+}
682
+
683
+_osc_delete()
684
+{
685
+    last_command="osc_delete"
686
+    commands=()
687
+
688
+    flags=()
689
+    two_word_flags=()
690
+    flags_with_completion=()
691
+    flags_completion=()
692
+
693
+    flags+=("--all")
694
+    flags+=("--cascade")
695
+    flags+=("--filename=")
696
+    flags_with_completion+=("--filename")
697
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
698
+    two_word_flags+=("-f")
699
+    flags_with_completion+=("-f")
700
+    flags_completion+=("__handle_filename_extension_flag json|yaml|yml")
701
+    flags+=("--grace-period=")
702
+    flags+=("--help")
703
+    flags+=("-h")
704
+    flags+=("--selector=")
705
+    two_word_flags+=("-l")
706
+
707
+    must_have_one_flag=()
708
+    must_have_one_noun=()
709
+}
710
+
711
+_osc_log()
712
+{
713
+    last_command="osc_log"
714
+    commands=()
715
+
716
+    flags=()
717
+    two_word_flags=()
718
+    flags_with_completion=()
719
+    flags_completion=()
720
+
721
+    flags+=("--follow")
722
+    flags+=("-f")
723
+    flags+=("--help")
724
+    flags+=("-h")
725
+    flags+=("--interactive")
726
+
727
+    must_have_one_flag=()
728
+    must_have_one_noun=()
729
+}
730
+
731
+_osc_exec()
732
+{
733
+    last_command="osc_exec"
734
+    commands=()
735
+
736
+    flags=()
737
+    two_word_flags=()
738
+    flags_with_completion=()
739
+    flags_completion=()
740
+
741
+    flags+=("--container=")
742
+    two_word_flags+=("-c")
743
+    flags+=("--help")
744
+    flags+=("-h")
745
+    flags+=("--pod=")
746
+    two_word_flags+=("-p")
747
+    flags+=("--stdin")
748
+    flags+=("-i")
749
+    flags+=("--tty")
750
+    flags+=("-t")
751
+
752
+    must_have_one_flag=()
753
+    must_have_one_flag+=("--container=")
754
+    must_have_one_flag+=("-c")
755
+    must_have_one_flag+=("--pod=")
756
+    must_have_one_flag+=("-p")
757
+    must_have_one_noun=()
758
+}
759
+
760
+_osc_port-forward()
761
+{
762
+    last_command="osc_port-forward"
763
+    commands=()
764
+
765
+    flags=()
766
+    two_word_flags=()
767
+    flags_with_completion=()
768
+    flags_completion=()
769
+
770
+    flags+=("--help")
771
+    flags+=("-h")
772
+    flags+=("--pod=")
773
+    two_word_flags+=("-p")
774
+
775
+    must_have_one_flag=()
776
+    must_have_one_flag+=("--pod=")
777
+    must_have_one_flag+=("-p")
778
+    must_have_one_noun=()
779
+}
780
+
781
+_osc_proxy()
782
+{
783
+    last_command="osc_proxy"
784
+    commands=()
785
+
786
+    flags=()
787
+    two_word_flags=()
788
+    flags_with_completion=()
789
+    flags_completion=()
790
+
791
+    flags+=("--api-prefix=")
792
+    flags+=("--help")
793
+    flags+=("-h")
794
+    flags+=("--port=")
795
+    two_word_flags+=("-p")
796
+    flags+=("--www=")
797
+    two_word_flags+=("-w")
798
+    flags+=("--www-prefix=")
799
+    two_word_flags+=("-P")
800
+
801
+    must_have_one_flag=()
802
+    must_have_one_noun=()
803
+}
804
+
805
+_osc_config_view()
806
+{
807
+    last_command="osc_config_view"
808
+    commands=()
809
+
810
+    flags=()
811
+    two_word_flags=()
812
+    flags_with_completion=()
813
+    flags_completion=()
814
+
815
+    flags+=("--flatten")
816
+    flags+=("--help")
817
+    flags+=("-h")
818
+    flags+=("--merge")
819
+    flags+=("--minify")
820
+    flags+=("--no-headers")
821
+    flags+=("--output=")
822
+    two_word_flags+=("-o")
823
+    flags+=("--output-version=")
824
+    flags+=("--raw")
825
+    flags+=("--template=")
826
+    two_word_flags+=("-t")
827
+
828
+    must_have_one_flag=()
829
+    must_have_one_noun=()
830
+}
831
+
832
+_osc_config_set-cluster()
833
+{
834
+    last_command="osc_config_set-cluster"
835
+    commands=()
836
+
837
+    flags=()
838
+    two_word_flags=()
839
+    flags_with_completion=()
840
+    flags_completion=()
841
+
842
+    flags+=("--api-version=")
843
+    flags+=("--certificate-authority=")
844
+    flags+=("--embed-certs")
845
+    flags+=("--help")
846
+    flags+=("-h")
847
+    flags+=("--insecure-skip-tls-verify")
848
+    flags+=("--server=")
849
+
850
+    must_have_one_flag=()
851
+    must_have_one_noun=()
852
+}
853
+
854
+_osc_config_set-credentials()
855
+{
856
+    last_command="osc_config_set-credentials"
857
+    commands=()
858
+
859
+    flags=()
860
+    two_word_flags=()
861
+    flags_with_completion=()
862
+    flags_completion=()
863
+
864
+    flags+=("--auth-path=")
865
+    flags+=("--client-certificate=")
866
+    flags+=("--client-key=")
867
+    flags+=("--embed-certs")
868
+    flags+=("--help")
869
+    flags+=("-h")
870
+    flags+=("--password=")
871
+    flags+=("--token=")
872
+    flags+=("--username=")
873
+
874
+    must_have_one_flag=()
875
+    must_have_one_noun=()
876
+}
877
+
878
+_osc_config_set-context()
879
+{
880
+    last_command="osc_config_set-context"
881
+    commands=()
882
+
883
+    flags=()
884
+    two_word_flags=()
885
+    flags_with_completion=()
886
+    flags_completion=()
887
+
888
+    flags+=("--cluster=")
889
+    flags+=("--help")
890
+    flags+=("-h")
891
+    flags+=("--namespace=")
892
+    flags+=("--user=")
893
+
894
+    must_have_one_flag=()
895
+    must_have_one_noun=()
896
+}
897
+
898
+_osc_config_set()
899
+{
900
+    last_command="osc_config_set"
901
+    commands=()
902
+
903
+    flags=()
904
+    two_word_flags=()
905
+    flags_with_completion=()
906
+    flags_completion=()
907
+
908
+    flags+=("--help")
909
+    flags+=("-h")
910
+
911
+    must_have_one_flag=()
912
+    must_have_one_noun=()
913
+}
914
+
915
+_osc_config_unset()
916
+{
917
+    last_command="osc_config_unset"
918
+    commands=()
919
+
920
+    flags=()
921
+    two_word_flags=()
922
+    flags_with_completion=()
923
+    flags_completion=()
924
+
925
+    flags+=("--help")
926
+    flags+=("-h")
927
+
928
+    must_have_one_flag=()
929
+    must_have_one_noun=()
930
+}
931
+
932
+_osc_config_use-context()
933
+{
934
+    last_command="osc_config_use-context"
935
+    commands=()
936
+
937
+    flags=()
938
+    two_word_flags=()
939
+    flags_with_completion=()
940
+    flags_completion=()
941
+
942
+    flags+=("--help")
943
+    flags+=("-h")
944
+
945
+    must_have_one_flag=()
946
+    must_have_one_noun=()
947
+}
948
+
949
+_osc_config()
950
+{
951
+    last_command="osc_config"
952
+    commands=()
953
+    commands+=("view")
954
+    commands+=("set-cluster")
955
+    commands+=("set-credentials")
956
+    commands+=("set-context")
957
+    commands+=("set")
958
+    commands+=("unset")
959
+    commands+=("use-context")
960
+
961
+    flags=()
962
+    two_word_flags=()
963
+    flags_with_completion=()
964
+    flags_completion=()
965
+
966
+    flags+=("--config=")
967
+    flags+=("--help")
968
+    flags+=("-h")
969
+
970
+    must_have_one_flag=()
971
+    must_have_one_noun=()
972
+}
973
+
974
+_osc_options()
975
+{
976
+    last_command="osc_options"
977
+    commands=()
978
+
979
+    flags=()
980
+    two_word_flags=()
981
+    flags_with_completion=()
982
+    flags_completion=()
983
+
984
+    flags+=("--help")
985
+    flags+=("-h")
986
+
987
+    must_have_one_flag=()
988
+    must_have_one_noun=()
989
+}
990
+
991
+_osc()
992
+{
993
+    last_command="osc"
994
+    commands=()
995
+    commands+=("login")
996
+    commands+=("logout")
997
+    commands+=("project")
998
+    commands+=("new-project")
999
+    commands+=("new-app")
1000
+    commands+=("status")
1001
+    commands+=("start-build")
1002
+    commands+=("cancel-build")
1003
+    commands+=("build-logs")
1004
+    commands+=("deploy")
1005
+    commands+=("rollback")
1006
+    commands+=("get")
1007
+    commands+=("describe")
1008
+    commands+=("create")
1009
+    commands+=("process")
1010
+    commands+=("edit")
1011
+    commands+=("update")
1012
+    commands+=("delete")
1013
+    commands+=("log")
1014
+    commands+=("exec")
1015
+    commands+=("port-forward")
1016
+    commands+=("proxy")
1017
+    commands+=("config")
1018
+    commands+=("options")
1019
+
1020
+    flags=()
1021
+    two_word_flags=()
1022
+    flags_with_completion=()
1023
+    flags_completion=()
1024
+
1025
+    flags+=("--allow_dynamic_housekeeping")
1026
+    flags+=("--alsologtostderr")
1027
+    flags+=("--api-version=")
1028
+    flags+=("--auth-path=")
1029
+    flags+=("--boot_id_file=")
1030
+    flags+=("--certificate-authority=")
1031
+    flags+=("--client-certificate=")
1032
+    flags+=("--client-key=")
1033
+    flags+=("--cluster=")
1034
+    flags+=("--config=")
1035
+    flags+=("--container_hints=")
1036
+    flags+=("--context=")
1037
+    flags+=("--docker=")
1038
+    flags+=("--docker_root=")
1039
+    flags+=("--docker_run=")
1040
+    flags+=("--enable_load_reader")
1041
+    flags+=("--global_housekeeping_interval=")
1042
+    flags+=("--google-json-key=")
1043
+    flags+=("--help")
1044
+    flags+=("-h")
1045
+    flags+=("--housekeeping_interval=")
1046
+    flags+=("--httptest.serve=")
1047
+    flags+=("--insecure-skip-tls-verify")
1048
+    flags+=("--log_backtrace_at=")
1049
+    flags+=("--log_cadvisor_usage")
1050
+    flags+=("--log_dir=")
1051
+    flags+=("--log_flush_frequency=")
1052
+    flags+=("--logtostderr")
1053
+    flags+=("--machine_id_file=")
1054
+    flags+=("--match-server-version")
1055
+    flags+=("--max_housekeeping_interval=")
1056
+    flags+=("--namespace=")
1057
+    two_word_flags+=("-n")
1058
+    flags+=("--server=")
1059
+    flags+=("--stderrthreshold=")
1060
+    flags+=("--token=")
1061
+    flags+=("--user=")
1062
+    flags+=("--v=")
1063
+    flags+=("--validate")
1064
+    flags+=("--vmodule=")
1065
+
1066
+    must_have_one_flag=()
1067
+    must_have_one_noun=()
1068
+}
1069
+
1070
+__start_osc()
1071
+{
1072
+    local cur prev words cword
1073
+    _init_completion -s || return
1074
+
1075
+    local c=0
1076
+    local flags=()
1077
+    local two_word_flags=()
1078
+    local flags_with_completion=()
1079
+    local flags_completion=()
1080
+    local commands=("osc")
1081
+    local must_have_one_flag=()
1082
+    local must_have_one_noun=()
1083
+    local last_command
1084
+    local nouns=()
1085
+
1086
+    __handle_word
1087
+}
1088
+
1089
+complete -F __start_osc osc
1090
+# ex: ts=4 sw=4 et filetype=sh