CleanTools cleans tool names by removing duplicates and trimming whitespace. Validation of tool existence is done during registration.
(toolNames []string)
| 462 | // CleanTools cleans tool names by removing duplicates and trimming whitespace. |
| 463 | // Validation of tool existence is done during registration. |
| 464 | func CleanTools(toolNames []string) []string { |
| 465 | seen := make(map[string]bool) |
| 466 | result := make([]string, 0, len(toolNames)) |
| 467 | |
| 468 | // Remove duplicates and trim whitespace |
| 469 | for _, tool := range toolNames { |
| 470 | trimmed := strings.TrimSpace(tool) |
| 471 | if trimmed == "" { |
| 472 | continue |
| 473 | } |
| 474 | if !seen[trimmed] { |
| 475 | seen[trimmed] = true |
| 476 | result = append(result, trimmed) |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | return result |
| 481 | } |
| 482 | |
| 483 | // GetDefaultToolsetIDs returns the IDs of toolsets marked as Default. |
| 484 | // This is a convenience function that builds an inventory to determine defaults. |
no outgoing calls