1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2025-08-07 20:10:08 +02:00

👌 Fix incorrect main.swift file

This commit is contained in:
2021-12-20 18:31:16 +01:00
parent 1ca49f6cbc
commit 7a3dc9a145
3 changed files with 31 additions and 16 deletions

View File

@ -8,5 +8,31 @@
import Foundation
print("Hello, World!")
// First, let's read the initial command line argument
print(CommandLine.arguments)
if CommandLine.arguments.count != 3 {
print("You must enter two arguments.")
exit(1)
}
let argument = CommandLine.arguments[1]
if !AllowedArguments.has(argument) {
print("The supported arguments are: \(AllowedArguments.rawValues)")
exit(1)
}
let action = AllowedArguments.init(rawValue: argument)
switch action {
case .use:
// Read the PHP value
let version = CommandLine.arguments[2]
print("Switching to PHP \(version)...")
break
case .none:
print("Action not recognized!")
exit(1)
}

View File

@ -1,11 +0,0 @@
//
// main.swift
// phpmon-cli
//
// Created by Nico Verbruggen on 20/12/2021.
//
import Foundation
print("Hello, World!")