1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 08:30:07 +01:00

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.
This commit is contained in:
Than Tibbetts
2017-02-02 13:47:48 -06:00
committed by GitHub
parent e832fc73cc
commit 952b20cfd6

View File

@@ -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.