From 7e34426e4a403c6ada008f5600282f801b0fe40c Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Wed, 10 Aug 2016 20:26:55 -0300 Subject: [PATCH] Allow path parameter for valet park and forget Fixes #107 --- cli/valet.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/cli/valet.php b/cli/valet.php index 0b05f97..71b2dcd 100755 --- a/cli/valet.php +++ b/cli/valet.php @@ -73,20 +73,30 @@ /** * Add the current working directory to the paths configuration. */ -$app->command('park', function () { - Configuration::addPath(getcwd()); +$app->command('park [path]', function ($path = null) { + $pathToPark = getcwd(); + if ($path !== null) { + $pathToPark = $path; + } - info("This directory has been added to Valet's paths."); -})->descriptions('Register the current working directory with Valet'); + Configuration::addPath($pathToPark); + + info(($path === null ? "This" : "The [{$path}]") . " directory has been added to Valet's paths."); +})->descriptions('Register the current working (or specified) directory with Valet'); /** - * Remove the current working directory to the paths configuration. + * Remove the current working directory from the paths configuration. */ -$app->command('forget', function () { - Configuration::removePath(getcwd()); +$app->command('forget [path]', function ($path = null) { + $pathToForget = getcwd(); + if ($path !== null) { + $pathToForget = $path; + } - info("This directory has been removed from Valet's paths."); -})->descriptions('Remove the current working directory from Valet\'s list of paths'); + Configuration::removePath($pathToForget); + + info(($path === null ? "This" : "The [{$path}]") . " directory has been removed from Valet's paths."); +})->descriptions('Remove the current working (or specified) directory from Valet\'s list of paths'); /** * Register a symbolic link with Valet.