Skip to content

Commit

Permalink
Merge pull request #65 from haya14busa/bump-0.9.4
Browse files Browse the repository at this point in the history
Bump up version to 0.9.4
  • Loading branch information
haya14busa committed Dec 16, 2016
2 parents b5687c5 + 01ccab1 commit 08050fc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/reviewdog/main.go
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/mattn/go-shellwords"
)

const version = "0.9.4"

const usageMessage = "" +
`Usage: reviewdog [flags]
reviewdog accepts any compiler or linter results from stdin and filters
Expand All @@ -36,6 +38,7 @@ const usageMessage = "" +
`

type option struct {
version bool
diffCmd string
diffStrip int
efms strslice
Expand Down Expand Up @@ -78,6 +81,7 @@ const (
var opt = &option{}

func init() {
flag.BoolVar(&opt.version, "version", false, "print version")
flag.StringVar(&opt.diffCmd, "diff", "", diffCmdDoc)
flag.IntVar(&opt.diffStrip, "strip", 1, diffStripDoc)
flag.Var(&opt.efms, "efm", efmsDoc)
Expand Down Expand Up @@ -107,6 +111,11 @@ func main() {
func run(r io.Reader, w io.Writer, opt *option) error {
ctx := context.Background()

if opt.version {
fmt.Fprintln(w, version)
return nil
}

if opt.list {
return runList(w)
}
Expand Down
10 changes: 10 additions & 0 deletions cmd/reviewdog/main_test.go
Expand Up @@ -461,3 +461,13 @@ func TestCommonci(t *testing.T) {
}

}

func TestRun_version(t *testing.T) {
stdout := new(bytes.Buffer)
if err := run(nil, stdout, &option{version: true}); err != nil {
t.Error(err)
}
if got := strings.TrimRight(stdout.String(), "\n"); got != version {
t.Errorf("version = %v, want %v", got, version)
}
}

0 comments on commit 08050fc

Please sign in to comment.