Added build script and version command
This commit is contained in:
1 parent
35974fa070
commit
0f358ff991
4 files changed
+94
No files matched your search
@@ -42,6 +42,7 @@ schema patch in order, and generates Go structs from the result.`,
|
||||
pf.BoolVarP(&opts.quiet, "quiet", "q", false, "don't print notes and warnings")
|
||||
|
||||
root.AddCommand(
|
||||
newVersionCmd(),
|
||||
newGenerateCmd(opts),
|
||||
newResolveCmd(opts),
|
||||
newSchemaCmd(opts),
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.avsdev.uk/Go/go-ocds/internal/version"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newVersionCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Print version information",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("ocdsgen - %s\n", version.Version)
|
||||
if version.BuildTime != "unknown" {
|
||||
fmt.Printf("Built: %s\n", version.BuildTime)
|
||||
}
|
||||
if version.GitCommit != "unknown" {
|
||||
fmt.Printf("Commit: %s\n", version.GitCommit)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package version
|
||||
|
||||
// Version information (set at build time with -ldflags)
|
||||
var (
|
||||
Version = "dev"
|
||||
BuildTime = "unknown"
|
||||
GitCommit = "unknown"
|
||||
)
|
||||
Reference in new issue
Block a user