github.com/corylanou/buffalo@v0.8.0/buffalo/cmd/generate/goth.go (about)

     1  package generate
     2  
     3  import (
     4  	"errors"
     5  
     6  	"github.com/gobuffalo/buffalo/generators/goth"
     7  	"github.com/gobuffalo/makr"
     8  	"github.com/spf13/cobra"
     9  )
    10  
    11  // GothCmd generates a actions/goth.go file configured to the specified providers.
    12  var GothCmd = &cobra.Command{
    13  	Use:   "goth [provider provider...]",
    14  	Short: "Generates a actions/goth.go file configured to the specified providers.",
    15  	RunE: func(cmd *cobra.Command, args []string) error {
    16  		if len(args) == 0 {
    17  			return errors.New("you must specify at least one provider")
    18  		}
    19  		g, err := goth.New()
    20  		if err != nil {
    21  			return err
    22  		}
    23  		return g.Run(".", makr.Data{
    24  			"providers": args,
    25  		})
    26  	},
    27  }