aboutsummaryrefslogtreecommitdiff
path: root/internal/p10k.zsh
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-10-21 22:31:44 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-10-21 22:31:44 +0300
commitcf01e98ef086fc6fe2aa373d4e9609f55a8ed72a (patch)
tree29b11067f6e55144488b1b37dabb4d42ced63884 /internal/p10k.zsh
parentd2361d4dda834bb158070434def9ceb147b75412 (diff)
define P9K_TODO_FILTERED_TASK_COUNT and P9K_TODO_TOTAL_TASK_COUNT
These new parameters can be used to customize the content of `todo` prompt. Example: POWERLEVEL9K_TODO_CONTENT_EXPANSION='$P9K_TODO_FILTERED_TASK_COUNT / $P9K_TODO_TOTAL_TASK_COUNT' The default format is '$P9K_TODO_TOTAL_TASK_COUNT', just like before. Fixes #283.
Diffstat (limited to 'internal/p10k.zsh')
-rw-r--r--internal/p10k.zsh11
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/p10k.zsh b/internal/p10k.zsh
index 1461936a..7b8ebbe1 100644
--- a/internal/p10k.zsh
+++ b/internal/p10k.zsh
@@ -2373,18 +2373,21 @@ instant_prompt_date() {
################################################################
# todo.sh: shows the number of tasks in your todo.sh file
prompt_todo() {
+ unset P9K_TODO_TOTAL_TASK_COUNT P9K_TODO_FILTERED_TASK_COUNT
local todo=$commands[todo.sh]
[[ -n $todo && -r $_p9k_todo_file ]] || return
if ! _p9k_cache_stat_get $0 $_p9k_todo_file; then
local count="$($todo -p ls | tail -1)"
- if [[ $count == (#b)'TODO: '[[:digit:]]##' of '([[:digit:]]##)' '* ]]; then
- _p9k_cache_stat_set 1 $match[1]
+ if [[ $count == (#b)'TODO: '([[:digit:]]##)' of '([[:digit:]]##)' '* ]]; then
+ _p9k_cache_stat_set 1 $match[1] $match[2]
else
- _p9k_cache_stat_set 0 0
+ _p9k_cache_stat_set 0
fi
fi
(( $_p9k_cache_val[1] )) || return
- _p9k_prompt_segment "$0" "grey50" "$_p9k_color1" 'TODO_ICON' 0 '' "${_p9k_cache_val[2]}"
+ typeset -gi P9K_TODO_FILTERED_TASK_COUNT=$_p9k_cache_val[2]
+ typeset -gi P9K_TODO_TOTAL_TASK_COUNT=$_p9k_cache_val[3]
+ _p9k_prompt_segment "$0" "grey50" "$_p9k_color1" 'TODO_ICON' 0 '' "$P9K_TODO_TOTAL_TASK_COUNT"
}
################################################################