UNPKG

@u4/adbkit

Version:

A Typescript client for the Android Debug Bridge.

35 lines 1.13 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 GetPackagesCommand extends command_1.default { async execute(flags) { if (flags) { this.sendCommand(`shell:pm list packages ${flags} 2>/dev/null`); } else { this.sendCommand('shell:pm list packages 2>/dev/null'); } await this.readOKAY(); const data = await this.parser.readAll(); return this._parsePackages(data.toString()); } _parsePackages(value) { const packages = []; const RE_PACKAGE = /^package:(.*?)\r?$/gm; for (;;) { const match = RE_PACKAGE.exec(value); if (match) { packages.push(match[1]); } else { break; } } return packages; } } exports.default = GetPackagesCommand; //# sourceMappingURL=getpackages.js.map