mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
adding commands
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"mnapoli/silly": "~1.0",
|
||||
"symfony/process": "~2.7|~3.0"
|
||||
},
|
||||
|
||||
@@ -66,7 +66,7 @@ public static function write(array $config, $chown = false)
|
||||
file_put_contents(static::path(), json_encode($config, JSON_PRETTY_PRINT).PHP_EOL);
|
||||
|
||||
if ($chown) {
|
||||
chown(static::path(), $_SERVER['SUDO_USER']);
|
||||
chown(static::path(), $_SERVER['SUDO_USER'] ?? $_SERVER['USER']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
29
valet
29
valet
@@ -36,15 +36,36 @@ $app->command('install', function ($output) {
|
||||
* Add the current working directory to the paths configuration.
|
||||
*/
|
||||
$app->command('serve', function ($output) {
|
||||
should_be_sudo();
|
||||
|
||||
Valet\Configuration::addPath(getcwd());
|
||||
|
||||
Valet\LaunchDaemon::restart();
|
||||
|
||||
$output->writeln('<info>This directory has been added to your serve paths!</info>');
|
||||
});
|
||||
|
||||
/**
|
||||
* Add the current working directory to the paths configuration.
|
||||
*/
|
||||
$app->command('link name', function ($name, $output) {
|
||||
$linkPath = Valet\Site::link($name);
|
||||
|
||||
$output->writeln('<info>A ['.$name.'] symbolic link has been created in ['.$linkPath.'].</info>');
|
||||
});
|
||||
|
||||
/**
|
||||
* Display all of the registered symbolic links.
|
||||
*/
|
||||
$app->command('links', function () {
|
||||
passthru('ls -la '.$_SERVER['HOME'].'/.valet/Sites');
|
||||
});
|
||||
|
||||
/**
|
||||
* Unlink a link from the Valet links directory.
|
||||
*/
|
||||
$app->command('unlink name', function ($name, $output) {
|
||||
Valet\Site::unlink($name);
|
||||
|
||||
$output->writeln('<info>The ['.$name.'] symbolic link has been removed.</info>');
|
||||
});
|
||||
|
||||
/**
|
||||
* Add the current working directory to the paths configuration.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user