From 0d29fbf796a2891148ff48956b986a31bd8591a3 Mon Sep 17 00:00:00 2001 From: Nico Verbruggen Date: Wed, 22 Dec 2021 16:54:27 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20`phpmon-cli=20fix`=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpmon-cli/AllowedArguments.swift | 1 + phpmon-cli/main.swift | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/phpmon-cli/AllowedArguments.swift b/phpmon-cli/AllowedArguments.swift index 4945cfe..e12a279 100644 --- a/phpmon-cli/AllowedArguments.swift +++ b/phpmon-cli/AllowedArguments.swift @@ -11,6 +11,7 @@ import Foundation enum AllowedArguments: String, CaseIterable { case use = "use" case performSwitch = "switch" + case fix = "fix" case help = "help" static func has(_ string: String) -> Bool { diff --git a/phpmon-cli/main.swift b/phpmon-cli/main.swift index 2a50be7..0972646 100644 --- a/phpmon-cli/main.swift +++ b/phpmon-cli/main.swift @@ -63,7 +63,11 @@ case .use, .performSwitch: Log.err("If this version is available, you may be able to install it by using `brew install php@\(version)`.") exit(1) } - +case .fix: + Log.info("Fixing your PHP installation...") + Actions.fixMyPhp() + Log.info("All operations completed. You can check which version of PHP is linked by using `php -v`.") + exit(0) case .help: print(""" =============================================================== @@ -79,6 +83,8 @@ case .help: * use {version}: Switch to a specific version of PHP. (e.g. `phpmon-cli use 8.0`) * switch {version}: Alias for the `use` command. + * fix Attempts to unlink all PHP versions, + and link the latest version of PHP. * help: Show this help. SUPPORTED FLAGS