public override int Execute([NotNull] CommandContext context, [NotNull] DeviceInfoCommandSettings settings) { try { var adb = new Adb(settings?.Home); var devices = adb.GetDevices(); var deviceFilterSpecified = settings.Devices?.Any() ?? false; var results = new List <DeviceWrapper>(); foreach (var device in devices) { // If filtering on device, check that this is in the list if (deviceFilterSpecified && !settings.Devices.Any(d => IsPropertyMatch(device.Serial, d))) { continue; } var props = adb.GetProperties(device.Serial, settings.Properties); if (settings.Format == OutputFormat.None) { var rule = new Rule(device.Serial); AnsiConsole.Render(rule); OutputHelper.OutputTable(props, new[] { "Property Name", "Property Value" }, i => new[] { i.Key, i.Value }); AnsiConsole.WriteLine(); } results.Add(new DeviceWrapper { Device = device, Properties = adb.GetProperties(device.Serial, settings.Properties) }); } if (settings.Format != OutputFormat.None) { OutputHelper.Output(results, settings.Format); } } catch (SdkToolFailedExitException sdkEx) { Program.WriteException(sdkEx); return(1); } return(0); }