From 952b20cfd67d9b3bc58444616f6be6edea904a5c Mon Sep 17 00:00:00 2001 From: Than Tibbetts Date: Thu, 2 Feb 2017 13:47:48 -0600 Subject: [PATCH] Add ability to pass directory to `valet open` Occasionally I find myself in my projects directory and my reflex has been to type `valet open $dirname` to open a site in the browser. This PR adds that ability. Saves a few keystrokes when you would have to cd into a directory to `valet open` it. --- cli/valet.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/valet.php b/cli/valet.php index f13b5b0..663c03b 100755 --- a/cli/valet.php +++ b/cli/valet.php @@ -172,13 +172,13 @@ })->descriptions('Get all of the paths registered with Valet'); /** - * Open the current directory in the browser. + * Open the current or given directory in the browser. */ - $app->command('open', function () { - $url = "http://".Site::host(getcwd()).'.'.Configuration::read()['domain'].'/'; + $app->command('open [domain]', function ($domain = null) { + $url = "http://".($domain ?: Site::host(getcwd())).'.'.Configuration::read()['domain']; passthru("open ".escapeshellarg($url)); - })->descriptions('Open the site for the current directory in your browser'); + })->descriptions('Open the site for the current (or specified) directory in your browser'); /** * Generate a publicly accessible URL for your project.