mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Add support for 'vaulted' shells in agnoster theme
If a user is currently in a [vaulted](github.com/miquella/vaulted) shell, they will now have an indication of this in the agnoster prompt, not unlike the virtualenv prompt. The foreground color will switch if the timer expires (which usually signifies that the temporary Amazon keys generated by vaulted will be invalid).
This commit is contained in:
parent
291e96dcd0
commit
d5f713e950
1 changed files with 18 additions and 0 deletions
|
|
@ -198,6 +198,23 @@ prompt_virtualenv() {
|
|||
fi
|
||||
}
|
||||
|
||||
# vaulted: current vaulted shell
|
||||
prompt_vaulted() {
|
||||
if [[ -z $VAULTED_ENV ]]; then
|
||||
return
|
||||
fi
|
||||
local exp=$(echo $VAULTED_ENV_EXPIRATION | sed 's/Z/+0000/')
|
||||
local valid_until=$(date -j -f %Y-%m-%dT%H:%M:%S%z $exp +%s)
|
||||
local bg=009 #orange
|
||||
local fg=black
|
||||
if [[ $valid_until -lt $(date +%s) ]]; then
|
||||
fg=blue
|
||||
fi
|
||||
if [[ -n $VAULTED_ENV ]]; then
|
||||
prompt_segment $bg $fg "$VAULTED_ENV"
|
||||
fi
|
||||
}
|
||||
|
||||
# Status:
|
||||
# - was there an error
|
||||
# - am I root
|
||||
|
|
@ -217,6 +234,7 @@ build_prompt() {
|
|||
RETVAL=$?
|
||||
prompt_status
|
||||
prompt_virtualenv
|
||||
prompt_vaulted
|
||||
prompt_context
|
||||
prompt_dir
|
||||
prompt_git
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue