diff --git a/README.md b/README.md index 9e66b7f..7ed1628 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,10 @@ sandbox $ kubectxwin set sandbox Switched to context "sandbox". +$ kubectxwin set 'n/a' +Context "no-context" modified. +Switched to context "no-context". + $ kubectxwin rn sandbox sandbox-old Context "sandbox" renamed to "sandbox-old". diff --git a/bin/kubectxwin.exe b/bin/kubectxwin.exe index 08bd129..8fc6781 100644 Binary files a/bin/kubectxwin.exe and b/bin/kubectxwin.exe differ diff --git a/kubectxwin.ps1 b/kubectxwin.ps1 index 7c8ba6b..08f432a 100644 --- a/kubectxwin.ps1 +++ b/kubectxwin.ps1 @@ -12,10 +12,11 @@ function usage() { Usage kubectxwin : current context kubectxwin ls : list the contexts - kubectxwin set : switch to context + kubectxwin set | 'n/a' : switch context Note: 'n/a' will create/set a new empty context kubectxwin rn : rename context kubectxwin rm : delete context - kubectxwin help : display usage" + kubectxwin help : display usage + " } function current_context() { @@ -48,7 +49,14 @@ function list_contexts() { } function switch_context($context) { - kubectl config use-context $context + if ($context -eq 'n/a') { + kubectl config set-context no-context + kubectl config use-context no-context + } + else { + kubectl config use-context $context + } + } function main() {