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

Function UpdateConfig

internal/otp/config.go:102–113  ·  view source on GitHub ↗

UpdateConfig 更新配置字段 使用回调函数修改配置,然后保存

(updateFn func(*Config) error)

Source from the content-addressed store, hash-verified

100// UpdateConfig 更新配置字段
101// 使用回调函数修改配置,然后保存
102func UpdateConfig(updateFn func(*Config) error) error {
103 cfg, err := LoadConfig(ConfigPath())
104 if err != nil {
105 return err
106 }
107
108 if err := updateFn(cfg); err != nil {
109 return err
110 }
111
112 return SaveConfig(cfg)
113}

Callers

nothing calls this directly

Calls 3

LoadConfigFunction · 0.85
ConfigPathFunction · 0.85
SaveConfigFunction · 0.85

Tested by

no test coverage detected