From 1260dcc5ee18b8d7279a939d2112a31977c294b1 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sat, 27 Aug 2016 20:03:43 -0400 Subject: [PATCH] Add some more information to -version flag --- Makefile | 5 +++-- README.md | 11 +++++++---- cmd/micro/micro.go | 8 ++++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 5fee6c3c..7a80b75b 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ .PHONY: runtime -VERSION = "$(shell git rev-parse --short HEAD)" +VERSION = $(shell git describe --tags --abbrev=0) +HASH = $(shell git rev-parse --short HEAD) build: tcell - go build -ldflags "-X main.Version=$(VERSION)" -o micro ./cmd/micro + go build -ldflags "-X main.Version=$(VERSION) -X main.CommitHash=$(HASH) -X 'main.CompileDate=$(shell date -u '+%B %d, %Y')'" -o micro ./cmd/micro install: build mv micro $(GOPATH)/bin diff --git a/README.md b/README.md index 430a8c13..66139bc2 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ Here is a picture of micro editing its source code. * Extremely good mouse support * This means mouse dragging to create a selection, double click to select by word, and triple click to select by line * Cross platform (It should work on all the platforms Go runs on) + * Note that while Windows is supported, there are still some bugs that need to be worked out * Plugin system (plugins are written in Lua) * Automatic linting and error notifications * Syntax highlighting (for over [75 languages](runtime/syntax)!) @@ -51,15 +52,17 @@ Plan9, NaCl, and Cygwin (although this may change in the future). All you need to install micro is one file, the binary itself. It's as simple as that! -You can download the correct binary for your operating system from the list in the [nightly build release](https://github.com/zyedidia/micro/releases/tag/nightly). +You can download the correct binary for your operating system from the list in the [nightly build release](https://github.com/zyedidia/micro/releases). -Micro has no released version, instead these binaries are compiled every night and you can find the -commit they were compiled with by running `micro -version`. +On that page you'll see the nightly release, which contains binaries for micro which are built every night, +and you'll see all the stable releases with the corresponding binaries. -If your operating system does not have binary, but does run Go, you can build from source. +If you'd like to see more information after installing micro, run `micro -version`. ### Building from source +If your operating system does not have binary, but does run Go, you can build from source. + Make sure that you have Go version 1.5 or greater (Go 1.4 will work for the systems like support CGO then). ```sh diff --git a/cmd/micro/micro.go b/cmd/micro/micro.go index 1d6202ca..ca6ab8c7 100644 --- a/cmd/micro/micro.go +++ b/cmd/micro/micro.go @@ -43,7 +43,9 @@ var ( // Version is the version number or commit hash // This should be set by the linker when compiling - Version = "Unknown" + Version = "Unknown" + CommitHash = "Unknown" + CompileDate = "Unknown" // L is the lua state // This is the VM that runs the plugins @@ -194,7 +196,9 @@ func main() { flag.Parse() if *flagVersion { // If -version was passed - fmt.Println("Micro version:", Version) + fmt.Println("Version:", Version) + fmt.Println("Commit hash:", CommitHash) + fmt.Println("Compiled on", CompileDate) os.Exit(0) }