github.com/buildpacks/pack@v0.33.3-0.20240516162812-884dd1837311/internal/commands/extension_new.go (about)

     1  package commands
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  
     6  	"github.com/buildpacks/pack/pkg/logging"
     7  )
     8  
     9  // ExtensionNewFlags define flags provided to the ExtensionNew command
    10  type ExtensionNewFlags struct {
    11  	API     string
    12  	Path    string
    13  	Stacks  []string
    14  	Version string
    15  }
    16  
    17  // extensioncreator type to be added here and argument also to be added in the function
    18  
    19  // ExtensionNew generates the scaffolding of an extension
    20  func ExtensionNew(logger logging.Logger) *cobra.Command {
    21  	cmd := &cobra.Command{
    22  		Use:     "new <id>",
    23  		Short:   "Creates basic scaffolding of an extension",
    24  		Args:    cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs),
    25  		Example: "pack extension new <example-extension>",
    26  		RunE: logError(logger, func(cmd *cobra.Command, args []string) error {
    27  			// logic will go here
    28  			return nil
    29  		}),
    30  	}
    31  
    32  	// flags will go here
    33  
    34  	AddHelpFlag(cmd, "new")
    35  	return cmd
    36  }