diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2017-02-14 02:57:10 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2017-02-14 02:57:10 +0300 |
commit | e105118f398748738849daabc800cc890323a542 (patch) | |
tree | 9fd739098a2c229c95fbdbe9fdad8be0c5be7efc /powerlevel9k.zsh-theme | |
parent | eb18bcaaaeaf1279ef6695fc11d533c3db6c01ec (diff) |
Format command execution time human readable
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 7 |
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 } |