@u4/adbkit
Version:
A Typescript client for the Android Debug Bridge.
38 lines • 1.32 kB
JavaScript
import { program } from 'commander';
import Utils from './adb/utils.js';
import { getClientDevice } from './cli-common.js';
program
.command('usb-tethering-off [serials...]')
.description('Disable USB tethering.')
.action(async (serials) => {
const devices = await getClientDevice(serials);
const process = async (device) => {
if (await device.extra.usbTethering(false)) {
console.log(`[${device.serial}] tethering enabled`);
await Utils.delay(100);
await device.extra.back();
}
else {
console.log(`[${device.serial}] failed or already enabled`);
}
};
await Promise.all(devices.map(process));
});
program
.command('usb-tethering-on [serials...]')
.description('Enable USB tethering.')
.action(async (serials) => {
const devices = await getClientDevice(serials);
const process = async (device) => {
if (await device.extra.usbTethering(true)) {
console.log(`[${device.serial}] tethering enabled`);
await Utils.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