diff --git a/PHP Monitor.xcodeproj/xcshareddata/xcschemes/PHP Monitor DEV.xcscheme b/PHP Monitor.xcodeproj/xcshareddata/xcschemes/PHP Monitor DEV.xcscheme
index 33c1688..fad7a23 100644
--- a/PHP Monitor.xcodeproj/xcshareddata/xcschemes/PHP Monitor DEV.xcscheme
+++ b/PHP Monitor.xcodeproj/xcshareddata/xcschemes/PHP Monitor DEV.xcscheme
@@ -89,6 +89,10 @@
argument = "--v"
isEnabled = "NO">
+
+
diff --git a/phpmon/Common/Core/Logger.swift b/phpmon/Common/Core/Logger.swift
index fd939c8..1b43581 100644
--- a/phpmon/Common/Core/Logger.swift
+++ b/phpmon/Common/Core/Logger.swift
@@ -16,7 +16,8 @@ class Log {
case error = 1,
warning = 2,
info = 3,
- performance = 4
+ performance = 4,
+ cli = 5
public func isApplicable() -> Bool {
return Log.shared.verbosity.rawValue >= self.rawValue
diff --git a/phpmon/Common/Shell/RealShell.swift b/phpmon/Common/Shell/RealShell.swift
index 28fd203..ed69343 100644
--- a/phpmon/Common/Shell/RealShell.swift
+++ b/phpmon/Common/Shell/RealShell.swift
@@ -68,6 +68,7 @@ class RealShell: ShellProtocol {
let task = Process()
task.launchPath = self.launchPath
task.arguments = ["--noprofile", "-norc", "--login", "-c", completeCommand]
+
return task
}
@@ -113,6 +114,35 @@ class RealShell: ShellProtocol {
encoding: .utf8
)!
+ if Log.shared.verbosity == .cli {
+ var args = task.arguments
+ let last: String = "\"" + (args?.popLast() ?? "") + "\""
+ let concat = [self.launchPath] + task.arguments! + [last]
+ let command = concat.joined(separator: " ")
+ var log = """
+
+ <~~~~~~~~~~~~~~~~~~~~~~~
+ $ \(command)
+
+ [OUT]:
+ \(stdOut)
+ """
+
+ if !stdErr.isEmpty {
+ log.append("""
+ [ERR]:
+ \(stdErr)
+ """)
+ }
+
+ log.append("""
+ ~~~~~~~~~~~~~~~~~~~~~~~~>
+
+ """)
+
+ print(log)
+ }
+
return .out(stdOut, stdErr)
}
diff --git a/phpmon/Domain/App/AppDelegate.swift b/phpmon/Domain/App/AppDelegate.swift
index 05b192e..e5df2a6 100644
--- a/phpmon/Domain/App/AppDelegate.swift
+++ b/phpmon/Domain/App/AppDelegate.swift
@@ -75,6 +75,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele
Log.info("Extra verbose mode has been activated.")
}
+ if CommandLine.arguments.contains("--cli") {
+ logger.verbosity = .cli
+ Log.info("Extra CLI mode has been activated.")
+ }
+
Log.separator(as: .info)
Log.info("PHP MONITOR by Nico Verbruggen")
Log.info("Version \(App.version)")