diff --git a/kubectx b/kubectx index 4348b2b..bf33a25 100755 --- a/kubectx +++ b/kubectx @@ -30,6 +30,7 @@ USAGE: kubectx : switch to context kubectx - : switch to the previous context kubectx = : rename context to + kubectx =. : rename current-context to kubectx -h,--help : show this message EOF exit 1 @@ -122,6 +123,10 @@ rename_context() { local old_name="${1}" local new_name="${2}" + if [[ "${old_name}" == "." ]]; then + old_name="$(current_context)" + fi + # TODO(ahmetb) old_user and old_cluster are no longer used, clean up local old_user old_cluster old_user="$(user_of_context "${old_name}")"