mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
get deploy complete for ka/kl in kubernetes module (#680)
`kubectl exec` and `kubectl log` support a deployment as argrument. Get deployment for completion
This commit is contained in:
parent
0a5c82274f
commit
c65ae517d0
1 changed files with 11 additions and 2 deletions
|
@ -548,6 +548,15 @@ def "nu-complete kube pods" [context: string, offset: int] {
|
|||
kubectl get $ns pods | from ssv -a | get NAME
|
||||
}
|
||||
|
||||
def "nu-complete kube pods or deploys" [context: string, offset: int] {
|
||||
let ctx = ($context | argx parse)
|
||||
let ns = (do -i { $ctx | get namespace })
|
||||
let ns = (spr [-n $ns])
|
||||
let pods = (kubectl $ns get pods -o name|lines)
|
||||
let deploys = (kubectl $ns get deploy -o name|lines)
|
||||
$pods | append $deploys
|
||||
}
|
||||
|
||||
def "nu-complete kube ctns" [context: string, offset: int] {
|
||||
let ctx = ($context | argx parse)
|
||||
let ns = (do -i { $ctx | get namespace })
|
||||
|
@ -601,7 +610,7 @@ export def kdp [
|
|||
|
||||
# kubectl attach (exec -it)
|
||||
export def ka [
|
||||
pod?: string@"nu-complete kube pods"
|
||||
pod?: string@"nu-complete kube pods or deploys"
|
||||
--namespace (-n): string@"nu-complete kube ns"
|
||||
--container(-c): string@"nu-complete kube ctns"
|
||||
--selector(-l): string
|
||||
|
@ -642,7 +651,7 @@ export def ka [
|
|||
|
||||
# kubectl logs
|
||||
export def kl [
|
||||
pod: string@"nu-complete kube pods"
|
||||
pod: string@"nu-complete kube pods or deploys"
|
||||
--namespace(-n): string@"nu-complete kube ns"
|
||||
--container(-c): string@"nu-complete kube ctns"
|
||||
--follow(-f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue