Esempio n. 1
0
// 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
}
Esempio n. 2
0
// 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
}
Esempio n. 3
0
func SaveLocalNodes() error {
	if err := goconfig.SaveConfigFile(LocalNodes, LocalNodesFile); err != nil {
		return fmt.Errorf("fail to save localnodes.list: %v", err)
	}
	return nil
}
Esempio n. 4
0
// 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
}