MCPcopy Create free account
hub / github.com/Mister-leo/fssh / normalizeConfigKey

Function normalizeConfigKey

internal/sshconfig/global.go:144–166  ·  view source on GitHub ↗

normalizeConfigKey normalizes a config key to standard SSH format Converts various formats to the canonical SSH config key format

(key string)

Source from the content-addressed store, hash-verified

142// normalizeConfigKey normalizes a config key to standard SSH format
143// Converts various formats to the canonical SSH config key format
144func 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
169func setConfigField(cfg *HostConfig, key, value string) error {

Callers 2

SetGlobalOptionFunction · 0.85
UnsetGlobalOptionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected