UNPKG

@u4/adbkit

Version:

A Typescript client for the Android Debug Bridge.

33 lines 1.11 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const command_1 = __importDefault(require("../../command")); class ServiceListCommand extends command_1.default { async execute() { this.sendCommand('exec:service list 2>/dev/null'); await this.readOKAY(); const data = await this.parser.readAll(); return this._parse(data.toString()); } _parse(value) { const packages = []; const RE_PACKAGE = /^(\d+)\s+([^:]+): \[(.*)\]\r?$/gm; for (;;) { const match = RE_PACKAGE.exec(value); if (match) { const id = Number(match[1]); const name = match[2]; const pkg = match[3]; packages.push({ id, name, pkg }); } else { break; } } return packages; } } exports.default = ServiceListCommand; //# sourceMappingURL=servicesList.js.map