update as library
This commit is contained in:
parent
7577144747
commit
45ca537f6d
16
main.go
16
main.go
@ -1,16 +0,0 @@
|
|||||||
package daggergo
|
|
||||||
|
|
||||||
import (
|
|
||||||
"git.front.kjuulh.io/kjuulh/dagger-go/cmd"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
func CreateCmd() *cobra.Command {
|
|
||||||
cobracmd := &cobra.Command{
|
|
||||||
Use: "dagger-go",
|
|
||||||
}
|
|
||||||
|
|
||||||
cobracmd.AddCommand(cmd.Build())
|
|
||||||
|
|
||||||
return cobracmd
|
|
||||||
}
|
|
@ -1,12 +1,13 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Build() *cobra.Command {
|
func Build(requirementsf func(*cobra.Command), buildf func(ctx context.Context) error) *cobra.Command {
|
||||||
var (
|
var (
|
||||||
imageTag string
|
imageTag string
|
||||||
)
|
)
|
||||||
@ -22,11 +23,13 @@ func Build() *cobra.Command {
|
|||||||
log.Printf("Building image: %s\n", imageTag)
|
log.Printf("Building image: %s\n", imageTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return buildf(cmd.Context())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.PersistentFlags().StringVar(&imageTag, "image-tag", "", "the url for which to tag the docker image, defaults to private url, with repo as image name")
|
cmd.PersistentFlags().StringVar(&imageTag, "image-tag", "", "the url for which to tag the docker image, defaults to private url, with repo as image name")
|
||||||
|
|
||||||
|
requirementsf(cmd)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
10
pkg/tasks/build.go
Normal file
10
pkg/tasks/build.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
package tasks
|
||||||
|
|
||||||
|
import "log"
|
||||||
|
|
||||||
|
func Build(imageTag string) error {
|
||||||
|
|
||||||
|
log.Printf("building image: %s", imageTag)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user