@@ -15,7 +15,7 @@ struct XCSift: ParsableCommand {
1515 static let configuration = CommandConfiguration (
1616 commandName: " xcsift " ,
1717 abstract: " A Swift tool to parse and format xcodebuild output for coding agents " ,
18- usage: " xcodebuild [options] 2>&1 | xcsift [--warnings|-w] [--version|-v] [--help|-h] " ,
18+ usage: " xcodebuild [options] 2>&1 | xcsift [--warnings|-w] [--quiet|-q] [-- version|-v] [--help|-h] " ,
1919 discussion: """
2020 xcsift reads xcodebuild output from stdin and outputs structured JSON.
2121
@@ -27,6 +27,7 @@ struct XCSift: ParsableCommand {
2727 xcodebuild test 2>&1 | xcsift -w
2828 swift build 2>&1 | xcsift --warnings
2929 swift test 2>&1 | xcsift
30+ swift build 2>&1 | xcsift --quiet
3031 """ ,
3132 helpNames: [ . short, . long]
3233 )
@@ -37,6 +38,9 @@ struct XCSift: ParsableCommand {
3738 @Flag ( name: [ . short, . long] , help: " Print detailed warnings list (by default only warning count is shown) " )
3839 var warnings : Bool = false
3940
41+ @Flag ( name: [ . short, . long] , help: " Suppress output when build succeeds with no warnings or errors " )
42+ var quiet : Bool = false
43+
4044 func run( ) throws {
4145 if version {
4246 print ( getVersion ( ) )
@@ -57,7 +61,7 @@ struct XCSift: ParsableCommand {
5761 }
5862
5963 let result = parser. parse ( input: input, printWarnings: warnings)
60- outputResult ( result)
64+ outputResult ( result, quiet : quiet )
6165 }
6266
6367 private func readStandardInput( ) -> String {
@@ -76,7 +80,11 @@ struct XCSift: ParsableCommand {
7680 }
7781 }
7882
79- private func outputResult( _ result: BuildResult ) {
83+ private func outputResult( _ result: BuildResult , quiet: Bool ) {
84+ // In quiet mode, suppress output if build succeeded with no warnings or errors
85+ if quiet && result. status == " success " && result. summary. warnings == 0 {
86+ return
87+ }
8088 outputJSON ( result)
8189 }
8290
0 commit comments