Files
dotfiles/fish/functions/fish_right_prompt.fish

42 lines
685 B
Fish

# prints "ARG1:ARG2" with appropriate colors
function section
printf ", "
printf $c1
printf $argv[1]
printf $c0
printf ":"
printf $c3
printf $argv[2]
printf $c0
end
function machine_tag
hostname | cut -f1 -d. - | tr '[a-z]' '[A-Z]'
end
function fish_right_prompt
# Current time
printf $c0
printf "["
printf (date "+$c2%H$c0:$c2%M")
# Show last execution time
if test $CMD_DURATION
set secs (math "$CMD_DURATION / 1000")
if test $secs -gt 2
section took {$secs}s
end
end
printf $c0
printf "]"
if set -q SSH_CLIENT
printf "["
printf $c1
printf (machine_tag)
printf $c0
printf "]"
end
end