mirror of
				https://github.com/ohmyzsh/ohmyzsh.git
				synced 2024-05-11 05:55:17 +00:00 
			
		
		
		
	kubectl: verify kubectl is installed before running compdef (#9346)
This commit is contained in:
		@@ -150,19 +150,13 @@ alias kepvc='kubectl edit pvc'
 | 
				
			|||||||
alias kdpvc='kubectl describe pvc'
 | 
					alias kdpvc='kubectl describe pvc'
 | 
				
			||||||
alias kdelpvc='kubectl delete pvc'
 | 
					alias kdelpvc='kubectl delete pvc'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Colored JSON output
 | 
					# Only run if the user actually has kubectl installed
 | 
				
			||||||
kj() {
 | 
					if (( $+commands[kubectl] )); then
 | 
				
			||||||
  kubectl "$@" -o json | jq
 | 
					  kj() { kubectl "$@" -o json | jq; }
 | 
				
			||||||
}
 | 
					  kjx() { kubectl "$@" -o json | fx; }
 | 
				
			||||||
compdef kj=kubectl
 | 
					  ky() { kubectl "$@" -o yaml | yh; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
kjx() {
 | 
					  compdef kj=kubectl
 | 
				
			||||||
  kubectl "$@" -o json | fx
 | 
					  compdef kjx=kubectl
 | 
				
			||||||
}
 | 
					  compdef ky=kubectl
 | 
				
			||||||
compdef kjx=kubectl
 | 
					fi
 | 
				
			||||||
 | 
					 | 
				
			||||||
# Colored YAML output
 | 
					 | 
				
			||||||
ky() {
 | 
					 | 
				
			||||||
  kubectl "$@" -o yaml | yh
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
compdef ky=kubectl
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user