(values)
| 235 | } |
| 236 | |
| 237 | function parseArgs(values) { |
| 238 | const parsed = {}; |
| 239 | for (let index = 0; index < values.length; index += 1) { |
| 240 | const value = values[index]; |
| 241 | if (!value.startsWith("--")) { |
| 242 | continue; |
| 243 | } |
| 244 | const [rawKey, inlineValue] = value.slice(2).split("=", 2); |
| 245 | if (inlineValue != null) { |
| 246 | parsed[rawKey] = inlineValue; |
| 247 | } else if (values[index + 1] && !values[index + 1].startsWith("--")) { |
| 248 | parsed[rawKey] = values[index + 1]; |
| 249 | index += 1; |
| 250 | } else { |
| 251 | parsed[rawKey] = "true"; |
| 252 | } |
| 253 | } |
| 254 | return parsed; |
| 255 | } |
| 256 | |
| 257 | function positiveInt(value, fallback) { |
| 258 | const parsed = optionalInt(value); |
no outgoing calls
no test coverage detected