( optionParts: string[], hasOptions: boolean, allowName: boolean, quiet = false, )
| 210 | } |
| 211 | |
| 212 | function parseOptions( |
| 213 | optionParts: string[], |
| 214 | hasOptions: boolean, |
| 215 | allowName: boolean, |
| 216 | quiet = false, |
| 217 | ): ParsedOptions { |
| 218 | if (optionParts.length === 0) { |
| 219 | return { |
| 220 | defaultValue: "", |
| 221 | allowCustomInput: false, |
| 222 | usesOptions: false, |
| 223 | }; |
| 224 | } |
| 225 | |
| 226 | const optionKeys = allowName ? NAMED_VALUE_OPTION_KEYS : VALUE_OPTION_KEYS; |
| 227 | const allowNumericOptions = hasNumericType(optionParts, allowName); |
| 228 | const hasExplicitOption = optionParts.some((part) => |
| 229 | hasRecognizedOption(part, allowName) || |
| 230 | (allowNumericOptions && |
| 231 | NUMERIC_RANGE_OPTION_KEYS.has( |
| 232 | parsePipeKeyValue(part.trim())?.key ?? "", |
| 233 | )), |
| 234 | ); |
| 235 | const hasCustomFlag = |
| 236 | hasOptions && |
| 237 | optionParts.some( |
| 238 | (part) => part.trim().toLowerCase() === "custom", |
| 239 | ); |
| 240 | const hasMultiFlag = |
| 241 | hasOptions && |
| 242 | optionParts.some((part) => part.trim().toLowerCase() === "multi"); |
| 243 | const usesOptions = hasExplicitOption || hasCustomFlag || hasMultiFlag; |
| 244 | |
| 245 | if (!usesOptions) { |
| 246 | return { |
| 247 | defaultValue: optionParts.join("|").trim(), |
| 248 | allowCustomInput: false, |
| 249 | usesOptions: false, |
| 250 | }; |
| 251 | } |
| 252 | |
| 253 | let label: string | undefined; |
| 254 | let caseStyle: string | undefined; |
| 255 | let defaultValue = ""; |
| 256 | let allowCustomInput = false; |
| 257 | let inputTypeOverride: string | undefined; |
| 258 | let minRaw: string | undefined; |
| 259 | let maxRaw: string | undefined; |
| 260 | let stepRaw: string | undefined; |
| 261 | let displayValuesRaw: string | undefined; |
| 262 | let optionalExplicit: boolean | undefined; |
| 263 | let trimExplicit: boolean | undefined; |
| 264 | let name: string | undefined; |
| 265 | let multiSelect = false; |
| 266 | let multiEmit: MultiEmit | undefined; |
| 267 | |
| 268 | for (const part of optionParts) { |
| 269 | const trimmed = part.trim(); |
no test coverage detected