with custom build cli

This commit is contained in:
Kasper Juul Hermansen 2022-10-30 18:46:00 +01:00
parent 2c06aa4353
commit 5d9a6296f1
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23

19
pkg/cli/custom.go Normal file
View File

@ -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()
}