Skip to content

Commit

Permalink
fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasliddledba committed Jul 20, 2021
1 parent d0f6e22 commit c4fc086
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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".

Expand Down
Binary file modified bin/kubectxwin.exe
Binary file not shown.
14 changes: 11 additions & 3 deletions kubectxwin.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ function usage() {
Usage
kubectxwin : current context
kubectxwin ls : list the contexts
kubectxwin set <name> : switch to context <name>
kubectxwin set <name> | 'n/a' : switch context Note: 'n/a' will create/set a new empty context
kubectxwin rn <oldname> <newname> : rename context <oldname> <newname>
kubectxwin rm <name> : delete context <name>
kubectxwin help : display usage"
kubectxwin help : display usage
"
}

function current_context() {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit c4fc086

Please sign in to comment.