MCPcopy
hub / github.com/yume-chan/ya-webadb / buildArguments

Function buildArguments

libraries/android-bin/src/utils.ts:1–26  ·  view source on GitHub ↗
(
    commands: readonly string[],
    options: Partial<T> | undefined,
    map: Partial<Record<keyof T, string>>,
)

Source from the content-addressed store, hash-verified

1export function buildArguments<T>(
2 commands: readonly string[],
3 options: Partial<T> | undefined,
4 map: Partial<Record<keyof T, string>>,
5): string[] {
6 const args = commands.slice();
7 if (options) {
8 for (const [key, value] of Object.entries(options)) {
9 if (value) {
10 const option = map[key as keyof T];
11 if (option) {
12 args.push(option);
13 switch (typeof value) {
14 case "number":
15 args.push(value.toString());
16 break;
17 case "string":
18 args.push(value);
19 break;
20 }
21 }
22 }
23 }
24 }
25 return args;
26}
27
28export type SingleUser = number | "current";
29export type SingleUserOrAll = SingleUser | "all";

Callers 5

startActivityMethod · 0.85
buildInstallArgumentsFunction · 0.85
listPackagesMethod · 0.85
uninstallMethod · 0.85
resolveActivityMethod · 0.85

Calls 2

pushMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected