diff --git a/pkg/cli/custom.go b/pkg/cli/custom.go new file mode 100644 index 0000000..899938f --- /dev/null +++ b/pkg/cli/custom.go @@ -0,0 +1,19 @@ +package cli + +import ( + "context" + "fmt" + + "github.com/spf13/cobra" +) + +func NewCustomGoBuild(command string, runf func(ctx context.Context) error) error { + cmd := &cobra.Command{ + Use: fmt.Sprintf("dagger-go build %s", command), + RunE: func(cmd *cobra.Command, args []string) error { + return runf(cmd.Context()) + }, + } + + return cmd.Execute() +}