versioning go-get-release
This commit is contained in:
parent
8823218ebf
commit
ff8cf0cdf6
|
@ -1,6 +1,7 @@
|
||||||
Like `go get`, but it downloads and installs the latest release binary from GitHub instead.
|
Like `go get`, but it downloads and installs the latest release binary from GitHub instead.
|
||||||
|
|
||||||
Please install using `go get`.
|
Please download a binary from [release page](https://github.com/rhysd/go-github-selfupdate/releases/tag/go-get-release)
|
||||||
|
and put it in `$PATH` or build from source with `go get`.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ go get -u github.com/rhysd/go-github-selfupdate/cmd/go-get-release
|
$ go get -u github.com/rhysd/go-github-selfupdate/cmd/go-get-release
|
||||||
|
@ -9,12 +10,14 @@ $ go get -u github.com/rhysd/go-github-selfupdate/cmd/go-get-release
|
||||||
Usage is quite similar to `go get`. But `{package}` must be hosted on GitHub. So it needs to start with `github.com/`.
|
Usage is quite similar to `go get`. But `{package}` must be hosted on GitHub. So it needs to start with `github.com/`.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ detect-latest-release {package}
|
$ go-get-release {package}
|
||||||
```
|
```
|
||||||
|
|
||||||
Please note that this command assumes that specified package is following Git tag naming rules and released binaries naming rules described in [README](../../README.md).
|
Please note that this command assumes that specified package is following Git tag naming rules and
|
||||||
|
released binaries naming rules described in [README](../../README.md).
|
||||||
|
|
||||||
For example, following command downloads and installs the released binary of [ghr](https://github.com/tcnksm/ghr) to `$GOPATH/bin`.
|
For example, following command downloads and installs the released binary of [ghr](https://github.com/tcnksm/ghr)
|
||||||
|
to `$GOPATH/bin`.
|
||||||
|
|
||||||
```
|
```
|
||||||
$ go-get-release github.com/tcnksm/ghr
|
$ go-get-release github.com/tcnksm/ghr
|
||||||
|
|
|
@ -12,6 +12,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var version = "1.0.0"
|
||||||
|
|
||||||
func usage() {
|
func usage() {
|
||||||
fmt.Fprintln(os.Stderr, `Usage: go-get-release [flags] {package}
|
fmt.Fprintln(os.Stderr, `Usage: go-get-release [flags] {package}
|
||||||
|
|
||||||
|
@ -76,10 +78,16 @@ func installFrom(url, cmd, path string) error {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
help := flag.Bool("help", false, "Show help")
|
help := flag.Bool("help", false, "Show help")
|
||||||
|
ver := flag.Bool("version", false, "Show version")
|
||||||
|
|
||||||
flag.Usage = usage
|
flag.Usage = usage
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if *ver {
|
||||||
|
fmt.Println(version)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
if *help || flag.NArg() != 1 || !strings.HasPrefix(flag.Arg(0), "github.com/") {
|
if *help || flag.NArg() != 1 || !strings.HasPrefix(flag.Arg(0), "github.com/") {
|
||||||
usage()
|
usage()
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|
Loading…
Reference in New Issue