_tkn (23097B)
1 #compdef _tkn tkn 2 3 4 5 6 function _tkn { 7 local -a commands 8 9 _arguments -C \ 10 "1: :->cmnds" \ 11 "*::arg:->args" 12 13 case $state in 14 cmnds) 15 commands=( 16 "clustertask:Manage clustertasks" 17 "completion:Prints shell completion scripts" 18 "help:Help about any command" 19 "pipeline:Manage pipelines" 20 "pipelinerun:Manage pipelineruns" 21 "resource:Manage pipeline resources" 22 "task:Manage tasks" 23 "taskrun:Manage taskruns" 24 "version:Prints version information" 25 ) 26 _describe "command" commands 27 ;; 28 esac 29 30 case "$words[1]" in 31 clustertask) 32 _tkn_clustertask 33 ;; 34 completion) 35 _tkn_completion 36 ;; 37 help) 38 _tkn_help 39 ;; 40 pipeline) 41 _tkn_pipeline 42 ;; 43 pipelinerun) 44 _tkn_pipelinerun 45 ;; 46 resource) 47 _tkn_resource 48 ;; 49 task) 50 _tkn_task 51 ;; 52 taskrun) 53 _tkn_taskrun 54 ;; 55 version) 56 _tkn_version 57 ;; 58 esac 59 } 60 61 62 function _tkn_clustertask { 63 local -a commands 64 65 _arguments -C \ 66 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 67 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 68 "1: :->cmnds" \ 69 "*::arg:->args" 70 71 case $state in 72 cmnds) 73 commands=( 74 "delete:Delete a clustertask resource in a cluster" 75 "list:Lists clustertasks in a namespace" 76 ) 77 _describe "command" commands 78 ;; 79 esac 80 81 case "$words[1]" in 82 delete) 83 _tkn_clustertask_delete 84 ;; 85 list) 86 _tkn_clustertask_list 87 ;; 88 esac 89 } 90 91 function _tkn_clustertask_delete { 92 _arguments \ 93 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 94 '(-f --force)'{-f,--force}'[Whether to force deletion (default: false)]' \ 95 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 96 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 97 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 98 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 99 '1: :__tkn_get_clustertasks' 100 } 101 102 function _tkn_clustertask_list { 103 _arguments \ 104 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 105 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 106 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 107 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 108 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' 109 } 110 111 function _tkn_completion { 112 _arguments \ 113 '(-h --help)'{-h,--help}'[help for completion]' \ 114 '1: :("bash" "zsh")' 115 } 116 117 function _tkn_help { 118 _arguments 119 } 120 121 122 function _tkn_pipeline { 123 local -a commands 124 125 _arguments -C \ 126 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 127 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 128 "1: :->cmnds" \ 129 "*::arg:->args" 130 131 case $state in 132 cmnds) 133 commands=( 134 "delete:Delete a pipeline in a namespace" 135 "describe:Describes a pipeline in a namespace" 136 "list:Lists pipelines in a namespace" 137 "logs:Show pipeline logs" 138 "start:Start pipelines" 139 ) 140 _describe "command" commands 141 ;; 142 esac 143 144 case "$words[1]" in 145 delete) 146 _tkn_pipeline_delete 147 ;; 148 describe) 149 _tkn_pipeline_describe 150 ;; 151 list) 152 _tkn_pipeline_list 153 ;; 154 logs) 155 _tkn_pipeline_logs 156 ;; 157 start) 158 _tkn_pipeline_start 159 ;; 160 esac 161 } 162 163 function _tkn_pipeline_delete { 164 _arguments \ 165 '(-a --all)'{-a,--all}'[Whether to delete related resources (pipelineruns) (default: false)]' \ 166 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 167 '(-f --force)'{-f,--force}'[Whether to force deletion (default: false)]' \ 168 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 169 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 170 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 171 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 172 '1: :__tkn_get_pipeline' 173 } 174 175 function _tkn_pipeline_describe { 176 _arguments \ 177 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 178 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 179 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 180 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 181 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 182 '1: :__tkn_get_pipeline' 183 } 184 185 function _tkn_pipeline_list { 186 _arguments \ 187 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 188 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 189 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 190 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 191 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' 192 } 193 194 function _tkn_pipeline_logs { 195 _arguments \ 196 '(-a --all)'{-a,--all}'[show all logs including init steps injected by tekton]' \ 197 '(-f --follow)'{-f,--follow}'[stream live logs]' \ 198 '(-l --last)'{-l,--last}'[show logs for last run]' \ 199 '(-L --limit)'{-L,--limit}'[lists number of pipelineruns]:()' \ 200 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 201 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 202 '1: :__tkn_get_pipeline' 203 } 204 205 function _tkn_pipeline_start { 206 _arguments \ 207 '(-l --last)'{-l,--last}'[re-run the pipeline using last pipelinerun values]' \ 208 '(*-p *--param)'{\*-p,\*--param}'[pass the param as key=value]:()' \ 209 '(*-r *--resource)'{\*-r,\*--resource}'[pass the resource name and ref as name=ref]:()' \ 210 '(-s --serviceaccount)'{-s,--serviceaccount}'[pass the serviceaccount name]: :__kubectl_get_serviceaccount' \ 211 '*--task-serviceaccount[pass the service account corresponding to the task]: :__kubectl_get_serviceaccount' \ 212 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 213 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 214 '1: :__tkn_get_pipeline' 215 } 216 217 218 function _tkn_pipelinerun { 219 local -a commands 220 221 _arguments -C \ 222 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 223 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 224 "1: :->cmnds" \ 225 "*::arg:->args" 226 227 case $state in 228 cmnds) 229 commands=( 230 "cancel:Cancel the PipelineRun" 231 "delete:Delete a pipelinerun in a namespace" 232 "describe:Describe a pipelinerun in a namespace" 233 "list:Lists pipelineruns in a namespace" 234 "logs:Show the logs of PipelineRun" 235 ) 236 _describe "command" commands 237 ;; 238 esac 239 240 case "$words[1]" in 241 cancel) 242 _tkn_pipelinerun_cancel 243 ;; 244 delete) 245 _tkn_pipelinerun_delete 246 ;; 247 describe) 248 _tkn_pipelinerun_describe 249 ;; 250 list) 251 _tkn_pipelinerun_list 252 ;; 253 logs) 254 _tkn_pipelinerun_logs 255 ;; 256 esac 257 } 258 259 function _tkn_pipelinerun_cancel { 260 _arguments \ 261 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 262 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 263 '1: :__tkn_get_pipelinerun' 264 } 265 266 function _tkn_pipelinerun_delete { 267 _arguments \ 268 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 269 '(-f --force)'{-f,--force}'[Whether to force deletion (default: false)]' \ 270 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 271 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 272 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 273 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 274 '1: :__tkn_get_pipelinerun' 275 } 276 277 function _tkn_pipelinerun_describe { 278 _arguments \ 279 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 280 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 281 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 282 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 283 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 284 '1: :__tkn_get_pipelinerun' 285 } 286 287 function _tkn_pipelinerun_list { 288 _arguments \ 289 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 290 '(-l --limit)'{-l,--limit}'[limit pipelineruns listed (default: return all pipelineruns)]:()' \ 291 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 292 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 293 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 294 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' 295 } 296 297 function _tkn_pipelinerun_logs { 298 _arguments \ 299 '(-a --all)'{-a,--all}'[show all logs including init steps injected by tekton]' \ 300 '(-f --follow)'{-f,--follow}'[stream live logs]' \ 301 '(*-t *--only-tasks)'{\*-t,\*--only-tasks}'[show logs for mentioned tasks only]:()' \ 302 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 303 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 304 '1: :__tkn_get_pipelinerun' 305 } 306 307 308 function _tkn_resource { 309 local -a commands 310 311 _arguments -C \ 312 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 313 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 314 "1: :->cmnds" \ 315 "*::arg:->args" 316 317 case $state in 318 cmnds) 319 commands=( 320 "delete:Delete a pipeline resource in a namespace" 321 "describe:Describes a pipeline resource in a namespace" 322 "list:Lists pipeline resources in a namespace" 323 ) 324 _describe "command" commands 325 ;; 326 esac 327 328 case "$words[1]" in 329 delete) 330 _tkn_resource_delete 331 ;; 332 describe) 333 _tkn_resource_describe 334 ;; 335 list) 336 _tkn_resource_list 337 ;; 338 esac 339 } 340 341 function _tkn_resource_delete { 342 _arguments \ 343 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 344 '(-f --force)'{-f,--force}'[Whether to force deletion (default: false)]' \ 345 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 346 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 347 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 348 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 349 '1: :__tkn_get_pipelineresource' 350 } 351 352 function _tkn_resource_describe { 353 _arguments \ 354 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 355 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 356 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 357 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 358 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 359 '1: :__tkn_get_pipelineresource' 360 } 361 362 function _tkn_resource_list { 363 _arguments \ 364 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 365 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 366 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 367 '(-t --type)'{-t,--type}'[Pipeline resource type]:()' \ 368 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 369 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' 370 } 371 372 373 function _tkn_task { 374 local -a commands 375 376 _arguments -C \ 377 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 378 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 379 "1: :->cmnds" \ 380 "*::arg:->args" 381 382 case $state in 383 cmnds) 384 commands=( 385 "delete:Delete a task resource in a namespace" 386 "list:Lists tasks in a namespace" 387 ) 388 _describe "command" commands 389 ;; 390 esac 391 392 case "$words[1]" in 393 delete) 394 _tkn_task_delete 395 ;; 396 list) 397 _tkn_task_list 398 ;; 399 esac 400 } 401 402 function _tkn_task_delete { 403 _arguments \ 404 '(-a --all)'{-a,--all}'[Whether to delete related resources (taskruns) (default: false)]' \ 405 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 406 '(-f --force)'{-f,--force}'[Whether to force deletion (default: false)]' \ 407 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 408 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 409 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 410 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 411 '1: :__tkn_get_task' 412 } 413 414 function _tkn_task_list { 415 _arguments \ 416 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 417 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 418 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 419 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 420 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' 421 } 422 423 424 function _tkn_taskrun { 425 local -a commands 426 427 _arguments -C \ 428 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 429 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 430 "1: :->cmnds" \ 431 "*::arg:->args" 432 433 case $state in 434 cmnds) 435 commands=( 436 "delete:Delete a taskrun in a namespace" 437 "list:Lists taskruns in a namespace" 438 "logs:Show taskruns logs" 439 ) 440 _describe "command" commands 441 ;; 442 esac 443 444 case "$words[1]" in 445 delete) 446 _tkn_taskrun_delete 447 ;; 448 list) 449 _tkn_taskrun_list 450 ;; 451 logs) 452 _tkn_taskrun_logs 453 ;; 454 esac 455 } 456 457 function _tkn_taskrun_delete { 458 _arguments \ 459 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 460 '(-f --force)'{-f,--force}'[Whether to force deletion (default: false)]' \ 461 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 462 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 463 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 464 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 465 '1: :__tkn_get_taskrun' 466 } 467 468 function _tkn_taskrun_list { 469 _arguments \ 470 '--allow-missing-template-keys[If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats.]' \ 471 '(-l --limit)'{-l,--limit}'[limit taskruns listed (default: return all taskruns)]:()' \ 472 '(-o --output)'{-o,--output}'[Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.]:()' \ 473 '--template[Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates \[http://golang.org/pkg/text/template/#pkg-overview\].]:filename:_files' \ 474 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 475 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' 476 } 477 478 function _tkn_taskrun_logs { 479 _arguments \ 480 '(-a --all)'{-a,--all}'[show all logs including init steps injected by tekton]' \ 481 '(-f --follow)'{-f,--follow}'[stream live logs]' \ 482 '(-k --kubeconfig)'{-k,--kubeconfig}'[kubectl config file (default: $HOME/.kube/config)]: :_filedir' \ 483 '(-n --namespace)'{-n,--namespace}'[namespace to use (default: from $KUBECONFIG)]: :__kubectl_get_namespace' \ 484 '1: :__tkn_get_taskrun' 485 } 486 487 function _tkn_version { 488 _arguments \ 489 '(-c --check)'{-c,--check}'[check if a newer version is available]' 490 } 491 492 493 # Custom function for Completions 494 function __tkn_get_object() { 495 local type=$1 496 local util=$2 497 local template begin tkn_out 498 template="{{ range .items }}{{ .metadata.name }} {{ end }}" 499 500 if [[ ${util} == "kubectl" ]];then 501 tkn_out=($(kubectl get ${type} -o template --template="${template}" 2>/dev/null)) 502 elif [[ ${util} == "tkn" ]];then 503 tkn_out=($(tkn ${type} ls -o template --template="${template}" 2>/dev/null)) 504 fi 505 506 if [[ -n ${tkn_out} ]]; then 507 [[ -n ${BASH_VERSION} ]] && COMPREPLY=( $( compgen -W "${tkn_out}" -- "$cur" ) ) 508 [[ -n ${ZSH_VERSION} ]] && compadd ${tkn_out} 509 fi 510 } 511 512 function __kubectl_get_namespace() { __tkn_get_object namespace kubectl ;} 513 function __kubectl_get_serviceaccount() { __tkn_get_object serviceaccount kubectl ;} 514 function __tkn_get_pipeline() { __tkn_get_object pipeline tkn ;} 515 function __tkn_get_pipelinerun() { __tkn_get_object pipelinerun tkn ;} 516 function __tkn_get_taskrun() { __tkn_get_object taskrun tkn ;} 517 function __tkn_get_pipelineresource() { __tkn_get_object resource tkn ;} 518 function __tkn_get_clustertasks() { __tkn_get_object clustertasks tkn ;}