parseModelsOutput splits stdout on \n and drops empty/whitespace lines. Each surviving line is trimmed.
(raw string)
| 338 | // parseModelsOutput splits stdout on \n and drops empty/whitespace lines. |
| 339 | // Each surviving line is trimmed. |
| 340 | func parseModelsOutput(raw string) []string { |
| 341 | var models []string |
| 342 | for _, line := range strings.Split(raw, "\n") { |
| 343 | trimmed := strings.TrimSpace(line) |
| 344 | if trimmed == "" { |
| 345 | continue |
| 346 | } |
| 347 | models = append(models, trimmed) |
| 348 | } |
| 349 | return models |
| 350 | } |
| 351 | |
| 352 | // buildDiscoveryEnv constructs the env slice passed to list_models_cmd. |
| 353 | // Starts from os.Environ() (via getenv if injected via tests), strips |