Ajout temps d'exécution + heure

This commit is contained in:
François
2026-04-12 20:10:01 +02:00
parent dfa9f972f6
commit 8722503112

View File

@@ -113,8 +113,19 @@ POWERLINE_STOP="\ue0b4"
PROMPT_ENTER="" #"\ueb70" PROMPT_ENTER="" #"\ueb70"
precmd() { precmd() {
local exec_ts=$(($(date +%s%N) - STARTCMD_TS))
local seconds=$(echo "scale=9; $exec_ts / 1000000000" | bc)
local hours=$((seconds / 3600))
local minutes=$(((seconds % 3600) / 60))
seconds=$((seconds % 60))
local exec_str=$(printf "%02d:%02d:%06.3f" hours minutes seconds)
print "" # empty line to increase readability print "" # empty line to increase readability
print -P "%F{${BG1}}${POWERLINE_START}%K{${BG1}}%F{${FG1}} %y on %M %K{${BG1}}%F{${BG2}}${POWERLINE_SEPARATOR}%K{${BG2}}%F{${FG2}} %n %K{${BG2}}%F{${BG3}}${POWERLINE_SEPARATOR}%K{${BG3}}%F{${FG3}} %~ %K{${BG3}}%F{${FG4}}${POWERLINE_SEPARATOR}%k%F{${FG4}}${POWERLINE_STOP}" print -P "%F{${BG1}}${POWERLINE_START}%K{${BG1}}%F{${FG1}} %y on %M %K{${BG1}}%F{${BG2}}${POWERLINE_SEPARATOR}%K{${BG2}}%F{${FG2}} %n %K{${BG2}}%F{${BG3}}${POWERLINE_SEPARATOR}%K{${BG3}}%F{${FG3}} %~ %K{${BG3}}%F{${FG4}}${POWERLINE_SEPARATOR}%k%F{${FG4}}${POWERLINE_STOP}%k%f...%K{${BG3}}%F{${FG3}} took ${exec_str} \uf252 %K{${BG2}}%F{${FG2}} at $(date +%H:%M:%S) \uf017"
}
preexec() {
STARTCMD_TS=$(date +%s%N)
} }
PROMPT="${PROMPT_ENTER} " # nord theme PROMPT="${PROMPT_ENTER} " # nord theme