diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2015-11-23 02:48:59 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2015-11-23 02:48:59 +0300 |
commit | 239aa29a1287d58ad61e6b9ff342fb7a7f2bf31e (patch) | |
tree | 0e3e877433c6157f08f62f8a0f094417343a6093 /powerlevel9k.zsh-theme | |
parent | 8d72b5eb123973f94e1188d697ca5e3e62d8269f (diff) |
Better use of test flags.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 6faa6523..7ce82e0a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -230,7 +230,7 @@ prompt_battery() { # convert time remaining from minutes to hours:minutes date string local time_remaining=$(echo $raw_data | grep TimeRemaining | awk '{ print $5 }') - if [[ ! -z $time_remaining ]]; then + if [[ -n $time_remaining ]]; then # this value is set to a very high number when the system is calculating [[ $time_remaining -gt 10000 ]] && local tstring="..." || local tstring=${(f)$(date -u -r $(($time_remaining * 60)) +%k:%M)} fi @@ -278,11 +278,11 @@ prompt_battery() { local tstring=${(f)$(date -u -d "$(echo $time_remaining)" +%k:%M)} fi fi - [[ ! -z $tstring ]] && local remain=" ($tstring)" + [[ -n $tstring ]] && local remain=" ($tstring)" fi # display prompt_segment - [[ ! -z $bat_percent ]] && "$1_prompt_segment" "$0" "$DEFAULT_COLOR" "$DEFAULT_COLOR_INVERTED" "%F{$icon_color}$(print_icon 'BATTERY_ICON')$fg_color $bat_percent%%$remain%f" + [[ -n $bat_percent ]] && "$1_prompt_segment" "$0" "$DEFAULT_COLOR" "$DEFAULT_COLOR_INVERTED" "%F{$icon_color}$(print_icon 'BATTERY_ICON')$fg_color $bat_percent%%$remain%f" } # Context: user@hostname (who am I and where am I) |