aboutsummaryrefslogtreecommitdiff
path: root/powerlevel9k.zsh-theme
diff options
context:
space:
mode:
authorDominik Ritter <dritter03@googlemail.com>2017-02-14 02:57:10 +0300
committerDominik Ritter <dritter03@googlemail.com>2017-02-14 02:57:10 +0300
commite105118f398748738849daabc800cc890323a542 (patch)
tree9fd739098a2c229c95fbdbe9fdad8be0c5be7efc /powerlevel9k.zsh-theme
parenteb18bcaaaeaf1279ef6695fc11d533c3db6c01ec (diff)
Format command execution time human readable
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-xpowerlevel9k.zsh-theme7
1 files changed, 6 insertions, 1 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 840dde14..0bcc6d97 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -564,8 +564,13 @@ prompt_custom() {
prompt_command_execution_time() {
set_default POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD 3
+ local duration=$_P9K_DURATION_TIME
+
+ [[ $_P9K_COMMAND_DURATION -gt 60 ]] && duration=$(strftime '%M:%S' $_P9K_COMMAND_DURATION)
+ [[ $_P9K_COMMAND_DURATION -gt 3600 ]] && duration=$(strftime '%H:%M:%S' $_P9K_COMMAND_DURATION)
+
if [ $_P9K_COMMAND_DURATION -ge $POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD ]; then
- "$1_prompt_segment" "$0" "$2" "red" "226" "${_P9K_COMMAND_DURATION}s" 'EXECUTION_TIME_ICON'
+ "$1_prompt_segment" "$0" "$2" "red" "226" "${duration}" 'EXECUTION_TIME_ICON'
fi
}