From 4666ef8c89adce15f3650a902e25effd05512025 Mon Sep 17 00:00:00 2001 From: Simon Let Date: Sat, 23 Apr 2022 23:30:07 +0200 Subject: [PATCH] copy --- Makefile | 4 ++-- cmd/control/cmd/version.go | 18 ++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 251527b..f90918c 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ SHELL=/bin/bash LATEST_TAG=$(shell git describe --tags) -REVISION=$(shell [ -z "$(git status --untracked-files=no --porcelain)" ] && git rev-parse --short=12 HEAD || echo "no_revision") +COMMIT=$(shell [ -z "$(git status --untracked-files=no --porcelain)" ] && git rev-parse --short=12 HEAD || echo "no_commit") VERSION="${LATEST_TAG}-DEV" -GOFLAGS=-ldflags "-X main.version=${VERSION} -X main.commit=${REVISION}" +GOFLAGS=-ldflags "-X main.version=${VERSION} -X main.commit=${COMMIT}" build: submodules bin/resh-session-init bin/resh-collect bin/resh-postcollect bin/resh-daemon\ diff --git a/cmd/control/cmd/version.go b/cmd/control/cmd/version.go index c9d1edf..57c776f 100644 --- a/cmd/control/cmd/version.go +++ b/cmd/control/cmd/version.go @@ -29,20 +29,22 @@ var versionCmd = &cobra.Command{ fmt.Fprintf(os.Stderr, "\nERROR: Resh-daemon didn't respond - it's probably not running.\n\n") fmt.Fprintf(os.Stderr, "-> Try restarting this terminal window to bring resh-daemon back up.\n") fmt.Fprintf(os.Stderr, "-> If the problem persists you can check resh-daemon logs: ~/.resh/daemon.log\n") + fmt.Fprintf(os.Stderr, "-> You can file an issue at: https://github.com/curusarn/resh/issues\n") exitCode = status.Fail return } - printVersion("Daemon", resp.Version, resp.Commit) + printVersion("Currently running daemon", resp.Version, resp.Commit) - if version != versionEnv { - fmt.Fprintf(os.Stderr, "\nWARN: This terminal session was started with different resh version than is installed now - it looks like you updated resh and didn't restart this terminal.\n\n") - fmt.Fprintf(os.Stderr, "-> Restart this terminal window to fix that.\n") - return - } if version != resp.Version { fmt.Fprintf(os.Stderr, "\nWARN: Resh-daemon is running in different version than is installed now - it looks like something went wrong during resh update.\n\n") fmt.Fprintf(os.Stderr, "-> Kill resh-daemon and then launch a new terminal window to fix that.\n") fmt.Fprintf(os.Stderr, " $ pkill resh-daemon\n") + fmt.Fprintf(os.Stderr, "-> You can file an issue at: https://github.com/curusarn/resh/issues\n") + return + } + if version != versionEnv { + fmt.Fprintf(os.Stderr, "\nWARN: This terminal session was started with different resh version than is installed now - it looks like you updated resh and didn't restart this terminal.\n\n") + fmt.Fprintf(os.Stderr, "-> Restart this terminal window to fix that.\n") return } @@ -50,10 +52,6 @@ var versionCmd = &cobra.Command{ }, } -func printErrExtras() { - -} - func printVersion(title, version, commit string) { fmt.Printf("%s: %s (commit: %s)\n", title, version, commit) }