mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2026-09-30 00:34:42 +00:00
speed up truncate_with_package_name
This commit is contained in:
@@ -819,9 +819,15 @@ prompt_dir() {
|
|||||||
for (( ; i > 0; --i )); do
|
for (( ; i > 0; --i )); do
|
||||||
local pkg_file=''
|
local pkg_file=''
|
||||||
for pkg_file in $dir/${~pat}(N); do
|
for pkg_file in $dir/${~pat}(N); do
|
||||||
local pkg_name=''
|
local -H stat=()
|
||||||
pkg_name=$(command jq -j '.name' <$pkg_file) && [[ -n $pkg_name ]] || return
|
zstat -H stat -- $pkg_file 2>/dev/null || return
|
||||||
parts[1,i]=($pkg_name)
|
if ! _p9k_cache_get $0_pkg $stat[inode] $stat[mtime] $stat[size]; then
|
||||||
|
local pkg_name=''
|
||||||
|
pkg_name=$(command jq -j '.name' <$pkg_file 2>/dev/null) || pkg_name=''
|
||||||
|
_p9k_cache_set "$pkg_name"
|
||||||
|
fi
|
||||||
|
[[ -n $_P9K_CACHE_VAL[1] ]] || return
|
||||||
|
parts[1,i]=($_P9K_CACHE_VAL[1])
|
||||||
fake_first=1
|
fake_first=1
|
||||||
return
|
return
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user