mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 04:10:07 +00:00
Merge pull request #912 from brandon14/laravel_pormpt_fix
[Bugfix] Fix error in laravel_version when artisan is not present
This commit is contained in:
commit
571a859413
2 changed files with 9 additions and 9 deletions
|
@ -1130,11 +1130,10 @@ 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)"
|
local laravel_version="$(php artisan --version 2> /dev/null)"
|
||||||
if [[ -n "${laravel_version}" ]]; then
|
if [[ -n "${laravel_version}" && "${laravel_version}" =~ "Laravel Framework" ]]; then
|
||||||
# Remove unrelevant infos
|
# Strip out everything but the version
|
||||||
laravel_version="${laravel_version//Laravel Framework version /}"
|
laravel_version="${laravel_version//Laravel Framework /}"
|
||||||
|
|
||||||
"$1_prompt_segment" "$0" "$2" "maroon" "white" "${laravel_version}" 'LARAVEL_ICON'
|
"$1_prompt_segment" "$0" "$2" "maroon" "white" "${laravel_version}" 'LARAVEL_ICON'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,16 +14,17 @@ function setUp() {
|
||||||
function mockLaravelVersion() {
|
function mockLaravelVersion() {
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"artisan")
|
"artisan")
|
||||||
echo "Laravel Framework version 5.4.23"
|
# artisan --version follows the format Laravel Framework <version>
|
||||||
|
echo "Laravel Framework 5.4.23"
|
||||||
;;
|
;;
|
||||||
default)
|
default)
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
function mockNoLaravelVersion() {
|
function mockNoLaravelVersion() {
|
||||||
# This should output some error
|
# When php can't find a file it will output a message
|
||||||
>&2 echo "Artisan not available"
|
echo "Could not open input file: artisan"
|
||||||
return 1
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function testLaravelVersionSegment() {
|
function testLaravelVersionSegment() {
|
||||||
|
|
Loading…
Reference in a new issue