// SaveConfig updates the `since` parameter to now, then saves the configuration file.
SaveConfig updates the `since` parameter to now, then saves the configuration file.
// SaveConfig updates the ` since ` parameter to now then saves the configuration file .
func (c *Config) SaveConfig() error {
	c.cmdConfig.Set("since", time.Now().Format(dateFormat))
	var cf configFile
	c.cmdConfig.Unmarshal(&cf)
	b, err := json.MarshalIndent(cf, "", "  ")
	if err != nil {
		return err
	}
	f, err := os.OpenFile(c.cmdConfig.ConfigFileUsed(), os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0644)
	if err != nil {
		return err
	}
	defer f.Close()
	f.WriteString(string(b))
	return nil
}
func ( c * Config ) SaveConfig ( ) error { c . cmdConfig . Set ( " " , time . Now ( ) . Format ( dateFormat ) ) var cf configFile c . cmdConfig . Unmarshal ( & cf ) b , err := json . MarshalIndent ( cf , " " , " " ) if err != nil { return err } f , err := os . OpenFile ( c . cmdConfig . ConfigFileUsed ( ) , os . O_RDWR | os . O_TRUNC | os . O_CREATE , 0644 ) if err != nil { return err } defer f . Close ( ) f . WriteString ( string ( b ) ) return nil }
SaveConfig updates the `since` parameter to now, then saves the configuration file.
SaveConfig updates the ` since ` parameter to now then saves the configuration file .