@@ -170,7 +170,7 @@ function phpbrew
170
170
set chdir $PHPBREW_ROOT /php/$PHPBREW_PHP /var
171
171
case etc
172
172
set chdir $PHPBREW_ROOT /php/$PHPBREW_PHP /etc
173
- cas dist
173
+ case dist
174
174
set chdir $PHPBREW_ROOT /php/$PHPBREW_PHP
175
175
case build
176
176
set chdir $PHPBREW_ROOT /build/$PHPBREW_PHP
@@ -426,53 +426,48 @@ if begin ; [ -n "$PHPBREW_SET_PROMPT" ]; and [ "$PHPBREW_SET_PROMPT" = "1" ]; en
426
426
# non supports in fish now
427
427
end
428
428
429
- function _phpbrewrc_load
430
- # check if working dir has changed
431
- if [ " $PWD " != " $PHPBREW_LAST_DIR " ]
432
- set -l curr_dir " $PWD "
433
- set -l prev_dir " $OLDPWD "
434
- set -l curr_fs 0
435
- set -l prev_fs 0
436
-
437
- while true
438
- set prev_fs $curr_fs
439
- set curr_fs (stat -c %d . ^ /dev/null) # GNU version
440
- if [ $status -ne 0 ]
441
- # the original curr_fs
442
- # set curr_fs (stat -f %d . ^/dev/null) # BSD version
443
- set curr_fs (stat -f %d . > /dev/null ^&1 ) # BSD version
444
- end
429
+ function _phpbrewrc_load --on-variable PWD --description ' Load configuration based on .phpbrewrc'
430
+ set -q PHPBREW_RC_ENABLE
431
+ or return
432
+
433
+ status --is-command-substitution ;
434
+ and return
435
+
436
+ set curr_dir " $PWD "
437
+ set prev_dir " "
438
+ set curr_fs 0
439
+ set prev_fs 0
445
440
446
- # check if top level directory or filesystem boundary is reached
447
- if begin ; [ " $PWD " = ' /' ]; or [ -z " $PHPBREW_RC_DISCOVERY_ACROSS_FILESYSTEM " -a $prev_fs -ne 0 -a $curr_fs -ne $prev_fs ]; end
441
+ while [ -n " $curr_dir " -a -d " $curr_dir " ]
442
+ set prev_fs $curr_fs
443
+ set curr_fs (stat -c %d " $curr_dir " ^ /dev/null) # GNU version
444
+ if [ $status -ne 0 ]
445
+ set curr_fs (stat -f %d " $curr_dir " > /dev/null ^&1 ) # BSD version
446
+ end
447
+
448
+ # check if top level directory or filesystem boundary is reached
449
+ if begin ; [ " $curr_dir " = " /" ]; or [ -z " $PHPBREW_RC_DISCOVERY_ACROSS_FILESYSTEM " -a $prev_fs -ne 0 -a $curr_fs -ne $prev_fs ]; end
450
+ # check if there's a previously loaded .phpbrewrc
451
+ if [ ! -z " $PHPBREW_LAST_RC_DIR " ]
448
452
set -e PHPBREW_LAST_RC_DIR
449
453
__phpbrew_load_user_config
450
- break
451
454
end
455
+ break
456
+ end
452
457
453
- # check if .phpbrewrc present
454
- if [ -r .phpbrewrc ]
455
- # check if it's not the same .phpbrewrc which was previously loaded
456
- if [ " $PWD " != " $PHPBREW_LAST_RC_DIR " ]
457
- __phpbrew_load_user_config
458
- set PHPBREW_LAST_RC_DIR " $PWD "
459
- source .phpbrewrc
460
- end
461
- break
458
+ # check if .phpbrewrc present
459
+ if [ -r " $curr_dir /.phpbrewrc" ]
460
+ # check if it's not the same .phpbrewrc which was previously loaded
461
+ if [ " $curr_dir " != " $PHPBREW_LAST_RC_DIR " ]
462
+ __phpbrew_load_user_config
463
+ set -g PHPBREW_LAST_RC_DIR " $curr_dir "
464
+ source " $curr_dir /.phpbrewrc"
462
465
end
463
-
464
- cd .. ^ /dev/null ; or break
466
+ break
465
467
end
466
468
467
- cd " $curr_dir "
468
- set OLDPWD " $prev_dir "
469
+ set curr_dir (dirname " $curr_dir " )
469
470
end
470
-
471
- set PHPBREW_LAST_DIR " $PWD "
472
- end
473
-
474
- if begin ; [ -n " $BASH_VERSION " ]; and [ -z " $PHPBREW_RC_DISABLE " ]; end
475
- trap " _phpbrewrc_load" DEBUG
476
471
end
477
472
478
473
# ##
0 commit comments