func NewInstanceProgressWriter()

in fast-build-update-tool/internal/runner/instance_progress_writer.go [21:44]


func NewInstanceProgressWriter(instance *gamelift.Instance, verbose bool) (*InstanceProgressWriter, error) {
	if verbose {
		return &InstanceProgressWriter{verbose: verbose}, nil
	}

	instanceUpdateState := UpdateStateNotStarted

	// Set up the progress bar we'll be showing to the user
	progressBar, err := pterm.DefaultProgressbar.
		WithTotal(int(UpdateStateCount)).
		WithShowElapsedTime(false).
		WithTitle(stateString(instance.InstanceId, instance.IpAddress, instanceUpdateState)).Start()
	if err != nil {
		return nil, err
	}

	return &InstanceProgressWriter{
		instanceId:          instance.InstanceId,
		instanceIp:          instance.IpAddress,
		verbose:             verbose,
		instanceUpdateState: instanceUpdateState,
		progressBar:         progressBar,
	}, nil
}