Skip to content

Instantly share code, notes, and snippets.

@Southclaws
Created August 11, 2025 11:14
Show Gist options
  • Select an option

  • Save Southclaws/bcd81d62d733afe41d16b3005383fdf2 to your computer and use it in GitHub Desktop.

Select an option

Save Southclaws/bcd81d62d733afe41d16b3005383fdf2 to your computer and use it in GitHub Desktop.
kubectx auto switch via .kctx file
env_change: {
PWD: [
{
condition: {|before, after|
true
}
code: {|before, after|
let file = ([$after ".kctx"] | path join)
if ($file | path exists) {
let target = (open --raw $file | str trim)
^kubectx $target | ignore
print $"☸️ kubectx → ($target)"
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment