MCPcopy Create free account
hub / github.com/Snapchat/Valdi / parseAndroidDevices

Function parseAndroidDevices

npm_modules/cli/src/utils/deviceUtils.ts:5–12  ·  view source on GitHub ↗
(devicesString: string)

Source from the content-addressed store, hash-verified

3import { runCliCommand, spawnCliCommand } from './cliUtils';
4
5function parseAndroidDevices(devicesString: string): string[] {
6 const deviceIDs: string[] = devicesString
7 .split('\n')
8 .filter(line => line.trim().endsWith('device') && !line.startsWith('List of devices'))
9 .map(line => line.split('\t')?.[0]?.trim() ?? ''); // Extract the device ID
10
11 return deviceIDs ?? [];
12}
13
14export async function getArchitectureForAndroidDevice(deviceId: string): Promise<Architecture> {
15 const { stdout } = await runCliCommand(`adb -s ${deviceId} shell getprop ro.product.cpu.abi`, undefined, true);

Callers 1

Calls 5

filterMethod · 0.80
splitMethod · 0.80
startsWithMethod · 0.80
mapMethod · 0.45
trimMethod · 0.45

Tested by

no test coverage detected