From ee6a17ea57564746ca6b687d371260d1caab4a1e Mon Sep 17 00:00:00 2001 From: NasirNobin Date: Mon, 21 Mar 2022 19:50:43 +0600 Subject: [PATCH] wip --- cli/valet.php | 13 ++++++++++--- valet | 20 ++++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/cli/valet.php b/cli/valet.php index 426c761..340202d 100755 --- a/cli/valet.php +++ b/cli/valet.php @@ -555,10 +555,17 @@ /** * List isolated sites. */ - $app->command('isolated', function () { - $sites = PhpFpm::isolatedDirectories(); + $app->command('isolated [--site=]', function ($site) { + if ($site) { + if ($phpVersion = Site::customPhpVersion($site.'.'.data_get(Configuration::read(), 'tld'))) { + $phpVersion = PhpFpm::normalizePhpVersion($phpVersion); + return output($phpVersion); + } + } else { + $sites = PhpFpm::isolatedDirectories(); - table(['Path', 'PHP Version'], $sites->all()); + table(['Path', 'PHP Version'], $sites->all()); + } })->descriptions('List all sites using isolated versions of PHP.'); /** diff --git a/valet b/valet index 03eadee..e204988 100755 --- a/valet +++ b/valet @@ -20,12 +20,6 @@ then DIR=$(php -r "echo realpath('$DIR/../laravel/valet');") fi -if [[ "$EUID" -ne 0 ]] -then - sudo USER="$USER" --preserve-env "$SOURCE" "$@" - exit -fi - # If the command is the "share" command we will need to resolve out any # symbolic links for the site. Before starting Ngrok, we will fire a # process to retrieve the live Ngrok tunnel URL in the background. @@ -88,9 +82,23 @@ then exit +elif [[ "$1" = "php" ]] +then + php "${@:2}" + +elif [[ "$1" = "composer" ]] +then + php /usr/local/bin/composer "${@:2}" + # Finally, for every other command we will just proxy into the PHP tool # and let it handle the request. These are commands which can be run # without sudo and don't require taking over terminals like Ngrok. else + if [[ "$EUID" -ne 0 ]] + then + sudo USER="$USER" --preserve-env "$SOURCE" "$@" + exit + fi + php "$DIR/cli/valet.php" "$@" fi