- 重构 sysconf 为文档模型 INI Parser 与 Config Framework - 强化 hosts 解析、插入校验、写回与异常输入处理 - 完善 StarCmd 生命周期、等待 API、流式输出与 IO 重定向 - 扩展跨平台文件时间、文件锁、内存、进程与网络能力 - 将 Windows 进程适配更新到 b612.me/wincmd v0.1.0 - 移除本地 wincmd/win32api replace,改用发布版依赖 - 将最低 Go 版本提升到 1.18 - 补充 hosts、sysconf、FileLock、StarCmd 与平台适配回归测试
28 lines
531 B
Go
28 lines
531 B
Go
package sysconf
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func ExampleNewIni_migration() {
|
|
ini := NewIni()
|
|
_ = ini.Parse([]byte("[app]\nport=8080\nfeature=alpha\nfeature=beta\n"))
|
|
|
|
app := ini.Section("app")
|
|
_ = app.SetInt("port", 9090, "")
|
|
_ = app.SetAll("feature", []string{"stable", "audit"}, "")
|
|
|
|
fmt.Println(ini.Get("app", "port"))
|
|
fmt.Println(ini.GetAll("app", "feature"))
|
|
fmt.Println(strings.TrimSpace(string(ini.Build())))
|
|
|
|
// Output:
|
|
// 9090
|
|
// [stable audit]
|
|
// [app]
|
|
// port=9090
|
|
// feature=stable
|
|
// feature=audit
|
|
}
|