diff options
author | David Ward <errantepiphany@users.noreply.github.com> | 2020-02-05 23:00:56 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-05 23:00:56 +0300 |
commit | a06bbdc1963be2981995ce1feddb1f94800759ae (patch) | |
tree | 2c6586f75440400bec3828b663886fe68ad76b86 /internal | |
parent | be7e7b3b1583243f2408871c51a3946eafd179bf (diff) |
respect TIMEWARRIORDB environment variable (#471)
Signed-off-by: David Ward <dward@redhat.com>
Diffstat (limited to 'internal')
-rw-r--r-- | internal/p10k.zsh | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh index d44417b2..03558340 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -4362,8 +4362,9 @@ function instant_prompt_direnv() { function prompt_timewarrior() { local -a stat + local timewarriordb=${TIMEWARRIORDB:-~/.timewarrior} if [[ -n $_p9k_timewarrior_file_name ]]; then - zstat -A stat +mtime -- ~/.timewarrior/data $_p9k_timewarrior_file_name 2>/dev/null || stat=() + zstat -A stat +mtime -- ${timewarriordb}/data $_p9k_timewarrior_file_name 2>/dev/null || stat=() if [[ $stat[1] == $_p9k_timewarrior_dir_mtime && $stat[2] == $_p9k_timewarrior_file_mtime ]]; then if (( $+_p9k_timewarrior_tags )); then _p9k_prompt_segment $0 grey 255 TIMEWARRIOR_ICON 0 '' "${_p9k_timewarrior_tags//\%/%%}" @@ -4371,7 +4372,7 @@ function prompt_timewarrior() { return fi fi - if [[ ! -d ~/.timewarrior/data ]]; then + if [[ ! -d ${timewarriordb}/data ]]; then _p9k_timewarrior_dir_mtime=0 _p9k_timewarrior_file_mtime=0 _p9k_timewarrior_file_name= @@ -4379,12 +4380,12 @@ function prompt_timewarrior() { return fi if [[ $stat[1] != $_p9k_timewarrior_dir_mtime ]]; then - local -a files=(~/.timewarrior/data/<->-<->.data(.N)) + local -a files=(${timewarriordb}/data/<->-<->.data(.N)) if (( ! $#files )); then - if (( $#stat )) || zstat -A stat +mtime -- ~/.timewarrior/data 2>/dev/null; then + if (( $#stat )) || zstat -A stat +mtime -- ${timewarriordb}/data 2>/dev/null; then _p9k_timewarrior_dir_mtime=$stat[1] _p9k_timewarrior_file_mtime=$stat[1] - _p9k_timewarrior_file_name=~/.timewarrior/data + _p9k_timewarrior_file_name=${timewarriordb}/data else _p9k_timewarrior_dir_mtime=0 _p9k_timewarrior_file_mtime=0 @@ -4395,7 +4396,7 @@ function prompt_timewarrior() { fi _p9k_timewarrior_file_name=${${(AO)files}[1]} fi - if ! zstat -A stat +mtime -- ~/.timewarrior/data $_p9k_timewarrior_file_name 2>/dev/null; then + if ! zstat -A stat +mtime -- ${timewarriordb}/data $_p9k_timewarrior_file_name 2>/dev/null; then _p9k_timewarrior_dir_mtime=0 _p9k_timewarrior_file_mtime=0 _p9k_timewarrior_file_name= |