mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-07-04 02:56:12 +00:00
Merge pull request #37 from jvassev/fix-kubens
Allow for '/' in context name
This commit is contained in:
commit
cce04a3279
7
kubens
7
kubens
@ -53,8 +53,12 @@ get_namespaces() {
|
|||||||
kubectl get namespaces -o=jsonpath='{range .items[*].metadata.name}{@}{"\n"}{end}'
|
kubectl get namespaces -o=jsonpath='{range .items[*].metadata.name}{@}{"\n"}{end}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
escape_context_name() {
|
||||||
|
echo "${1//\//-}"
|
||||||
|
}
|
||||||
|
|
||||||
namespace_file() {
|
namespace_file() {
|
||||||
local ctx="${1}"
|
local ctx="$(escape_context_name "${1}")"
|
||||||
echo "${KUBENS_DIR}/${ctx}"
|
echo "${KUBENS_DIR}/${ctx}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +66,7 @@ read_namespace() {
|
|||||||
local f
|
local f
|
||||||
f="$(namespace_file "${1}")"
|
f="$(namespace_file "${1}")"
|
||||||
[[ -f "${f}" ]] && cat "${f}"
|
[[ -f "${f}" ]] && cat "${f}"
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
save_namespace() {
|
save_namespace() {
|
||||||
|
Loading…
Reference in New Issue
Block a user