diff --git a/.gitignore b/.gitignore index 3b735ec..6f2dc77 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ # Go workspace file go.work + +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..78435c4 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,48 @@ +version: 1 + +project_name: wsget +before: + hooks: + - go mod tidy +builds: + - main: cmd/wsget/main.go + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + ldflags: + - -s -w -X main.Version={{.Version}} +archives: + - name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} +checksum: + name_template: "checksums.txt" +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc +release: + github: + owner: ksysoev + name: wsget + name_template: "{{ .Tag }}" + prerelease: auto + +brews: + - name: wsget + repository: + owner: ksysoev + name: homebrew-wsget + skip_upload: auto + folder: Formula + homepage: "https://gihub.com/ksysoev/wsget" + description: "wsget binary" + test: | + system "#{bin}/wsget" + install: | + bin.install 'wsget' \ No newline at end of file diff --git a/cmd/wsget/main.go b/cmd/wsget/main.go index 4d9d80c..86b94f7 100644 --- a/cmd/wsget/main.go +++ b/cmd/wsget/main.go @@ -16,6 +16,7 @@ var request string var outputFile string var headers []string var waitResponse int +var Version = "dev" const ( LongDescription = `A command-line tool for interacting with WebSocket servers. @@ -47,7 +48,7 @@ func main() { Example: `wsget wss://ws.postman-echo.com/raw -r "Hello, world!"`, Args: cobra.ExactArgs(1), ArgAliases: []string{"url"}, - Version: "0.2.1", + Version: Version, Run: run, } diff --git a/go.mod b/go.mod index 8105976..751562e 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,9 @@ require ( github.com/TylerBrock/colorjson v0.0.0-20200706003622-8a50f05110d2 github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203 github.com/fatih/color v1.15.0 + github.com/spf13/cobra v1.7.0 golang.org/x/net v0.17.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( @@ -14,8 +16,6 @@ require ( github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/pflag v1.0.5 // indirect golang.org/x/sys v0.13.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 13d523a..e3d941e 100644 --- a/go.sum +++ b/go.sum @@ -25,6 +25,7 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +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/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=