Compare commits

..

7 Commits

4 changed files with 32 additions and 4 deletions

3
.gitignore vendored
View File

@ -16,3 +16,6 @@
# vendor/
.lumerc
.vscode/configurationCache.log
.vscode/dryrun.log
.vscode/targets.log

View File

@ -1,7 +1,25 @@
V ?= 0
Q = $(if $(filter 1, $V),, @)
ifeq ($(OS), Windows_NT)
EXE=lume.exe
RM=del /f /q
BUILD_DATE=$(shell powershell Get-Date -Format "yyyy-MM-ddThh:mm:sszzz")
else
EXE=lume
EXE=rm -f
BUILD_DATE=$(shell date --iso-8601=seconds)
endif
LUME_VERSION ?= $(shell git describe --tags --always)
LDFLAGS := ${LDFLAGS} \
-X git.kill0.net/chill9/lume/cmd.Version=${LUME_VERSION} \
-X git.kill0.net/chill9/lume/cmd.BuildDate=${BUILD_DATE}
.PHONY: build
build:
go build -o lume ./cmd/lume
$(Q) go build -o ${EXE} -ldflags="${LDFLAGS}" ./cmd/lume
.PHONY: clean
clean:
rm -f ./lifx
${RM} ${EXE}

View File

@ -29,7 +29,8 @@ func init() {
RegisterCommand(NewCmdVersion())
}
const Version = "0.1.0-pre"
var Version string = "0.1.0-pre"
var BuildDate string
const lumercFile string = ".lumerc"

View File

@ -2,6 +2,7 @@ package lumecmd
import (
"fmt"
"runtime"
)
func NewCmdVersion() Command {
@ -15,6 +16,11 @@ func NewCmdVersion() Command {
}
func VersionCmd(args CmdArgs) (int, error) {
fmt.Println(Version)
fmt.Printf("lume %s\n", Version)
fmt.Printf(" os/arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
fmt.Printf(" go version: %s\n", runtime.Version())
if BuildDate != "" {
fmt.Printf(" build date: %s\n", BuildDate)
}
return ExitSuccess, nil
}