github.com/kastenhq/syft@v0.0.0-20230821225854-0710af25cdbe/internal/bus/helpers.go (about)

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