normalizeConfigKey normalizes a config key to standard SSH format Converts various formats to the canonical SSH config key format
(key string)
| 142 | // normalizeConfigKey normalizes a config key to standard SSH format |
| 143 | // Converts various formats to the canonical SSH config key format |
| 144 | func normalizeConfigKey(key string) string { |
| 145 | // Remove spaces and underscores |
| 146 | key = strings.ReplaceAll(key, " ", "") |
| 147 | key = strings.ReplaceAll(key, "_", "") |
| 148 | key = strings.ReplaceAll(key, "-", "") |
| 149 | |
| 150 | // Convert to lowercase for case-insensitive matching |
| 151 | lower := strings.ToLower(key) |
| 152 | |
| 153 | // Try exact match first (case-insensitive) |
| 154 | for standardKey := range GlobalConfigOptions { |
| 155 | if strings.ToLower(standardKey) == lower { |
| 156 | return standardKey |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | // If no match, try to capitalize first letter |
| 161 | if len(key) > 0 { |
| 162 | return strings.ToUpper(key[:1]) + key[1:] |
| 163 | } |
| 164 | |
| 165 | return key |
| 166 | } |
| 167 | |
| 168 | // setConfigField sets a config field by name |
| 169 | func setConfigField(cfg *HostConfig, key, value string) error { |
no outgoing calls
no test coverage detected