(args: string[])
| 197 | } |
| 198 | |
| 199 | export function parseSetArgs(args: string[]): ParsedArg[] { |
| 200 | const parsed: ParsedArg[] = []; |
| 201 | for (const arg of args) { |
| 202 | const parts = arg.split("="); |
| 203 | const key = parts[0]; |
| 204 | if (parts.length < 2) { |
| 205 | throw new FirebaseError("Invalid argument " + clc.bold(arg) + ", must be in key=val format"); |
| 206 | } |
| 207 | if (/[A-Z]/.test(key)) { |
| 208 | throw new FirebaseError("Invalid config name " + clc.bold(key) + ", cannot use upper case."); |
| 209 | } |
| 210 | |
| 211 | const id = keyToIds(key); |
| 212 | if (isReservedNamespace(id)) { |
| 213 | throw new FirebaseError("Cannot set to reserved namespace " + clc.bold(id.config)); |
| 214 | } |
| 215 | |
| 216 | const val = parts.slice(1).join("="); // So that someone can have '=' within a variable value |
| 217 | parsed.push({ |
| 218 | configId: id.config, |
| 219 | varId: id.variable, |
| 220 | val: val, |
| 221 | }); |
| 222 | } |
| 223 | return parsed; |
| 224 | } |
| 225 | |
| 226 | export function parseUnsetArgs(args: string[]): ParsedArg[] { |
| 227 | const parsed: ParsedArg[] = []; |
nothing calls this directly
no test coverage detected
searching dependent graphs…