Add filtering for UUID

This commit is contained in:
Simon Kågedal Reimer 2019-06-07 19:19:01 +02:00
parent 6124c3e6d1
commit fecb2d096a
1 changed files with 12 additions and 0 deletions

View File

@ -15,6 +15,7 @@ struct FilteringOptions {
} }
var availability: Availability = .yes var availability: Availability = .yes
var uuid: String?
var deviceName: String? var deviceName: String?
} }
@ -35,6 +36,14 @@ extension ArgumentBinder where Options == FilteringOptions {
), to: { options, name in ), to: { options, name in
options.deviceName = name options.deviceName = name
}) })
bind(option: parser.add(
option: "--uuid",
kind: String.self,
usage: "Only affect device with exact UUID"
), to: { options, uuid in
options.uuid = uuid
})
} }
} }
@ -55,6 +64,9 @@ extension Sequence where Element == Simctl.Device {
if let deviceName = filteringOptions.deviceName, deviceName != device.name { if let deviceName = filteringOptions.deviceName, deviceName != device.name {
return false return false
} }
if let uuid = filteringOptions.uuid, uuid != device.udid {
return false
}
return filteringOptions.availability.matches(device.isAvailable) return filteringOptions.availability.matches(device.isAvailable)
} }
} }