pull/179/head
Simon Let 4 years ago
parent 5ddb27b2e8
commit e06fe26375
No known key found for this signature in database
GPG Key ID: D650C65DD46D431D
  1. 4
      Makefile
  2. 18
      cmd/control/cmd/version.go

@ -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\

@ -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)
}

Loading…
Cancel
Save