/*
Save
Save changes to disk */
Save
Save changes to disk
/ * Save Save changes to disk * /
func (cfg *Config) Save() error {
	if cfg.Root != nil {
		var oldRootConfig *RootConfig
		var err error
		if cfg.Root.Path != "" {
			oldRootConfig, err = loadRootConfigFromPath(cfg.Root.Path)
		} else {
			oldRootConfig, err = loadRootConfig()
		}
		if err != nil {
			return err
		}
		cfg.Root.sortHosts()
		if !rootConfigsEqual(oldRootConfig, cfg.Root) {
			err = cfg.Root.save()
			if err != nil {
				return err
			}
		}
	}
	if cfg.Local != nil {
		var oldLocalConfig *LocalConfig
		var err error
		if cfg.Local.Path != "" {
			oldLocalConfig, err = loadLocalConfigFromPath(cfg.Local.Path)
		} else {
			oldLocalConfig, err = loadLocalConfig()
		}
		if err != nil {
			return err
		}
		cfg.Local.sortResources()
		if !localConfigsEqual(oldLocalConfig, cfg.Local) {
			err = cfg.Local.Save()
			if err != nil {
				return err
			}
		}
	}
	return nil
}
func ( cfg * Config ) Save ( ) error { if cfg . Root != nil { var oldRootConfig * RootConfig var err error if cfg . Root . Path != " " { oldRootConfig , err = loadRootConfigFromPath ( cfg . Root . Path ) } else { oldRootConfig , err = loadRootConfig ( ) } if err != nil { return err } cfg . Root . sortHosts ( ) if ! rootConfigsEqual ( oldRootConfig , cfg . Root ) { err = cfg . Root . save ( ) if err != nil { return err } } } if cfg . Local != nil { var oldLocalConfig * LocalConfig var err error if cfg . Local . Path != " " { oldLocalConfig , err = loadLocalConfigFromPath ( cfg . Local . Path ) } else { oldLocalConfig , err = loadLocalConfig ( ) } if err != nil { return err } cfg . Local . sortResources ( ) if ! localConfigsEqual ( oldLocalConfig , cfg . Local ) { err = cfg . Local . Save ( ) if err != nil { return err } } } return nil }
Save
Save changes to disk
Save Save changes to disk