Add a Laravel version segment

This commit is contained in:
Dominik Ritter 2018-05-01 02:10:26 +02:00
parent d9d9fb9b6b
commit a2d8cccd09
4 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,9 @@
## next
### New Segment: `laravel_version`
Displays the current laravel version.
## v0.6.4
- `load` segment now has configurable averages.

View File

@ -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:**

View File

@ -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

View File

@ -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