github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/internal/bus/helpers.go (about)

     1  package bus
     2  
     3  import (
     4  	"github.com/wagoodman/go-partybus"
     5  
     6  	"github.com/anchore/clio"
     7  	"github.com/anchore/syft/internal/redact"
     8  	"github.com/anchore/syft/syft/event"
     9  )
    10  
    11  func Exit() {
    12  	Publish(clio.ExitEvent(false))
    13  }
    14  
    15  func ExitWithInterrupt() {
    16  	Publish(clio.ExitEvent(true))
    17  }
    18  
    19  func Report(report string) {
    20  	if len(report) == 0 {
    21  		return
    22  	}
    23  	report = redact.Apply(report)
    24  	Publish(partybus.Event{
    25  		Type:  event.CLIReport,
    26  		Value: report,
    27  	})
    28  }
    29  
    30  func Notify(message string) {
    31  	Publish(partybus.Event{
    32  		Type:  event.CLINotification,
    33  		Value: message,
    34  	})
    35  }