(platform: string)
| 25 | // Prompts User to choose from the list of available devices |
| 26 | // No prompt if only one device is available |
| 27 | async function getDeviceChoice(platform: string): Promise<string> { |
| 28 | const availableDevices = await getConnectedDevices(platform); |
| 29 | |
| 30 | if (availableDevices.length === 0) { |
| 31 | throw new CliError('No devices connected...'); |
| 32 | } else if (availableDevices.length === 1) { |
| 33 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
| 34 | const selectedDevice: string = availableDevices[0]!; |
| 35 | console.log('Only one device connected, using it:', wrapInColor(selectedDevice, ANSI_COLORS.GREEN_COLOR)); |
| 36 | return selectedDevice; |
| 37 | } |
| 38 | |
| 39 | // Prompt user to select a device |
| 40 | const choices: Array<CliChoice<string> | Separator> = []; |
| 41 | |
| 42 | if (platform === PLATFORM.ANDROID) { |
| 43 | choices.push(new Separator('-----Android Devices-----')); |
| 44 | } else if (platform === PLATFORM.IOS) { |
| 45 | choices.push(new Separator('-----iOS Devices-----')); |
| 46 | } |
| 47 | choices.push(...availableDevices.map(device => ({ name: device, value: device }))); |
| 48 | |
| 49 | return await getUserChoice(choices, 'Please select a device to perform the install:'); |
| 50 | } |
| 51 | |
| 52 | export async function getBuildInfo(argv: ArgumentsResolver<CommandParameters>, bazel: BazelClient, checkDevice: boolean): Promise<BuildInfo> { |
| 53 | const platform = argv.getArgument('platform') as PLATFORM; |
no test coverage detected