File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,9 +8,10 @@ MAIN_GO=$(CMD_DIR)/main.go
88
99# Version
1010VERSION? =$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
11+ GIT_COMMIT =$(shell git rev-parse --short=8 HEAD 2>/dev/null || echo "unknown")
1112BUILD_TIME =$(shell date +% FT% T% z)
1213GO_VERSION =$(shell $(GO ) version | awk '{print $$3}')
13- LDFLAGS =-ldflags "-X main.version=$(VERSION ) -X main.buildTime=$(BUILD_TIME ) -X main.goVersion=$(GO_VERSION ) "
14+ LDFLAGS =-ldflags "-X main.version=$(VERSION ) -X main.gitCommit= $( GIT_COMMIT ) -X main. buildTime=$(BUILD_TIME ) -X main.goVersion=$(GO_VERSION ) "
1415
1516# Go variables
1617GO? =go
Original file line number Diff line number Diff line change @@ -35,15 +35,20 @@ import (
3535)
3636
3737var (
38- version = "dev"
39- buildTime string
40- goVersion string
38+ version = "dev"
39+ gitCommit string
40+ buildTime string
41+ goVersion string
4142)
4243
4344const logo = "🦞"
4445
4546func printVersion () {
46- fmt .Printf ("%s picoclaw %s\n " , logo , version )
47+ fmt .Printf ("%s picoclaw %s" , logo , version )
48+ if gitCommit != "" {
49+ fmt .Printf (" (git: %s)" , gitCommit )
50+ }
51+ fmt .Println ()
4752 if buildTime != "" {
4853 fmt .Printf (" Build: %s\n " , buildTime )
4954 }
@@ -760,7 +765,16 @@ func statusCmd() {
760765
761766 configPath := getConfigPath ()
762767
763- fmt .Printf ("%s picoclaw Status\n \n " , logo )
768+ fmt .Printf ("%s picoclaw Status\n " , logo )
769+ fmt .Printf ("Version: %s" , version )
770+ if gitCommit != "" {
771+ fmt .Printf (" (git: %s)" , gitCommit )
772+ }
773+ fmt .Println ()
774+ if buildTime != "" {
775+ fmt .Printf ("Build: %s\n " , buildTime )
776+ }
777+ fmt .Println ()
764778
765779 if _ , err := os .Stat (configPath ); err == nil {
766780 fmt .Println ("Config:" , configPath , "✓" )
You can’t perform that action at this time.
0 commit comments