(
commands: readonly string[],
options: Partial<T> | undefined,
map: Partial<Record<keyof T, string>>,
)
| 1 | export 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 | |
| 28 | export type SingleUser = number | "current"; |
| 29 | export type SingleUserOrAll = SingleUser | "all"; |
no test coverage detected