summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile10
-rw-r--r--argv.go10
-rw-r--r--main.go2
3 files changed, 13 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 266aebb..ddde8a2 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
.PHONY: debian
VERSION = $(shell git describe --tags)
-DATE = $(shell date +%Y.%m.%d)
+BUILDTIME = $(shell date +%s)
run: clean goimports vet install
go-deb --gui andlabs gui
@@ -21,12 +21,12 @@ auto-build: build
build: goimports vet
-rm resources/*.so
touch resources/blank.so
- GO111MODULE="off" go build -v \
- -ldflags "-X main.VERSION=${VERSION} -X main.DATE=${DATE} -X gui.GUIVERSION=${VERSION}"
+ GO111MODULE=off go build -v -x \
+ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
install: goimports
- GO111MODULE="off" go install -v \
- -ldflags "-X main.VERSION=${VERSION} -X main.DATE=${DATE} -X gui.GUIVERSION=${VERSION}"
+ GO111MODULE=off go install \
+ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
goimports:
goimports -w *.go
diff --git a/argv.go b/argv.go
index b7757fd..5cdf722 100644
--- a/argv.go
+++ b/argv.go
@@ -26,7 +26,7 @@ type args struct {
}
func (args) Version() string {
- return "go-clone " + VERSION + " Built on " + DATE
+ return "go-clone " + VERSION + " Built on " + BUILDTIME
}
type EmptyCmd struct {
@@ -49,11 +49,15 @@ func (args) Appname() string {
return ARGNAME
}
+func (args) Buildtime() (string, string) {
+ return BUILDTIME, VERSION
+}
+
func (a args) DoAutoComplete(pb *prep.Auto) {
if pb.Cmd == "" {
- pb.Autocomplete3([]string{"arch", "build", "gui", "show"})
+ pb.Autocomplete3([]string{"arch", "build", "gui", "show", "--version"})
} else {
- pb.SubCommand(pb.Argv...)
+ pb.SubCommand(pb.Goargs...)
}
os.Exit(0)
}
diff --git a/main.go b/main.go
index 4414b59..1438802 100644
--- a/main.go
+++ b/main.go
@@ -13,7 +13,7 @@ import (
// sent from -ldflags
var VERSION string
-var DATE string
+var BUILDTIME string
//go:embed resources/*
var resources embed.FS