UNPKG

@u4/adbkit

Version:

A Typescript client for the Android Debug Bridge.

43 lines 1.64 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const commander_1 = require("commander"); const utils_1 = __importDefault(require("./adb/utils")); const cli_common_1 = require("./cli-common"); commander_1.program .command('usb-tethering-off [serials...]') .description('Disable USB tethering.') .action(async (serials) => { const devices = await (0, cli_common_1.getClientDevice)(serials); const process = async (device) => { if (await device.extra.usbTethering(false)) { console.log(`[${device.serial}] tethering enabled`); await utils_1.default.delay(100); await device.extra.back(); } else { console.log(`[${device.serial}] failed or already enabled`); } }; await Promise.all(devices.map(process)); }); commander_1.program .command('usb-tethering-on [serials...]') .description('Enable USB tethering.') .action(async (serials) => { const devices = await (0, cli_common_1.getClientDevice)(serials); const process = async (device) => { if (await device.extra.usbTethering(true)) { console.log(`[${device.serial}] tethering enabled`); await utils_1.default.delay(100); await device.extra.back(); } else { console.log(`[${device.serial}] failed or already enabled`); } }; await Promise.all(devices.map(process)); }); //# sourceMappingURL=cli-tethering.js.map