Skip to content

Commit

Permalink
Fix #44: Integrate the version information into the binary to support…
Browse files Browse the repository at this point in the history
… 3rd party packaging
  • Loading branch information
sibprogrammer committed Oct 8, 2023
1 parent bf4f9ef commit 2d8ab1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 12 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
package main

import (
_ "embed"
"fmt"
"github.com/sibprogrammer/xq/cmd"
"strings"
)

var (
commit = "000000"
date = "unknown"
version = "0.0.0"
commit = "000000"
date = ""
)

//go:embed version
var version string

func main() {
cmd.Version = fmt.Sprintf("%s (%s, %s)", version, date, commit)
fullVersion := strings.TrimSpace(version)
if date != "" {
fullVersion += fmt.Sprintf(" (%s, %s)", date, commit)
}
cmd.Version = fullVersion
cmd.Execute()
}
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.2.2

0 comments on commit 2d8ab1b

Please sign in to comment.