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

Function UnsetGlobalOption

internal/sshconfig/global.go:120–140  ·  view source on GitHub ↗

UnsetGlobalOption removes a global configuration option

(key string)

Source from the content-addressed store, hash-verified

118
119// UnsetGlobalOption removes a global configuration option
120func UnsetGlobalOption(key string) error {
121 // Normalize key
122 key = normalizeConfigKey(key)
123
124 // Load existing config
125 cfg, found, err := LoadGlobalConfig()
126 if err != nil {
127 return err
128 }
129 if !found {
130 return fmt.Errorf("Host * block not found")
131 }
132
133 // Clear the option value
134 if err := setConfigField(cfg, key, ""); err != nil {
135 return err
136 }
137
138 // Write back
139 return WriteGlobalConfig(cfg)
140}
141
142// normalizeConfigKey normalizes a config key to standard SSH format
143// Converts various formats to the canonical SSH config key format

Callers 1

cmdGlobalUnsetFunction · 0.92

Calls 4

normalizeConfigKeyFunction · 0.85
LoadGlobalConfigFunction · 0.85
setConfigFieldFunction · 0.85
WriteGlobalConfigFunction · 0.85

Tested by

no test coverage detected