mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-04 02:09:18 +02:00
refactor: improve readability
This commit is contained in:
parent
c5786fefd9
commit
094b859791
4 changed files with 55 additions and 68 deletions
|
@ -38,27 +38,27 @@ export class Cmd extends AdbCommandBase {
|
|||
command: string,
|
||||
...args: string[]
|
||||
) {
|
||||
let supportAbb: boolean;
|
||||
let supportCmd: boolean = this.supportsCmd;
|
||||
let supportsAbb: boolean;
|
||||
let supportsCmd: boolean = this.supportsCmd;
|
||||
let service: string;
|
||||
let Protocol: AdbSubprocessProtocolConstructor;
|
||||
if (shellProtocol) {
|
||||
supportAbb = this._supportsAbb;
|
||||
supportCmd &&= this.supportsShellV2;
|
||||
supportsAbb = this._supportsAbb;
|
||||
supportsCmd &&= this.supportsShellV2;
|
||||
service = "abb";
|
||||
Protocol = AdbSubprocessShellProtocol;
|
||||
} else {
|
||||
supportAbb = this._supportsAbbExec;
|
||||
supportsAbb = this._supportsAbbExec;
|
||||
service = "abb_exec";
|
||||
Protocol = AdbSubprocessNoneProtocol;
|
||||
}
|
||||
|
||||
if (supportAbb) {
|
||||
if (supportsAbb) {
|
||||
const socket = await this.adb.createSocket(
|
||||
`${service}:${command}\0${args.join("\0")}\0`
|
||||
);
|
||||
return new Protocol(socket);
|
||||
} else if (supportCmd) {
|
||||
} else if (supportsCmd) {
|
||||
return Protocol.raw(this.adb, `cmd ${command} ${args.join(" ")}`);
|
||||
} else {
|
||||
throw new Error("Not supported");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue