feat(agnoster): add VRF name to prompt if available

This commit is contained in:
Pierre-Emmanuel LE THIEC 2022-08-14 23:40:16 +02:00
parent 3668ec2a82
commit 983ef7c8d1

View file

@ -241,12 +241,25 @@ prompt_aws() {
esac esac
} }
# VRF Profile
# Display current VRF name
prompt_vrf() {
if ((${+commands[ip]} )); then
VRF=$(ip vrf identify)
[[ -z "$VRF" ]] && return
prompt_segment green black "${VRF:gs/%/%%}"
fi
}
## Main prompt ## Main prompt
build_prompt() { build_prompt() {
RETVAL=$? RETVAL=$?
prompt_status prompt_status
prompt_virtualenv prompt_virtualenv
prompt_aws prompt_aws
prompt_vrf
prompt_context prompt_context
prompt_dir prompt_dir
prompt_git prompt_git