From 9c77a51ff9be5a2dab05bb6fdb6528e64aaae614 Mon Sep 17 00:00:00 2001 From: Chris Brown Date: Sat, 4 Jan 2020 11:05:43 -0500 Subject: [PATCH] Add --off option for valet trust command While `valet trust` enables (creates) sudoers entries, there was no cleanup/removal option for this, apart from complete forced uninstall of Valet. This adds `valet trust --off` so that the sudoers entries can be removed from Valet CLI. --- cli/valet.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cli/valet.php b/cli/valet.php index 965d53b..6eebdf5 100755 --- a/cli/valet.php +++ b/cli/valet.php @@ -373,12 +373,21 @@ /** * Install the sudoers.d entries so password is no longer required. */ - $app->command('trust', function () { + $app->command('trust [--off]', function ($off) { + if ($off) { + Brew::removeSudoersEntry(); + Valet::removeSudoersEntry(); + + return info('Sudoers entries have been removed for Brew and Valet.'); + } + Brew::createSudoersEntry(); Valet::createSudoersEntry(); info('Sudoers entries have been added for Brew and Valet.'); - })->descriptions('Add sudoers files for Brew and Valet to make Valet commands run without passwords'); + })->descriptions('Add sudoers files for Brew and Valet to make Valet commands run without passwords', [ + '--off' => 'Remove the sudoers files so normal sudo password prompts are required.' + ]); /** * Allow the user to change the version of php valet uses