mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 12:20:07 +00:00
speed up laravel_version
This commit is contained in:
parent
b8a949498f
commit
84097d9073
1 changed files with 9 additions and 5 deletions
|
@ -2100,12 +2100,16 @@ prompt_vpn_ip() {
|
||||||
################################################################
|
################################################################
|
||||||
# Segment to display laravel version
|
# Segment to display laravel version
|
||||||
prompt_laravel_version() {
|
prompt_laravel_version() {
|
||||||
local laravel_version="$(php artisan --version 2> /dev/null)"
|
_p9k_upglob artisan && return
|
||||||
if [[ -n "${laravel_version}" && "${laravel_version}" =~ "Laravel Framework" ]]; then
|
local dir=$_p9k__parent_dirs[$?]
|
||||||
# Strip out everything but the version
|
local app=$dir/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
|
||||||
laravel_version="${laravel_version//Laravel Framework /}"
|
[[ -r $app ]] || return
|
||||||
_p9k_prompt_segment "$0" "maroon" "white" 'LARAVEL_ICON' 0 '' "${laravel_version//\%/%%}"
|
if ! _p9k_cache_stat_get $0 $dir/artisan $app; then
|
||||||
|
local v="$(php $dir/artisan --version 2> /dev/null)"
|
||||||
|
_p9k_cache_stat_set "${${(M)v:#Laravel Framework *}#Laravel Framework }"
|
||||||
fi
|
fi
|
||||||
|
[[ -n $_p9k__cache_val[1] ]] || return
|
||||||
|
_p9k_prompt_segment "$0" "maroon" "white" 'LARAVEL_ICON' 0 '' "${_p9k__cache_val[1]//\%/%%}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_p9k_prompt_laravel_version_init() {
|
_p9k_prompt_laravel_version_init() {
|
||||||
|
|
Loading…
Reference in a new issue