Add support for automatic jet version update.

This commit is contained in:
go-jet 2023-07-20 13:18:35 +02:00
parent e31e30b7f7
commit b38b63d804
2 changed files with 8 additions and 3 deletions

View file

@ -1,5 +1,7 @@
package main package main
//go:generate sh -c "printf 'package main\n\nconst version = \"'%s'\"' $(git describe --tags --abbrev=0) > version.go"
import ( import (
"flag" "flag"
"fmt" "fmt"
@ -159,7 +161,7 @@ func main() {
} }
func usage() { func usage() {
fmt.Println("Jet generator 2.8.0") fmt.Println("Jet generator", version)
fmt.Println() fmt.Println()
fmt.Println("Usage:") fmt.Println("Usage:")
@ -176,7 +178,7 @@ func usage() {
} }
fmt.Println() fmt.Println()
fmt.Println(`Example command: fmt.Println(`Example commands:
$ jet -dsn=postgresql://jet:jet@localhost:5432/jetdb?sslmode=disable -schema=dvds -path=./gen $ jet -dsn=postgresql://jet:jet@localhost:5432/jetdb?sslmode=disable -schema=dvds -path=./gen
$ jet -dsn=postgres://jet:jet@localhost:26257/jetdb?sslmode=disable -schema=dvds -path=./gen #cockroachdb $ jet -dsn=postgres://jet:jet@localhost:26257/jetdb?sslmode=disable -schema=dvds -path=./gen #cockroachdb

3
cmd/jet/version.go Normal file
View file

@ -0,0 +1,3 @@
package main
const version = "v2.10.0"