示例#1
0
文件: setting.go 项目: swan-go/gopm
// SetConfigValue sets and saves gopm configuration.
func SetConfigValue(section, key, val string) error {
	Cfg.SetValue(section, key, val)
	if err := goconfig.SaveConfigFile(Cfg, ConfigFile); err != nil {
		return fmt.Errorf("fail to set config value(%s:%s=%s): %v", section, key, val, err)
	}
	return nil
}
示例#2
0
文件: setting.go 项目: swan-go/gopm
// DeleteConfigOption deletes and saves gopm configuration.
func DeleteConfigOption(section, key string) error {
	Cfg.DeleteKey(section, key)
	if err := goconfig.SaveConfigFile(Cfg, ConfigFile); err != nil {
		return fmt.Errorf("fail to delete config key(%s:%s): %v", section, key, err)
	}
	return nil
}
示例#3
0
文件: setting.go 项目: swan-go/gopm
func SaveLocalNodes() error {
	if err := goconfig.SaveConfigFile(LocalNodes, LocalNodesFile); err != nil {
		return fmt.Errorf("fail to save localnodes.list: %v", err)
	}
	return nil
}
示例#4
0
文件: setting.go 项目: swan-go/gopm
// SaveGopmfile saves gopmfile to given path.
func SaveGopmfile(gf *goconfig.ConfigFile, fileName string) error {
	if err := goconfig.SaveConfigFile(gf, fileName); err != nil {
		return fmt.Errorf("Fail to save gopmfile: %v", err)
	}
	return nil
}