From a2d8cccd098bc1f739c324623bdabb701e65ba90 Mon Sep 17 00:00:00 2001 From: Dominik Ritter Date: Tue, 1 May 2018 02:10:26 +0200 Subject: [PATCH] Add a Laravel version segment --- CHANGELOG.md | 6 ++++++ README.md | 1 + functions/icons.zsh | 5 +++++ powerlevel9k.zsh-theme | 12 ++++++++++++ 4 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a8842a3..e7e61af6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## next + +### New Segment: `laravel_version` + +Displays the current laravel version. + ## v0.6.4 - `load` segment now has configurable averages. diff --git a/README.md b/README.md index 9b86067f..1e01e915 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ The segments that are currently available are: * `nvm` - Show the version of Node that is currently active, if it differs from the version used by NVM * **PHP Segments:** * `php_version` - Show the current PHP version. + * `laravel_version` - Show the current Laravel version. * [`symfony2_tests`](#symfony2_tests) - Show a ratio of test classes vs code classes for Symfony2. * `symfony2_version` - Show the current Symfony2 version, if you are in a Symfony2-Project dir. * **Python Segments:** diff --git a/functions/icons.zsh b/functions/icons.zsh index 1f90e94f..98c6f13d 100755 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -111,6 +111,7 @@ case $POWERLEVEL9K_MODE in DATE_ICON $'\uE184' #  TIME_ICON $'\uE12E' #  JAVA_ICON $'\U2615' # ☕︎ + LARAVEL_ICON '' ) ;; 'awesome-fontconfig') @@ -206,6 +207,7 @@ case $POWERLEVEL9K_MODE in DATE_ICON $'\uF073 ' #  TIME_ICON $'\uF017 ' #  JAVA_ICON $'\U2615' # ☕︎ + LARAVEL_ICON '' ) ;; 'awesome-mapped-fontconfig') @@ -306,6 +308,7 @@ case $POWERLEVEL9K_MODE in DATE_ICON $'\uF073 ' #  TIME_ICON $'\uF017 ' #  JAVA_ICON $'\U2615' # ☕︎ + LARAVEL_ICON '' ) ;; 'nerdfont-complete'|'nerdfont-fontconfig') @@ -402,6 +405,7 @@ case $POWERLEVEL9K_MODE in DATE_ICON $'\uF073 ' #  TIME_ICON $'\uF017 ' #  JAVA_ICON $'\U2615' # ☕︎ + LARAVEL_ICON $'\ue73f ' #  ) ;; *) @@ -497,6 +501,7 @@ case $POWERLEVEL9K_MODE in DATE_ICON '' TIME_ICON '' JAVA_ICON $'\U2615' # ☕︎ + LARAVEL_ICON '' ) ;; esac diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index b9119d4c..dde838d9 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1109,6 +1109,18 @@ prompt_vpn_ip() { done } +################################################################ +# Segment to display laravel version +prompt_laravel_version() { + local laravel_version="$(php artisan --version 2>/dev/null)" + if [[ -n "${laravel_version}" ]]; then + # Remove unrelevant infos + laravel_version="${laravel_version//Laravel Framework version /}" + + "$1_prompt_segment" "$0" "$2" "maroon" "white" "${laravel_version}" 'LARAVEL_ICON' + fi +} + ################################################################ # Segment to display load set_default POWERLEVEL9K_LOAD_WHICH 5