Add list-devices option to list the available devices.

Summary: This diff adds an option of `--list-devices` which will list the currently active devices on the machine. It will be later used to select a device by passing an `id` as an argument.

Reviewed By: danielbuechele

Differential Revision: D15524250

fbshipit-source-id: 7a79ceb1e431a25adcb4e05bc0cb68407c527806
This commit is contained in:
Pritesh Nandgaonkar
2019-05-29 09:42:32 -07:00
committed by Facebook Github Bot
parent 53b852dbe6
commit c94c2c8455
5 changed files with 68 additions and 10 deletions

View File

@@ -142,6 +142,20 @@ function getActiveDevices(): Promise<Array<IOSDeviceParams>> {
});
}
export async function getActiveDevicesAndSimulators(): Promise<
Array<IOSDevice>,
> {
const activeDevices: Array<Array<IOSDeviceParams>> = await Promise.all([
getActiveSimulators(),
getActiveDevices(),
]);
const allDevices = activeDevices[0].concat(activeDevices[1]);
return allDevices.map(device => {
const {udid, type, name} = device;
return new IOSDevice(udid, type, name);
});
}
export default (store: Store, logger: Logger) => {
// monitoring iOS devices only available on MacOS.
if (process.platform !== 'darwin') {