Skip to content

Commit

Permalink
Add version sub-command for goplay (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen authored Nov 28, 2021
1 parent 7002632 commit cd5120f
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: |
sudo apt-get update -y
sudo apt install libasound2-dev -y
go build -o bin/goplay .
go build -ldflags '-X github.com/linuxsuren/cobra-extension/version.version=${{ github.ref_name }} -X github.com/linuxsuren/cobra-extension/version.commit=${{ github.sha }}' -o bin/goplay .
go test ./...
build-darwin:
Expand All @@ -37,7 +37,7 @@ jobs:
uses: actions/[email protected]
- name: Build
run: |
go build -o bin/goplay .
go build -ldflags '-X github.com/linuxsuren/cobra-extension/version.version=${{ github.ref_name }} -X github.com/linuxsuren/cobra-extension/version.commit=${{ github.sha }}' -o bin/goplay .
go test ./...
build-win:
Expand All @@ -53,5 +53,5 @@ jobs:
uses: actions/[email protected]
- name: Build
run: |
go build -o bin/goplay .
go build -ldflags '-X github.com/linuxsuren/cobra-extension/version.version=${{ github.ref_name }} -X github.com/linuxsuren/cobra-extension/version.commit=${{ github.sha }}' -o bin/goplay .
go test ./...
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
run: |
sudo apt-get update -y
sudo apt install libasound2-dev -y
GOENABLE=0 go build -o bin/goplay .
GOENABLE=0 go build -ldflags '-X github.com/linuxsuren/cobra-extension/version.version=${{ github.ref_name }} -X github.com/linuxsuren/cobra-extension/version.commit=${{ github.sha }}' -o bin/goplay .
cd bin && tar czvf goplay-linux-amd64.tar.gz goplay
gh release upload ${{ github.ref_name }} goplay-linux-amd64.tar.gz
BuildOnDarwin:
Expand All @@ -40,6 +40,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
run: |
GOENABLE=0 go build -o bin/goplay .
GOENABLE=0 go build -ldflags '-X github.com/linuxsuren/cobra-extension/version.version=${{ github.ref_name }} -X github.com/linuxsuren/cobra-extension/version.commit=${{ github.sha }}' -o bin/goplay .
cd bin && tar czvf goplay-darwin-amd64.tar.gz goplay
gh release upload ${{ github.ref_name }} goplay-darwin-amd64.tar.gz
3 changes: 3 additions & 0 deletions cmd/play.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/linuxsuren/goplay/pkg/advanced_ui"
"github.com/linuxsuren/goplay/pkg/rss"
exec2 "github.com/linuxsuren/http-downloader/pkg/exec"
extver "github.com/linuxsuren/cobra-extension/version"
"github.com/spf13/cobra"
"os/exec"
"strings"
Expand All @@ -23,6 +24,8 @@ func NewPlayCommand() (cmd *cobra.Command) {
Args: cobra.MinimumNArgs(1),
RunE: opt.runE,
}

cmd.AddCommand(extver.NewVersionCmd("linuxsuren", "goplay", "goplay", nil))
return
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/faiface/beep v1.1.0
github.com/gdamore/tcell v1.3.0
github.com/ghodss/yaml v1.0.0
github.com/linuxsuren/cobra-extension v0.0.11
github.com/linuxsuren/http-downloader v0.0.50
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.9.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-github/v29 v29.0.3 h1:IktKCTwU//aFHnpA+2SLIi7Oo9uhAzgsdZNbcAqhgdc=
github.com/google/go-github/v29 v29.0.3/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
Expand Down Expand Up @@ -323,6 +325,7 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/linuxsuren/cobra-extension v0.0.6/go.mod h1:qcEJv7BbL0UpK6MbrTESP/nKf1+z1wQdMAnE1NBl3QQ=
github.com/linuxsuren/cobra-extension v0.0.10/go.mod h1:nDsXgvm0lSWVV+byAEfwhIGFDoIp0Sq9wkfNUDBp5do=
github.com/linuxsuren/cobra-extension v0.0.11 h1:Z2Sx8dBPvJK3s3loguFXJtrtiwh1Od3O2xoB6vCOl5M=
github.com/linuxsuren/cobra-extension v0.0.11/go.mod h1:gn69Dtq72JCGZbjW46c14MoE0z/BtDAQWV9Jvr9KczY=
github.com/linuxsuren/http-downloader v0.0.2-0.20201207132639-19888a6beaec/go.mod h1:zRZY9FCDBuYNDxbI2Ny5suasZsMk7J6q9ecQ3V3PIqI=
github.com/linuxsuren/http-downloader v0.0.6/go.mod h1:xxgh2OE7WGL9TwDE9L8Gh7Lqq9fFPuHbh5tofUitEfE=
Expand Down Expand Up @@ -520,6 +523,7 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down
2 changes: 1 addition & 1 deletion pkg/data/source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import (
func TestGetRSSSources(t *testing.T) {
items, err := GetRSSSources()
assert.Nil(t, err)
assert.Equal(t, 8, len(items))
assert.Equal(t, 9, len(items))
}

0 comments on commit cd5120f

Please sign in to comment.