mirror of https://github.com/k3s-io/k3s
Enable kubectl exec pod name bash completion
parent
9ad982ef77
commit
46eb607677
|
@ -181,6 +181,11 @@ __kubectl_get_resource()
|
|||
__kubectl_parse_get "${nouns[${#nouns[@]} -1]}"
|
||||
}
|
||||
|
||||
__kubectl_get_resource_pod()
|
||||
{
|
||||
__kubectl_parse_get "pod"
|
||||
}
|
||||
|
||||
# $1 is the name of the pod we want to get the list of containers inside
|
||||
__kubectl_get_containers()
|
||||
{
|
||||
|
@ -213,13 +218,17 @@ __kubectl_require_pod_and_container()
|
|||
__custom_func() {
|
||||
case ${last_command} in
|
||||
kubectl_get | kubectl_describe | kubectl_delete | kubectl_label | kubectl_stop)
|
||||
__kubectl_get_resource
|
||||
__kubectl_get_resource
|
||||
return
|
||||
;;
|
||||
kubectl_logs)
|
||||
__kubectl_require_pod_and_container
|
||||
return
|
||||
;;
|
||||
kubectl_exec)
|
||||
__kubectl_get_resource_pod
|
||||
return
|
||||
;;
|
||||
kubectl_logs)
|
||||
__kubectl_require_pod_and_container
|
||||
return
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -47,6 +47,11 @@ __kubectl_get_resource()
|
|||
__kubectl_parse_get "${nouns[${#nouns[@]} -1]}"
|
||||
}
|
||||
|
||||
__kubectl_get_resource_pod()
|
||||
{
|
||||
__kubectl_parse_get "pod"
|
||||
}
|
||||
|
||||
# $1 is the name of the pod we want to get the list of containers inside
|
||||
__kubectl_get_containers()
|
||||
{
|
||||
|
@ -79,13 +84,17 @@ __kubectl_require_pod_and_container()
|
|||
__custom_func() {
|
||||
case ${last_command} in
|
||||
kubectl_get | kubectl_describe | kubectl_delete | kubectl_label | kubectl_stop)
|
||||
__kubectl_get_resource
|
||||
__kubectl_get_resource
|
||||
return
|
||||
;;
|
||||
kubectl_logs)
|
||||
__kubectl_require_pod_and_container
|
||||
return
|
||||
;;
|
||||
kubectl_exec)
|
||||
__kubectl_get_resource_pod
|
||||
return
|
||||
;;
|
||||
kubectl_logs)
|
||||
__kubectl_require_pod_and_container
|
||||
return
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
|
Loading…
Reference in New Issue