hdckit
Version:
A pure Node.js client for the OpenHarmony Device Connector
23 lines (22 loc) • 799 B
JavaScript
;
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"));
const RE_KEYVAL = /^\s*([\s\S]*?) = ([\s\S]*?)\r?$/gm;
class GetParametersCommand extends Command_1.default {
async execute() {
this.send('shell param get');
return this.connection.readAll().then((data) => {
const value = data.toString();
const params = {};
let match;
while ((match = RE_KEYVAL.exec(value))) {
params[match[1]] = match[2];
}
return params;
});
}
}
exports.default = GetParametersCommand;