github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/internal/runbits/runtime/runtimeevents.go (about)

     1  package runtime
     2  
     3  import (
     4  	"io"
     5  	"os"
     6  
     7  	"github.com/ActiveState/cli/internal/output"
     8  	"github.com/ActiveState/cli/internal/runbits/runtime/progress"
     9  	"github.com/ActiveState/cli/pkg/platform/runtime/setup/events"
    10  )
    11  
    12  func NewRuntimeProgressIndicator(out output.Outputer) events.Handler {
    13  	var w io.Writer = os.Stdout
    14  	if out.Type() != output.PlainFormatName {
    15  		w = nil
    16  	}
    17  	if out.Config().Interactive {
    18  		return progress.NewProgressIndicator(w, out)
    19  	}
    20  	return progress.NewDotProgressIndicator(out)
    21  }