@@ -55,6 +55,8 @@ struct GlobalColorOption: ParsableArguments {
5555 var color : Bool = true
5656}
5757
58+ extension Architecture : @retroactive ExpressibleByArgument { }
59+
5860@main
5961struct Xcodes : AsyncParsableCommand {
6062 static let configuration = CommandConfiguration (
@@ -361,6 +363,9 @@ struct Xcodes: AsyncParsableCommand {
361363 abstract: " List all versions of Xcode that are available to install "
362364 )
363365
366+ @Option ( help: " Only list Xcodes that support the specified architecture: arm64 or x86_64. Can be used multiple times. " )
367+ var architecture : [ Architecture ] = [ ]
368+
364369 @OptionGroup
365370 var globalDirectory : GlobalDirectoryOption
366371
@@ -378,10 +383,10 @@ struct Xcodes: AsyncParsableCommand {
378383
379384 do {
380385 if services. xcodeList. shouldUpdateBeforeListingVersions {
381- try await services. xcodeInstaller. updateAndPrint ( dataSource: globalDataSource. dataSource, directory: directory)
386+ try await services. xcodeInstaller. updateAndPrint ( dataSource: globalDataSource. dataSource, directory: directory, architectures : architecture )
382387 }
383388 else {
384- try await services. xcodeInstaller. printAvailableXcodes ( services. xcodeList. availableXcodes, installed: Current . files. installedXcodes ( directory) )
389+ try await services. xcodeInstaller. printAvailableXcodes ( services. xcodeList. availableXcodes, installed: Current . files. installedXcodes ( directory) , architectures : architecture )
385390 }
386391 List . exit ( )
387392 } catch {
@@ -399,9 +404,12 @@ struct Xcodes: AsyncParsableCommand {
399404 @Flag ( help: " Include beta runtimes available to install " )
400405 var includeBetas : Bool = false
401406
407+ @Option ( help: " Only list runtimes that support the specified architecture: arm64 or x86_64. Can be used multiple times. " )
408+ var architecture : [ Architecture ] = [ ]
409+
402410 func run( ) async throws {
403411 let services = Xcodes . makeServices ( )
404- try await services. runtimeInstaller. printAvailableRuntimes ( includeBetas: includeBetas)
412+ try await services. runtimeInstaller. printAvailableRuntimes ( includeBetas: includeBetas, architectures : architecture )
405413 }
406414
407415 struct Install : AsyncParsableCommand {
0 commit comments