diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2019-05-21 15:23:50 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2019-05-21 15:23:50 +0300 |
commit | ee0d1bc45264f35c0a3ae4b990f2b37cea969167 (patch) | |
tree | 8d0da7865a3ecef7bd45a854e9957c4fc6bd5a74 | |
parent | f27db9233521ccfa6c41be5570ab3f62fa1deabc (diff) |
speed up php_version prompt
-rwxr-xr-x | powerlevel9k.zsh-theme | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 9d957285..047af4e5 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1292,12 +1292,12 @@ prompt_os_icon() { ################################################################ # Segment to display PHP version number prompt_php_version() { - local php_version - php_version=$(php -v 2>&1 | grep -oe "^PHP\s*[0-9.]*") - - if [[ -n "$php_version" ]]; then - "$1_prompt_segment" "$0" "$2" "fuchsia" "grey93" '' 0 '' "${php_version//\%/%%}" - fi + _p9k_cached_cmd_stdout php --version || return + emulate -L zsh && setopt extendedglob + local -a match + [[ $_P9K_RETVAL == (#b)(*$'\n')#(PHP [0-9.]##)* ]] || return + local v=$match[2] + "$1_prompt_segment" "$0" "$2" "fuchsia" "grey93" '' 0 '' "${v//\%/%%}" } ################################################################ |