// DoSelfUpdate checks for updates once per day and prompts the user to update if there is a newer version available
DoSelfUpdate checks for updates once per day and prompts the user to update if there is a newer version available
// DoSelfUpdate checks for updates once per day and prompts the user to update if there is a newer version available
func DoSelfUpdateOnceADay(f *factory.Factory) (bool, error) {
	if !f.IOStreams.CanPrompt() {
		return false, nil
	}
	if build.IsDevBuild() {
		return false, nil
	}
	cfg, err := f.Config.Load()
	logger := f.Logger
	if err != nil {
		return false, err
	}
	logger.Debug("Checking for updates. Last check was done:", cfg.LastUpdated)
	if cfg.LastUpdated < time.Now().AddDate(0, 0, -1).UnixMilli() {
		updated, err := DoSelfUpdate(f)
		if err != nil {
			return false, err
		}
		cfg.LastUpdated = time.Now().UnixMilli()
		err = f.Config.Save(cfg)
		if err != nil {
			return false, err
		}
		return updated, nil
	}
	return false, nil
}
func DoSelfUpdateOnceADay ( f * factory . Factory ) ( bool , error ) { if ! f . IOStreams . CanPrompt ( ) { return false , nil } if build . IsDevBuild ( ) { return false , nil } cfg , err := f . Config . Load ( ) logger := f . Logger if err != nil { return false , err } logger . Debug ( " " , cfg . LastUpdated ) if cfg . LastUpdated < time . Now ( ) . AddDate ( 0 , 0 , - 1 ) . UnixMilli ( ) { updated , err := DoSelfUpdate ( f ) if err != nil { return false , err } cfg . LastUpdated = time . Now ( ) . UnixMilli ( ) err = f . Config . Save ( cfg ) if err != nil { return false , err } return updated , nil } return false , nil }
DoSelfUpdate checks for updates once per day and prompts the user to update if there is a newer version available
DoSelfUpdate checks for updates once per day and prompts the user to update if there is a newer version available
// Do not prompt if we are not in interactive mode