mirror of
https://github.com/laravel/valet.git
synced 2026-02-04 08:10:07 +01:00
Confirm tld command
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
|
||||
use Illuminate\Container\Container;
|
||||
use Silly\Application;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
use function Valet\info;
|
||||
use function Valet\output;
|
||||
@@ -75,11 +77,21 @@
|
||||
/**
|
||||
* Get or set the TLD currently being used by Valet.
|
||||
*/
|
||||
$app->command('tld [tld]', function ($tld = null) {
|
||||
$app->command('tld [tld]', function (InputInterface $input, OutputInterface $output, $tld = null) {
|
||||
if ($tld === null) {
|
||||
return output(Configuration::read()['tld']);
|
||||
}
|
||||
|
||||
$helper = $this->getHelperSet()->get('question');
|
||||
$question = new ConfirmationQuestion(
|
||||
'Using a different tld than the standard supported ".test" tld provided by Valet is not officially supported and may lead to unexpected results. Do you wish to proceed? [y/N]',
|
||||
false
|
||||
);
|
||||
|
||||
if (false === $helper->ask($input, $output, $question)) {
|
||||
return warning('No new Valet tld was set.');
|
||||
}
|
||||
|
||||
DnsMasq::updateTld(
|
||||
$oldTld = Configuration::read()['tld'],
|
||||
$tld = trim($tld, '.')
|
||||
|
||||
Reference in New Issue
Block a user