Skip to content

Commit

Permalink
version sub command
Browse files Browse the repository at this point in the history
  • Loading branch information
Songmu committed Jul 3, 2016
1 parent de3d9ea commit 31970fd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## [v0.0.1](https://github.com/Songmu/ghg/releases/tag/v0.0.1) (2016-07-03)

- initial implement
7 changes: 2 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ deps:
go get github.com/golang/lint/golint
go get github.com/mattn/goveralls

LINT_RET = .golint.txt
lint: deps
go vet ./...
rm -f $(LINT_RET)
golint ./... | tee $(LINT_RET)
test ! -s $(LINT_RET)
go vet
golint -set_exit_status

cover: deps
goveralls
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
ghg
=======

**STILL UNDER DEVELOPMENT**

[![Build Status](https://travis-ci.org/Songmu/ghg.png?branch=master)][travis]
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license]
[![GoDoc](https://godoc.org/github.com/Songmu/ghg?status.svg)](godoc)
[![GoDoc](https://godoc.org/github.com/Songmu/ghg?status.svg)][godoc]

[travis]: https://travis-ci.org/Songmu/ghg
[coveralls]: https://coveralls.io/r/Songmu/ghg?branch=master
Expand All @@ -22,7 +20,19 @@ Get the executable from github releases

## Synopsis

% ghg get Songmu/ghg
% ghg get tcnksm/ghr
% $(ghg bin)/ghr # you can run the executable
% ghg get -u Songmu/retry # upgrade and overwrite
% ghg get motemen/ghq@v0.7.1 # specify the release version

## Commands

```
Available commands:
bin display bin dir
get get stuffs
version display version
```

## Author

Expand Down
8 changes: 8 additions & 0 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const version = "0.0.0"
type ghOpts struct {
Get getCommand `description:"get stuffs" command:"get" subcommands-optional:"true"`
Bin binCommand `description:"display bin dir" command:"bin" subcommands-optional:"true"`
Ver verCommand `description:"display version" command:"version" subcommands-optional:"true"`
}

type getCommand struct {
Expand Down Expand Up @@ -83,6 +84,13 @@ func (b *binCommand) Execute(args []string) error {
return nil
}

type verCommand struct{}

func (b *verCommand) Execute(args []string) error {
fmt.Printf("ghg version: %s", version)
return nil
}

// CLI is struct for command line tool
type CLI struct {
OutStream, ErrStream io.Writer
Expand Down

0 comments on commit 31970fd

Please sign in to comment.