github.com/anchore/syft@v1.38.2/cmd/syft/internal/commands/utils.go (about)

     1  package commands
     2  
     3  import (
     4  	"io"
     5  
     6  	"github.com/spf13/cobra"
     7  
     8  	"github.com/anchore/clio"
     9  	"github.com/anchore/syft/cmd/syft/internal/ui"
    10  )
    11  
    12  func disableUI(app clio.Application, out io.Writer) func(*cobra.Command, []string) error {
    13  	return func(_ *cobra.Command, _ []string) error {
    14  		type Stater interface {
    15  			State() *clio.State
    16  		}
    17  
    18  		state := app.(Stater).State()
    19  		state.UI = clio.NewUICollection(ui.None(out, state.Config.Log.Quiet))
    20  
    21  		return nil
    22  	}
    23  }