mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00: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
1 changed files with 2 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue