reobin / typewritten

A minimal, lightweight, informative zsh prompt theme

Home Page:https://typewritten.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can we add kubernetes integration?

mosheavni opened this issue · comments

Is your feature request related to a problem? Please describe.
No, just a feature to display the kubernetes cluster I'm in + the namespace

Describe the solution you'd like
To display the kubernetes cluster I'm in + the namespace

Describe alternatives you've considered
If it would be possible to add my custom functions that could also work.

Hey @Moshem123 !

What would your function look like?

I really like the option of letting a user add a prefix to the left prompt that could be a function or simply text, so we might go with that.

Here's what I want to add:
https://github.com/jonmosco/kube-ps1

@mosheavni Here is my solution to the problem:

image

k8s_current_context() {
  echo "[k8s:$(kubectl config current-context | awk -F'/' '{print $2}')]";
}

export TYPEWRITTEN_RIGHT_PROMPT_PREFIX_FUNCTION=k8s_current_context
export TYPEWRITTEN_COLORS="right_prompt_prefix:#FF80BF"

Specifically you may need to tailor any post processing of the current context, which in my case I achieve with: awk -F'/' '{print $2}'