Add filtering for UUID
This commit is contained in:
parent
6124c3e6d1
commit
fecb2d096a
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue