diff --git a/cli/cli.v b/cli/cli.v index bd6bf1cd..7922d286 100644 --- a/cli/cli.v +++ b/cli/cli.v @@ -142,6 +142,7 @@ pub fn args_to_options(arguments []string, defaults Options) !(Options, &flag.Fl list_ndks: fp.bool('list-ndks', 0, defaults.list_ndks, 'List available NDK versions') list_apis: fp.bool('list-apis', 0, defaults.list_apis, 'List available API levels') list_build_tools: fp.bool('list-build-tools', 0, defaults.list_build_tools, 'List available Build-tools versions') + list_devices: fp.bool('list-devices', 0, defaults.list_devices, 'List available device IDs (including running emulators)') // screenshot: fp.string('screenshot', 0, '', 'Take a screenshot on a device and save it to /path/to/file.png or /path/to/directory') screenshot_delay: fp.float('screenshot-delay', 0, 0.0, 'Wait for this amount of seconds before taking screenshot') diff --git a/cli/options.v b/cli/options.v index 5e0132ab..1ae2623d 100644 --- a/cli/options.v +++ b/cli/options.v @@ -29,6 +29,7 @@ pub: list_ndks bool list_apis bool list_build_tools bool + list_devices bool // screenshot functionality screenshot string // /path/to/screenshot.png screenshot_delay f64 diff --git a/vab.v b/vab.v index 2c66813d..109ed17a 100644 --- a/vab.v +++ b/vab.v @@ -71,6 +71,17 @@ fn main() { } exit(0) } + + if opt.list_devices { + devices := android.adb_get_device_list(opt.verbosity) or { + eprintln('Error getting device list: ${err}') + exit(1) + } + println('Device IDs:\n') + println(devices.join('\n')) + exit(0) + } + // All flags after this requires an input argument, except // doing one-off screenshots on a device if fp.args.len == 0 {