Skip to content

Commit bde64d0

Browse files
authored
Merge pull request #41 from prattlOrg/ben-local
fixed version showing dev on production
2 parents 08d9f6f + 898f76f commit bde64d0

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

.goreleaser.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ builds:
1717
goarch: 386
1818
- goos: windows
1919
goarch: arm64
20-
ldflags:
21-
- -s -w -X cmd.version={{.Version}} -X cmd.commit={{.Commit}} -X cmd.date={{.Date}} -X cmd.builtBy=goreleaser
2220

2321
# binary_signs:
2422
# - {}

cmd/root.go

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
package cmd
22

33
import (
4+
"fmt"
45
"os"
56

67
"github.com/spf13/cobra"
78
)
89

9-
var (
10-
version = "dev"
11-
// commit = "none"
12-
// date = "unknown"
13-
)
14-
1510
var RootCmd = &cobra.Command{
16-
Use: "prattl",
17-
Short: "Prattl is a transcription tool",
18-
Long: "A transcription tool built with Go and Python.\nComplete documentation is available at https://github.com/prattlOrg/prattl",
19-
Version: version,
11+
Use: "prattl",
12+
Short: "Prattl is a transcription tool",
13+
Long: "A transcription tool built with Go and Python.\nComplete documentation is available at https://github.com/prattlOrg/prattl",
2014
}
2115

22-
func Execute() {
16+
func Execute(version string) {
17+
if version == "dev" {
18+
RootCmd.Version = version
19+
} else {
20+
RootCmd.Version = fmt.Sprintf("v%v", version)
21+
}
2322
if err := RootCmd.Execute(); err != nil {
2423
os.Exit(1)
2524
}

main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import (
77
"github.com/prattlOrg/prattl/internal/ffmpeg"
88
)
99

10+
var version = "dev"
11+
1012
func main() {
1113
err := ffmpeg.CheckInstall()
1214
if err != nil {
1315
log.Fatalf("error creating prattl env: %v\n", err)
1416
}
15-
cmd.Execute()
17+
cmd.Execute(version)
1618
}

0 commit comments

Comments
 (0)