diff --git a/Makefile b/Makefile index 065ae1d..6e26b4b 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ all: $(BINARY) go build ./... $(BINARY): **/*.go *.go - go build . + go build -ldflags "-X main.buildCommit `git rev-parse --short HEAD`" . deps: go get . diff --git a/client.go b/client.go index 2c1e0d8..189afcf 100644 --- a/client.go +++ b/client.go @@ -431,6 +431,8 @@ func (c *Client) handleShell(channel ssh.Channel) { } }() } + case "/version": + c.SysMsg("Version " + buildCommit) default: c.SysMsg("Invalid command: %s", line) diff --git a/cmd.go b/cmd.go index 9a36566..34840ad 100644 --- a/cmd.go +++ b/cmd.go @@ -33,6 +33,7 @@ var logLevels = []log.Level{ log.Debug, } +var buildCommit string func main() { options := Options{} parser := flags.NewParser(&options, flags.Default)