Merge branch 'master' of github.com:gmgauthier/gostations
This commit is contained in:
commit
419372c49d
16
build.sh
Executable file
16
build.sh
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
GOPATH=$GOPATH:$(pwd)
|
||||||
|
export GOPATH
|
||||||
|
|
||||||
|
GIT_COMMIT=$(git rev-list -1 HEAD)
|
||||||
|
export GIT_COMMIT
|
||||||
|
CANONICAL_VERSION=$(cat ./VERSION)
|
||||||
|
export CANONICAL_VERSION
|
||||||
|
VERSION_STRING="$CANONICAL_VERSION-$GIT_COMMIT"
|
||||||
|
export VERSION_STRING
|
||||||
|
|
||||||
|
go mod vendor
|
||||||
|
go mod tidy
|
||||||
|
|
||||||
|
go build -o build/gostations -ldflags "-X main.version=$VERSION_STRING"
|
3
go.sum
3
go.sum
@ -8,7 +8,9 @@ github.com/dixonwille/wlog/v3 v3.0.1 h1:ViTSsNNndHlKW5S89x5O0KSTpTT9zdPqrkA/TZYY
|
|||||||
github.com/dixonwille/wlog/v3 v3.0.1/go.mod h1:fPYZR9Ne5gFh3N8b3CuXVWHWxkY6Yg1wCeS3Km6Nc0I=
|
github.com/dixonwille/wlog/v3 v3.0.1/go.mod h1:fPYZR9Ne5gFh3N8b3CuXVWHWxkY6Yg1wCeS3Km6Nc0I=
|
||||||
github.com/dixonwille/wmenu/v5 v5.1.0 h1:sKBHDoQ945NRvK0Eitd0kHDYHl1IYOSr1sdCK9c+Qr0=
|
github.com/dixonwille/wmenu/v5 v5.1.0 h1:sKBHDoQ945NRvK0Eitd0kHDYHl1IYOSr1sdCK9c+Qr0=
|
||||||
github.com/dixonwille/wmenu/v5 v5.1.0/go.mod h1:l6EGfXHaN6DPgv5+V5RY+cydAXJsj/oDZVczcdukPzc=
|
github.com/dixonwille/wmenu/v5 v5.1.0/go.mod h1:l6EGfXHaN6DPgv5+V5RY+cydAXJsj/oDZVczcdukPzc=
|
||||||
|
github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450 h1:7xqw01UYS+KCI25bMrPxwNYkSns2Db1ziQPpVq99FpE=
|
||||||
github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAONeMXrxql8uvOKuAZSu8aM5RUGv+1C6IJaEho=
|
github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAONeMXrxql8uvOKuAZSu8aM5RUGv+1C6IJaEho=
|
||||||
|
github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995 h1:f5gsjBiF9tRRVomCvrkGMMWI8W1f2OBFar2c5oakAP0=
|
||||||
github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkYFkPcDKwRXegd+iM6E7matEszMG5HhwytU8=
|
github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkYFkPcDKwRXegd+iM6E7matEszMG5HhwytU8=
|
||||||
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e h1:KhcknUwkWHKZPbFy2P7jH5LKJ3La+0ZeknkkmrSgqb0=
|
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e h1:KhcknUwkWHKZPbFy2P7jH5LKJ3La+0ZeknkkmrSgqb0=
|
||||||
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk=
|
github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk=
|
||||||
@ -21,6 +23,7 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy
|
|||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
16
stations.go
16
stations.go
@ -6,6 +6,12 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var version string
|
||||||
|
|
||||||
|
func showVersion(){
|
||||||
|
fmt.Println(version)
|
||||||
|
}
|
||||||
|
|
||||||
func precheck(){
|
func precheck(){
|
||||||
if !isInstalled(player()){
|
if !isInstalled(player()){
|
||||||
fmt.Printf("%s is either not installed, or not on your $PATH. Cannot continue.\n", player())
|
fmt.Printf("%s is either not installed, or not on your $PATH. Cannot continue.\n", player())
|
||||||
@ -22,11 +28,12 @@ func main(){
|
|||||||
state string
|
state string
|
||||||
tags string
|
tags string
|
||||||
notok bool
|
notok bool
|
||||||
|
version bool
|
||||||
)
|
)
|
||||||
flag.Usage = func() {
|
flag.Usage = func() {
|
||||||
fmt.Printf("Usage: \n")
|
fmt.Printf("Usage: \n")
|
||||||
fmt.Printf(" gostations ")
|
fmt.Printf(" gostations ")
|
||||||
fmt.Printf(" [-n \"name\"] [-c \"home country\"] [-s \"home state\"] [-t \"ordered,tag,list\"] [-x]\n")
|
fmt.Printf(" [-n \"name\"] [-c \"home country\"] [-s \"home state\"] [-t \"ordered,tag,list\"] [-x] [-v]\n")
|
||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
fmt.Printf(" -h (or none)\n")
|
fmt.Printf(" -h (or none)\n")
|
||||||
fmt.Printf("\tThis help message\n")
|
fmt.Printf("\tThis help message\n")
|
||||||
@ -36,12 +43,19 @@ func main(){
|
|||||||
flag.StringVar(&state, "s", "", "Home state (if in the United States).")
|
flag.StringVar(&state, "s", "", "Home state (if in the United States).")
|
||||||
flag.StringVar(&tags, "t", "", "Tag (or comma-separated tag list)")
|
flag.StringVar(&tags, "t", "", "Tag (or comma-separated tag list)")
|
||||||
flag.BoolVar(¬ok, "x", false,"If toggled, will show stations that are down")
|
flag.BoolVar(¬ok, "x", false,"If toggled, will show stations that are down")
|
||||||
|
flag.BoolVar(&version, "v", false, "Show version.")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if argCount == 0 {
|
if argCount == 0 {
|
||||||
flag.Usage()
|
flag.Usage()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if version {
|
||||||
|
showVersion()
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
precheck()
|
precheck()
|
||||||
|
|
||||||
stations, _ := StationSearch(name, country, state, tags, notok)
|
stations, _ := StationSearch(name, country, state, tags, notok)
|
||||||
|
Loading…
Reference in New Issue
Block a user