github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/cmd/syft/cli/options/secret.go (about)

     1  package options
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/anchore/clio"
     7  	"github.com/anchore/syft/internal/redact"
     8  )
     9  
    10  type secret string
    11  
    12  var _ interface {
    13  	fmt.Stringer
    14  	clio.PostLoader
    15  } = (*secret)(nil)
    16  
    17  // PostLoad needs to use a pointer receiver, even if it's not modifying the value
    18  func (r *secret) PostLoad() error {
    19  	redact.Add(string(*r))
    20  	return nil
    21  }
    22  
    23  func (r secret) String() string {
    24  	return string(r)
    25  }