get.porter.sh/porter@v1.3.0/pkg/pkgmgmt/feed/template.go (about)

     1  package feed
     2  
     3  import (
     4  	_ "embed"
     5  	"fmt"
     6  
     7  	"get.porter.sh/porter/pkg/portercontext"
     8  )
     9  
    10  //go:embed templates/atom-template.xml
    11  var feedTemplate []byte
    12  
    13  func CreateTemplate(cxt *portercontext.Context) error {
    14  	templateFile := "atom-template.xml"
    15  	err := cxt.FileSystem.WriteFile(templateFile, feedTemplate, 0644)
    16  	if err != nil {
    17  		return fmt.Errorf("error writing mixin feed template to %s: %w", templateFile, err)
    18  	}
    19  
    20  	fmt.Fprintf(cxt.Out, "wrote mixin feed template to %s\n", templateFile)
    21  	return nil
    22  }