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_INSTALL = $(shell whereis $(BIN_NAME) | cut -d ' ' -f2 | xargs rm -f)
run: lint
@go run main.go
build: lint
@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:
@$(shell whereis $(BIN_NAME) | cut -d ' ' -f2 | xargs rm -f)
@go install
install: build
@mv $(BIN_NAME) $(GOPATH)/bin/hmdeploy
@echo "program installed: $(GOPATH)/bin/hmdeploy"
lint:

View File

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

View File

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