github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/pkg/export/target.go (about)

     1  package export
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  	"os"
     7  )
     8  
     9  type Target struct {
    10  	exporter      Exporter
    11  	filePath      string
    12  	isNamedTarget bool
    13  }
    14  
    15  func (t *Target) Export(ctx context.Context, input ExportSourceData) (string, error) {
    16  	err := t.exporter.Export(ctx, input, t.filePath)
    17  	if err != nil {
    18  		return "", err
    19  	} else {
    20  		pwd, _ := os.Getwd()
    21  		return fmt.Sprintf("File exported to %s/%s", pwd, t.filePath), nil
    22  	}
    23  }