Anything greater than an hour now in XhYm format

pull/282/head
Darren Kidd 4 years ago committed by Justin Hileman
parent dfec8fa044
commit 5f7292092e

@ -661,10 +661,14 @@ function __bobthefish_prompt_aws_vault_profile -S -d 'Show AWS Vault profile'
set -l now (date --utc +%s)
set -l expiry (date -d "$AWS_SESSION_EXPIRATION" +%s)
set -l diff_mins (math "floor(( $expiry - $now ) / 60)")
[ "$diff_mins" -lt 0 ]
and set -l diff_mins 0
set -l segment $profile " (" $diff_mins "m)"
set -l diff_time $diff_mins"m"
[ $diff_mins -le 0 ]
and set -l diff_time "0m"
[ $diff_mins -ge 60 ]
and set -l diff_time (math "floor($diff_mins / 60)")"h"(math "$diff_mins % 60")"m"
set -l segment $profile " (" $diff_time ")"
__bobthefish_start_segment $color_aws_vault
echo -ns $segment " "

Loading…
Cancel
Save