fix README + add version

This commit is contained in:
rmanach 2025-04-29 16:20:50 +02:00
parent bfaf6f10c6
commit 57834a1b3c
3 changed files with 16 additions and 4 deletions

View File

@ -1,15 +1,15 @@
BIN_NAME = "hmdeploy" BIN_NAME = "hmdeploy"
BIN_INSTALL = $(shell whereis $(BIN_NAME) | cut -d ' ' -f2 | xargs rm -f)
run: lint run: lint
@go run main.go @go run main.go
build: lint build: lint
@echo "building binary..." @echo "building binary..."
@go build -o $(BIN_NAME) main.go && echo "$(BIN_NAME) built" @go build -ldflags "-X main.Version=0.1.0" -o $(BIN_NAME) main.go && echo "$(BIN_NAME) built"
install: install: build
@$(shell whereis $(BIN_NAME) | cut -d ' ' -f2 | xargs rm -f) @mv $(BIN_NAME) $(GOPATH)/bin/hmdeploy
@go install
@echo "program installed: $(GOPATH)/bin/hmdeploy" @echo "program installed: $(GOPATH)/bin/hmdeploy"
lint: lint:

View File

@ -124,10 +124,14 @@ Usage of hmdeploy:
show debug logs show debug logs
-destroy -destroy
delete the deployed project delete the deployed project
-details
extract swarm details and return
-no-nginx -no-nginx
no Nginx deployment no Nginx deployment
-path string -path string
define the .homeserver project root dir (default ".") define the .homeserver project root dir (default ".")
-version
extract swarm details and return
# if your are in the project dir with a `.homeserver` # if your are in the project dir with a `.homeserver`
# you can then launch the program directly # you can then launch the program directly

View File

@ -32,6 +32,8 @@ const (
MaxDeployers int = 2 MaxDeployers int = 2
) )
var Version string
var HOME_PATH = os.Getenv("HOME") var HOME_PATH = os.Getenv("HOME")
var ( var (
@ -343,6 +345,7 @@ func main() { //nolint: funlen //TODO: to reduce
noNginx := flag.Bool("no-nginx", false, "no Nginx deployment") noNginx := flag.Bool("no-nginx", false, "no Nginx deployment")
debug := flag.Bool("debug", false, "show debug logs") debug := flag.Bool("debug", false, "show debug logs")
details := flag.Bool("details", false, "extract swarm details and return") details := flag.Bool("details", false, "extract swarm details and return")
version := flag.Bool("version", false, "extract swarm details and return")
confirm := flag.Bool( confirm := flag.Bool(
"confirm", "confirm",
false, false,
@ -350,6 +353,11 @@ func main() { //nolint: funlen //TODO: to reduce
) )
flag.Parse() flag.Parse()
if *version {
fmt.Println("hmdeploy version: v" + Version)
os.Exit(0)
}
initLogger(*debug) initLogger(*debug)
hmmap, err := loadHMMap() hmmap, err := loadHMMap()