justjanne / powerline-go

A beautiful and useful low-latency prompt for your shell, written in go
GNU General Public License v3.0
2.73k stars 268 forks source link

support custom Kubernetes cluster name shortening with regex #326

Closed joemiller closed 3 years ago

joemiller commented 3 years ago

Adds two new flags:

Examples:

Assume a kubernetes cluster named myorg-region-profile-cluster-01

Using the default template:

powerline-go -shorten-kube-names-regex-match '^myorg-\w+-\w+-(.*)'

result: cluster-01

Using a custom template:

powerline-go -shorten-kube-names-regex-match '^myorg-(\w+)-\w+-(.*)' -shorten-kube-names-regex-template '${1}/${2}'

result: region/cluster-01