From 26a41f14b820f407eb314fdc5489a9b01379eaf8 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Sat, 5 Sep 2015 18:03:06 +0200 Subject: [PATCH] Added a segment that shows the PHP version. --- README.md | 1 + powerlevel9k.zsh-theme | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 187a67b4..734e6ea9 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ currently available are: * **history** - The command number for the current line. * **node_version** - Show the version number of the installed Node.js. * **os_icon** - Display a nice little icon, depending on your operating system. +* **php_version** - Show the current PHP version. * **rbenv** - Ruby environment information (if one is active). * **rspec_stats** - Show a ratio of test classes vs code classes for RSpec. * **status** - The return code of the previous command, and status of background jobs. diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 974273e7..5d29f612 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -556,6 +556,16 @@ prompt_os_icon() { $1_prompt_segment "$0" "008" "255" "$OS_ICON" } +# print 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" "013" "255" "$php_version" + fi +} + # rbenv information prompt_rbenv() { if [[ -n "$RBENV_VERSION" ]]; then