github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/pkg/control/controldisplay/formatter_null.go (about)

     1  package controldisplay
     2  
     3  import (
     4  	"context"
     5  	"github.com/turbot/steampipe/pkg/constants"
     6  	"github.com/turbot/steampipe/pkg/control/controlexecute"
     7  	"io"
     8  	"strings"
     9  )
    10  
    11  // NullFormatter is to be used when no output is expected. It always returns a `io.Reader` which
    12  // reads an empty string
    13  type NullFormatter struct {
    14  	FormatterBase
    15  }
    16  
    17  func (j *NullFormatter) Format(ctx context.Context, tree *controlexecute.ExecutionTree) (io.Reader, error) {
    18  	return strings.NewReader(""), nil
    19  }
    20  
    21  func (j *NullFormatter) FileExtension() string {
    22  	// will not be called
    23  	return ""
    24  }
    25  
    26  func (j *NullFormatter) Name() string {
    27  	return constants.OutputFormatNone
    28  }