Compare commits
7 Commits
0fac4a3c14
...
f90e938421
Author | SHA1 | Date | |
---|---|---|---|
f90e938421 | |||
09fb7caebd | |||
de0bc2e133 | |||
4d3074fa14 | |||
c8d0d306e4 | |||
8a7e99234f | |||
bfb949ca5f |
3
.gitignore
vendored
3
.gitignore
vendored
@ -16,3 +16,6 @@
|
|||||||
# vendor/
|
# vendor/
|
||||||
|
|
||||||
.lumerc
|
.lumerc
|
||||||
|
.vscode/configurationCache.log
|
||||||
|
.vscode/dryrun.log
|
||||||
|
.vscode/targets.log
|
||||||
|
22
Makefile
22
Makefile
@ -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
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
go build -o lume ./cmd/lume
|
$(Q) go build -o ${EXE} -ldflags="${LDFLAGS}" ./cmd/lume
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f ./lifx
|
${RM} ${EXE}
|
@ -29,7 +29,8 @@ func init() {
|
|||||||
RegisterCommand(NewCmdVersion())
|
RegisterCommand(NewCmdVersion())
|
||||||
}
|
}
|
||||||
|
|
||||||
const Version = "0.1.0-pre"
|
var Version string = "0.1.0-pre"
|
||||||
|
var BuildDate string
|
||||||
|
|
||||||
const lumercFile string = ".lumerc"
|
const lumercFile string = ".lumerc"
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package lumecmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewCmdVersion() Command {
|
func NewCmdVersion() Command {
|
||||||
@ -15,6 +16,11 @@ func NewCmdVersion() Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func VersionCmd(args CmdArgs) (int, error) {
|
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
|
return ExitSuccess, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user