Skip to content

Commit

Permalink
Show version in help. Close #10
Browse files Browse the repository at this point in the history
  • Loading branch information
pocke committed Apr 19, 2016
1 parent 16640aa commit e94aa51
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
VERSION=$(shell git describe --tags)

build:
go build -ldflags "-X main.version=$(VERSION)"

install:
go install -ldflags "-X main.version=$(VERSION)"
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ Installation
------------

```sh
go get github.com/pocke/lemonade
go get -d github.com/pocke/lemonade
cd $GOPATH/src/github.com/pocke/lemonade/
make install
```

Or download from [latest release](https://github.com/pocke/lemonade/releases/latest)
Expand Down
13 changes: 10 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package main

import "os"
import (
"fmt"
"os"
)

const Usage = `Usage: lemonade [options]... SUB_COMMAND [arg]
var version string
var Usage = fmt.Sprintf(`Usage: lemonade [options]... SUB_COMMAND [arg]
Sub Commands:
open [URL] Open URL by browser
copy [text] Copy text.
Expand All @@ -16,7 +20,10 @@ Options:
--trans-loopback=true Translate loopback address [open subcommand only]
--trans-localfile=true Translate local file path [open subcommand only]
--help Show this message
`
Version:
%s`, version)

func main() {
cli := &CLI{
Expand Down

0 comments on commit e94aa51

Please sign in to comment.