Created
August 11, 2025 11:14
-
-
Save Southclaws/bcd81d62d733afe41d16b3005383fdf2 to your computer and use it in GitHub Desktop.
kubectx auto switch via .kctx file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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