-
Notifications
You must be signed in to change notification settings - Fork 1
/
__apollo_precmd
56 lines (38 loc) · 1.45 KB
/
__apollo_precmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# vim:ft=zsh
__apollo_precmd() {
__APOLLO_EXIT_CODE=$?
__APOLLO_PIPE_EXIT_CODES=( "${pipestatus[@]}" )
local profiler
local module cache_disabled clearing_disabled
local -i clear_count
zstyle -b ":apollo:${APOLLO_THEME}:core:profiler" enabled profiler
zstyle -b ":apollo:${APOLLO_THEME}:core:cache" disable cache_disabled
zstyle -s ":apollo:${APOLLO_THEME}:core:cache:clear" count clear_count
zstyle -b ":apollo:${APOLLO_THEME}:core:cache:clear" disable clearing_disabled
if [[ "$cache_disabled" == "yes" ]] \
|| [[ "$clearing_disabled" != "yes" && "$((++__APOLLO_BREAK_CACHE_COUNTER))" -ge "$clear_count" ]]; then
__APOLLO_MODULE_CACHE=();
__APOLLO_BREAK_CACHE_COUNTER=0;
fi
__apollo_check_buffer
__apollo_run_prompt;
if (( __APOLLO_ASYNC == 1 )); then
async_process_results apollo_async_helper __apollo_async_callback
async_register_callback apollo_async_helper __apollo_async_callback
if [[ "$profiler" == "yes" ]] ; then
printf "\nAsync modules:\n"
for module runtime in "${(kv)__APOLLO_ASYNC_TIMES[@]}"; do
printf "%25s: %f\n" "$module" "$runtime"
done
fi
fi
# Fixes zsh issue that makes pipestatus unreliable for status module
if (( $#__APOLLO_PIPE_EXIT_CODES > 1 )); then
zstyle -b ":apollo:${APOLLO_THEME}:core:pipestatus" fix fix_pipestatus
if [[ "$fix_pipestatus" == "yes" ]]; then
sched +1 ''
fi
fi
__apollo_trap_int
}
__apollo_precmd "$@"