mirror of
https://github.com/nushell/nu_scripts.git
synced 2024-10-26 22:08:03 +03:00
Fix the problem that the KUBECONFIG file does not exist (#476)
Co-authored-by: agent <agent@nuc>
This commit is contained in:
parent
09647b77ee
commit
5b6d20d0bd
@ -13,6 +13,7 @@ def ensure-cache [cache path action] {
|
||||
def "kube ctx" [] {
|
||||
let cache = $'($env.HOME)/.cache/nu-power/kube.json'
|
||||
let file = if ($env.KUBECONFIG? | is-empty) { $"($env.HOME)/.kube/config" } else { $env.KUBECONFIG }
|
||||
if not ($file | path exists) { return $nothing }
|
||||
ensure-cache $cache $file {
|
||||
do -i {
|
||||
kubectl config get-contexts
|
||||
@ -26,10 +27,10 @@ def "kube ctx" [] {
|
||||
def kube_stat [] {
|
||||
{||
|
||||
let ctx = (kube ctx)
|
||||
let theme = $env.NU_POWER_THEME.kube
|
||||
if ($ctx | is-empty) {
|
||||
""
|
||||
} else {
|
||||
let theme = $env.NU_POWER_THEME.kube
|
||||
let c = if $ctx.AUTHINFO == $ctx.CLUSTER {
|
||||
$ctx.CLUSTER
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user