Repository: cpisciotta/xcbeautify (swift)

Issue:
[New Output] Support MkDir Output
### What's the uncaptured output?

```
MkDir /path/to/bundle.bundle (in target 'Target' from project 'Project')
    cd /path/to/swift/package
    /bin/mkdir -p /path/to/bundle.bundle
```

### Suggested Regex

_No response_

### Suggested Output

_No response_

### Additional Context

_No response_

Pull request:
Fixes #196

Patch:
diff --git a/Sources/XcbeautifyLib/CaptureGroups.swift b/Sources/XcbeautifyLib/CaptureGroups.swift
index 9e4f2ed0..6db93cfa 100644
--- a/Sources/XcbeautifyLib/CaptureGroups.swift
+++ b/Sources/XcbeautifyLib/CaptureGroups.swift
@@ -2182,3 +2182,11 @@ struct SwiftDriverCompilationRequirementsCaptureGroup: CaptureGroup {
         self.target = target
     }
 }
+
+struct MkDirCaptureGroup: CaptureGroup {
+    static let outputType: OutputType = .task
+
+    static let regex = Regex(pattern: "^MkDir.*")
+
+    init?(groups: [String]) { }
+}
diff --git a/Sources/XcbeautifyLib/Formatter.swift b/Sources/XcbeautifyLib/Formatter.swift
index 46a9676d..85415276 100644
--- a/Sources/XcbeautifyLib/Formatter.swift
+++ b/Sources/XcbeautifyLib/Formatter.swift
@@ -246,6 +246,8 @@ package struct Formatter {
             return renderer.formatSwiftDriverCompilationTarget(group: group)
         case let group as SwiftDriverCompilationRequirementsCaptureGroup:
             return renderer.formatSwiftDriverCompilationRequirements(group: group)
+        case let group as MkDirCaptureGroup:
+            return renderer.formatMkDirCaptureGroup(group: group)
         default:
             assertionFailure()
             return nil
diff --git a/Sources/XcbeautifyLib/Parser.swift b/Sources/XcbeautifyLib/Parser.swift
index fce48f37..09a501c4 100644
--- a/Sources/XcbeautifyLib/Parser.swift
+++ b/Sources/XcbeautifyLib/Parser.swift
@@ -119,6 +119,7 @@ package final class Parser {
         SwiftDriverTargetCaptureGroup.self,
         SwiftDriverCompilationTarget.self,
         SwiftDriverCompilationRequirementsCaptureGroup.self,
+        MkDirCaptureGroup.self,
     ]
 
     // MARK: - Init
diff --git a/Sources/XcbeautifyLib/Renderers/OutputRendering.swift b/Sources/XcbeautifyLib/Renderers/OutputRendering.swift
index 0b319075..4fb47c8f 100644
--- a/Sources/XcbeautifyLib/Renderers/OutputRendering.swift
+++ b/Sources/XcbeautifyLib/Renderers/OutputRendering.swift
@@ -100,6 +100,7 @@ protocol OutputRendering {
     func formatSwiftTestingIssueArguments(group: SwiftTestingIssueArgumentCaptureGroup) -> String
     func formatSwiftTestingPassingArgument(group: SwiftTestingPassingArgumentCaptureGroup) -> String?
     func formatSwiftDriverCompilationTarget(group: SwiftDriverCompilationTarget) -> String?
+    func formatMkDirCaptureGroup(group: MkDirCaptureGroup) -> String?
 }
 
 extension OutputRendering {
@@ -659,4 +660,8 @@ extension OutputRendering {
     func formatSwiftDriverCompilationRequirements(group: SwiftDriverCompilationRequirementsCaptureGroup) -> String? {
         nil
     }
+
+    func formatMkDirCaptureGroup(group: MkDirCaptureGroup) -> String? {
+        nil
+    }
 }


Test patch:
diff --git a/Tests/XcbeautifyLibTests/CaptureGroupTests.swift b/Tests/XcbeautifyLibTests/CaptureGroupTests.swift
index 503d990f..6f833092 100644
--- a/Tests/XcbeautifyLibTests/CaptureGroupTests.swift
+++ b/Tests/XcbeautifyLibTests/CaptureGroupTests.swift
@@ -31,4 +31,9 @@ final class CaptureGroupTests: XCTestCase {
         let input = #"SwiftDriverJobDiscovery normal arm64 Emitting module for Widgets (in target 'Widgets' from project 'Backyard Birds')"#
         XCTAssertTrue(SwiftDriverJobDiscoveryEmittingModuleCaptureGroup.regex.match(string: input))
     }
+
+    func testMkDirCaptureGroup() throws {
+        let input = "MkDir /Backyard-Birds/Build/Products/Debug/Widgets.appex/Contents (in target \'Widgets\' from project \'Backyard Birds\')"
+        XCTAssertTrue(MkDirCaptureGroup.regex.match(string: input))
+    }
 }
diff --git a/Tests/XcbeautifyLibTests/ParsingTests/ParsingTests.swift b/Tests/XcbeautifyLibTests/ParsingTests/ParsingTests.swift
index 6ff7f985..985a4b83 100644
--- a/Tests/XcbeautifyLibTests/ParsingTests/ParsingTests.swift
+++ b/Tests/XcbeautifyLibTests/ParsingTests/ParsingTests.swift
@@ -26,9 +26,9 @@ final class ParsingTests: XCTestCase {
         // Update this magic number whenever `uncapturedOutput` is less than the current magic number.
         // There's a regression whenever `uncapturedOutput` is greater than the current magic number.
         #if os(macOS)
-        XCTAssertEqual(uncapturedOutput, 225)
+        XCTAssertEqual(uncapturedOutput, 193)
         #else
-        XCTAssertEqual(uncapturedOutput, 241)
+        XCTAssertEqual(uncapturedOutput, 209)
         #endif
     }
 
@@ -56,9 +56,9 @@ final class ParsingTests: XCTestCase {
         // Update this magic number whenever `uncapturedOutput` is less than the current magic number.
         // There's a regression whenever `uncapturedOutput` is greater than the current magic number.
         #if os(macOS)
-        XCTAssertEqual(uncapturedOutput, 7456)
+        XCTAssertEqual(uncapturedOutput, 6432)
         #else
-        XCTAssertEqual(uncapturedOutput, 8024)
+        XCTAssertEqual(uncapturedOutput, 7000)
         #endif
     }
 
diff --git a/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift b/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift
index 270dffa7..7767839a 100644
--- a/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift
+++ b/Tests/XcbeautifyLibTests/RendererTests/TerminalRendererTests.swift
@@ -721,4 +721,9 @@ final class TerminalRendererTests: XCTestCase {
         let input = #"SwiftDriver\ Compilation\ Requirements Backyard\ Birds normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Backyard Birds' from project 'Backyard Birds')"#
         XCTAssertNil(noColoredFormatted(input))
     }
+
+    func testMkDirCaptureGroup() throws {
+        let input = #"MkDir /Backyard-Birds/Build/Products/Debug/Widgets.appex/Contents (in target \'Widgets\' from project \'Backyard Birds\')"#
+        XCTAssertNil(noColoredFormatted(input))
+    }
 }