Repository: cpisciotta/xcbeautify (swift)

Issue:
Extra backslashes before spaces in run script phases names
xcbeautify prints a `\` before each whitespace in the names of my "Run Script" build phases.

For example :

```
❯ xcodebuild build -showBuildTimingSummary -workspace Redacted.xcworkspace -scheme Redacted-Debug | xcbeautify 
[NotificationExtension] Running script Nullability\ Check
[NotificationExtension] Processing Info.plist
Signing Redacted.NotificationExtension.appex (in target: NotificationExtension)
[Pods-Redacted] Compiling Pods-Redacted-dummy.m
[Pods-Redacted] Building library libPods-Redacted.a
[ShareExtension] Processing Info.plist
Signing Redacted.ShareExtension.appex (in target: ShareExtension)
[Redacted] Running script [CP]\ Check\ Pods\ Manifest.lock
[Redacted] Running script Nullability\ Check
[Redacted] Running script Error\ codes\ check
[Redacted] Running script Linters
[Redacted] Compiling ISConsultationViewController.m
[Redacted] Compiling ISNewDocumentViewController.m
[Redacted] Linking Redacted-Debug
[Redacted] Compiling Consultation.storyboard
[Redacted] Processing Info.plist
[Redacted] Copying Redacted.ShareExtension.appex
[Redacted] Copying Redacted.NotificationExtension.appex
[Redacted] Running script [CP]\ Embed\ Pods\ Frameworks
[Redacted] Running script [CP]\ Copy\ Pods\ Resources
[Redacted] Running script Validate\ Payment\ Pickers\ XML
Signing Redacted-Debug.app (in target: Redacted)
Signing (3 tasks) | 24.000 seconds
Build Succeeded
```

I can probably look at this when I have more time and submit a PR.

Pull request:
Here you go, fixes #11.

Let me know if I need to adjust anything 👍

Patch:
diff --git a/Sources/XcbeautifyLib/String+Beautify.swift b/Sources/XcbeautifyLib/String+Beautify.swift
index 182b089c..a04a0ec2 100644
--- a/Sources/XcbeautifyLib/String+Beautify.swift
+++ b/Sources/XcbeautifyLib/String+Beautify.swift
@@ -226,8 +226,10 @@ extension String {
     private func formatPhaseScriptExecution() -> String? {
         let groups = capturedGroups(with: .phaseScriptExecution)
         let phaseName = groups[0]
+        // Strip backslashed added by xcodebuild before spaces in the build phase name
+        let strippedPhaseName = phaseName.replacingOccurrences(of: "\\ ", with: " ")
         let target = groups[1]
-        return _colored ? "[\(target.f.Cyan)] \("Running script".s.Bold) \(phaseName)" : "[\(target)] Running script \(phaseName)"
+        return _colored ? "[\(target.f.Cyan)] \("Running script".s.Bold) \(strippedPhaseName)" : "[\(target)] Running script \(strippedPhaseName)"
     }
 
     private func formatTestHeading(pattern: Pattern) -> String? {


Test patch:
diff --git a/Tests/XcbeautifyLibTests/XcbeautifyLibTests.swift b/Tests/XcbeautifyLibTests/XcbeautifyLibTests.swift
index 1178812b..bd75bb71 100644
--- a/Tests/XcbeautifyLibTests/XcbeautifyLibTests.swift
+++ b/Tests/XcbeautifyLibTests/XcbeautifyLibTests.swift
@@ -172,7 +172,7 @@ final class XcbeautifyLibTests: XCTestCase {
 
     func testPhaseScriptExecution() {
         let formatted = noColoredFormatted("PhaseScriptExecution [CP]\\ Check\\ Pods\\ Manifest.lock /Users/admin/Library/Developer/Xcode/DerivedData/App-abcd/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-53BECF2B2F2E203E928C31AE.sh (in target: App)")
-        XCTAssertEqual(formatted, "[App] Running script [CP]\\ Check\\ Pods\\ Manifest.lock")
+        XCTAssertEqual(formatted, "[App] Running script [CP] Check Pods Manifest.lock")
     }
 
     func testPhaseSuccess() {