镜像自地址
https://github.com/tuna/tunasync.git
已同步 2025-12-07 15:06:47 +00:00
chore(cmd): added git hash and build date to version
这个提交包含在:
@@ -1,8 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@@ -16,6 +18,11 @@ import (
|
||||
"github.com/tuna/tunasync/worker"
|
||||
)
|
||||
|
||||
var (
|
||||
buildstamp = ""
|
||||
githash = "No githash provided"
|
||||
)
|
||||
|
||||
var logger = logging.MustGetLogger("tunasync")
|
||||
|
||||
func startManager(c *cli.Context) {
|
||||
@@ -99,6 +106,28 @@ func startWorker(c *cli.Context) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
cli.VersionPrinter = func(c *cli.Context) {
|
||||
var builddate string
|
||||
if buildstamp == "" {
|
||||
builddate = "No build date provided"
|
||||
} else {
|
||||
ts, err := strconv.Atoi(buildstamp)
|
||||
if err != nil {
|
||||
builddate = "No build date provided"
|
||||
} else {
|
||||
t := time.Unix(int64(ts), 0)
|
||||
builddate = t.String()
|
||||
}
|
||||
}
|
||||
fmt.Printf(
|
||||
"Version: %s\n"+
|
||||
"Git Hash: %s\n"+
|
||||
"Build Date: %s\n",
|
||||
c.App.Version, githash, builddate,
|
||||
)
|
||||
}
|
||||
|
||||
app := cli.NewApp()
|
||||
app.EnableBashCompletion = true
|
||||
app.Version = "0.1"
|
||||
|
||||
在新工单中引用
屏蔽一个用户