Aller au contenu

Optional setup#

Rswitch addons#

Rswitch should be installed with toolbox

In your shell configuration files, you may add this function and alias (for example in ${HOME}/.bashrc.d/rswitch) :

function rswitch_login() {
  eval "$(rswitch login "$1" -e)"
}

alias r=rswitch_login

Prompt with starfish#

Web site#

Install starfish#

Starfish is evolving quickly so the best way to be up to date is to use your package manager.

If starfish is not managed by your package manager, you may try this :

sudo snap install starfish

Configure starfish#

Here is a suggested configuration file. Put it in ${HOME}/.config/starship.toml :

# Disable the newline at the start of the prompt
add_newline = false

# Replace the "❯" symbol in the prompt with "➜"
[character]      # The name of the module we are configuring is "character"
success_symbol = "[➜](bold green)"
error_symbol = "[➜](bold red)"

[custom.kswitch]
command = """ kubectl config current-context """
when = """ test $(kswitch --json | jq -e -r '. | select(.tunnel.status == "up") | select(.context == .tunnel.zone) | .context') = $(kubectl config current-context) """
style   = "bold white"
format = "[⚓ K/$output]($style) "

[custom.rswitch]
command = """ kubectl config current-context | sed -e 's/^rswitch-//' """
when = """ kubectl config current-context | grep -q ^rswitch- """
style   = "bold green"
format = "[⚓ R/$output]($style) "