Skip to content

Commit

Permalink
Merge pull request #41 from prattlOrg/ben-local
Browse files Browse the repository at this point in the history
fixed version showing dev on production
  • Loading branch information
benleem authored Nov 16, 2024
2 parents 08d9f6f + 898f76f commit bde64d0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
2 changes: 0 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ builds:
goarch: 386
- goos: windows
goarch: arm64
ldflags:
- -s -w -X cmd.version={{.Version}} -X cmd.commit={{.Commit}} -X cmd.date={{.Date}} -X cmd.builtBy=goreleaser

# binary_signs:
# - {}
Expand Down
21 changes: 10 additions & 11 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
package cmd

import (
"fmt"
"os"

"github.com/spf13/cobra"
)

var (
version = "dev"
// commit = "none"
// date = "unknown"
)

var RootCmd = &cobra.Command{
Use: "prattl",
Short: "Prattl is a transcription tool",
Long: "A transcription tool built with Go and Python.\nComplete documentation is available at https://github.com/prattlOrg/prattl",
Version: version,
Use: "prattl",
Short: "Prattl is a transcription tool",
Long: "A transcription tool built with Go and Python.\nComplete documentation is available at https://github.com/prattlOrg/prattl",
}

func Execute() {
func Execute(version string) {
if version == "dev" {
RootCmd.Version = version
} else {
RootCmd.Version = fmt.Sprintf("v%v", version)
}
if err := RootCmd.Execute(); err != nil {
os.Exit(1)
}
Expand Down
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import (
"github.com/prattlOrg/prattl/internal/ffmpeg"
)

var version = "dev"

func main() {
err := ffmpeg.CheckInstall()
if err != nil {
log.Fatalf("error creating prattl env: %v\n", err)
}
cmd.Execute()
cmd.Execute(version)
}

0 comments on commit bde64d0

Please sign in to comment.