mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
Merge pull request #71 from mcarmonaa/fix/cli-version
added version to cli
This commit is contained in:
commit
c41038d444
8
Makefile
8
Makefile
@ -4,6 +4,11 @@ COVERAGE_MODE := atomic
|
||||
|
||||
LINGUIST_PATH = .linguist
|
||||
|
||||
# build CLI
|
||||
VERSION := $(shell git describe --tags --abbrev=0)
|
||||
COMMIT := $(shell git rev-parse --short HEAD)
|
||||
LDFLAGS = -s -X main.Version=$(VERSION) -X main.GitHash=$(COMMIT)
|
||||
|
||||
$(LINGUIST_PATH):
|
||||
git clone https://github.com/github/linguist.git $@
|
||||
|
||||
@ -29,3 +34,6 @@ code-generate: $(LINGUIST_PATH)
|
||||
|
||||
clean:
|
||||
rm -rf $(LINGUIST_PATH)
|
||||
|
||||
build-cli:
|
||||
go build -o enry -ldflags "$(LDFLAGS)" cli/enry/main.go
|
||||
|
@ -12,6 +12,11 @@ The recommended way to install simple-linguist
|
||||
go get gopkg.in/src-d/enry.v1/...
|
||||
```
|
||||
|
||||
To build enry's CLI you must run
|
||||
|
||||
make build-cli
|
||||
|
||||
it generates a binary in the project's root directory called `enry`. You can move this binary to anywhere in your `PATH`.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
@ -13,6 +13,11 @@ import (
|
||||
"gopkg.in/src-d/enry.v1"
|
||||
)
|
||||
|
||||
var (
|
||||
Version = "undefined"
|
||||
GitHash = "undefined"
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Usage = usage
|
||||
breakdownFlag := flag.Bool("breakdown", false, "")
|
||||
@ -105,8 +110,14 @@ func main() {
|
||||
|
||||
func usage() {
|
||||
fmt.Fprintf(
|
||||
os.Stderr, "enry, A simple (and faster) implementation of github/linguist \nusage: %s <path>\n %s [-json] [-breakdown] <path>\n %s [-json] [-breakdown]\n",
|
||||
os.Args[0], os.Args[0], os.Args[0],
|
||||
os.Stderr,
|
||||
` %[1]s %[2]s commit: %[3]s
|
||||
enry, A simple (and faster) implementation of github/linguist
|
||||
usage: %[1]s <path>
|
||||
%[1]s [-json] [-breakdown] <path>
|
||||
%[1]s [-json] [-breakdown]
|
||||
`,
|
||||
os.Args[0], Version, GitHash,
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user