Skip to content

Commit 3db8251

Browse files
committed
Add websocat
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent dfb752a commit 3db8251

File tree

4 files changed

+92
-3
lines changed

4 files changed

+92
-3
lines changed

AGENTS.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ Add a test function in `pkg/get/get_test.go`. **Reference `Test_DownloadFaasCli`
7070

7171
### Step 4: Download and Verify Every OS/Arch Combination
7272

73+
First test downloading the current OS/arch (no flags needed) i.e. `go run . get TOOL`. And run `file` on the output to verify the type and if it's valid or invalid i.e. a gzip, or a HTML page, or got a non zero exit code.
74+
7375
**MANDATORY**: Download and verify EVERY combination using the `file` command.
7476

7577
```bash
@@ -87,13 +89,18 @@ For each combination, verify the `file` command output:
8789
- Darwin arm64: `Mach-O 64-bit arm64 executable`
8890
- Windows amd64: `PE32+ executable (console) x86-64`
8991

90-
Tools built with rust have `unknown` in their filename, that's OK. If deciding between GNU aka libc or musl, pick the non-musl version.
92+
Tools built with Rust often have `unknown` in their filename, that's OK. If deciding between GNU aka libc or musl, pick the non-musl version, it might be named "unknown".
9193

9294
**Include the full output of `./hack/test-tool.sh TOOL_NAME` in your PR description.**
9395

9496
### Step 5: Update Documentation
9597

96-
The README.md file contains instructions for updating itself. Follow the note at the bottom of the "Catalog of CLIs" section: run `go build && ./arkade get --format markdown` to generate the updated table, then replace the existing catalog section.
98+
The README.md file contains instructions for updating itself. Follow the note at the bottom of the "Catalog of CLIs" section: run `go run . get --format markdown` to generate the updated table, then replace the existing catalog section. Write it to a file in the workspace that you delete after, to avoid needing extra permissions.
99+
100+
There are two tokens in the README.md - replace al text between them with what you've generated.
101+
102+
Start of replaceable block is inside: `<!-- start of tool list -->` and the end is inside: `<!-- end of tool list -->`.
103+
97104

98105
### Step 6: Create Pull Request
99106

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,9 +950,10 @@ There are 53 apps that you can install on your cluster.
950950
| [vhs](https://github.com/charmbracelet/vhs) | CLI for recording demos |
951951
| [viddy](https://github.com/sachaos/viddy) | A modern watch command. Time machine and pager etc. |
952952
| [waypoint](https://github.com/hashicorp/waypoint) | Easy application deployment for Kubernetes and Amazon ECS |
953+
| [websocat](https://github.com/vi/websocat) | Command-line client for WebSockets, like netcat/socat but for WebSockets |
953954
| [yq](https://github.com/mikefarah/yq) | Portable command-line YAML processor. |
954955
| [yt-dlp](https://github.com/yt-dlp/yt-dlp) | Fork of youtube-dl with additional features and fixes |
955-
There are 188 tools, use `arkade get NAME` to download one.
956+
There are 189 tools, use `arkade get NAME` to download one.
956957

957958

958959
<!-- end of tool list -->

pkg/get/get_test.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9509,6 +9509,58 @@ func Test_DownloadAge(t *testing.T) {
95099509
}
95109510
}
95119511

9512+
func Test_DownloadWebsocat(t *testing.T) {
9513+
tools := MakeTools()
9514+
name := "websocat"
9515+
9516+
tool := getTool(name, tools)
9517+
9518+
const toolVersion = "v1.14.1"
9519+
9520+
tests := []test{
9521+
{
9522+
os: "linux",
9523+
arch: arch64bit,
9524+
version: toolVersion,
9525+
url: "https://github.com/vi/websocat/releases/download/v1.14.1/websocat.x86_64-unknown-linux-musl",
9526+
},
9527+
{
9528+
os: "linux",
9529+
arch: archARM64,
9530+
version: toolVersion,
9531+
url: "https://github.com/vi/websocat/releases/download/v1.14.1/websocat.aarch64-unknown-linux-musl",
9532+
},
9533+
{
9534+
os: "darwin",
9535+
arch: arch64bit,
9536+
version: toolVersion,
9537+
url: "https://github.com/vi/websocat/releases/download/v1.14.1/websocat.x86_64-apple-darwin",
9538+
},
9539+
{
9540+
os: "darwin",
9541+
arch: archDarwinARM64,
9542+
version: toolVersion,
9543+
url: "https://github.com/vi/websocat/releases/download/v1.14.1/websocat.aarch64-apple-darwin",
9544+
},
9545+
{
9546+
os: "ming",
9547+
arch: arch64bit,
9548+
version: toolVersion,
9549+
url: "https://github.com/vi/websocat/releases/download/v1.14.1/websocat.x86_64-pc-windows-gnu.exe",
9550+
},
9551+
}
9552+
verify := false
9553+
for _, tc := range tests {
9554+
got, _, err := tool.GetURL(tc.os, tc.arch, tc.version, verify)
9555+
if err != nil {
9556+
t.Fatal(err)
9557+
}
9558+
if got != tc.url {
9559+
t.Errorf("want: %s, got: %s", tc.url, got)
9560+
}
9561+
}
9562+
}
9563+
95129564
func Test_DownloadAgeKeygen(t *testing.T) {
95139565
tools := MakeTools()
95149566
name := "age-keygen"

pkg/get/tools.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5252,5 +5252,34 @@ codex-{{$arch}}-{{$os}}`,
52525252
https://github.com/openai/codex/releases/download/{{.Version}}/codex-{{$arch}}-{{$os}}{{$ext}}`,
52535253
})
52545254

5255+
tools = append(tools,
5256+
Tool{
5257+
Owner: "vi",
5258+
Repo: "websocat",
5259+
Name: "websocat",
5260+
Description: "Command-line client for WebSockets, like netcat/socat but for WebSockets",
5261+
BinaryTemplate: `websocat`,
5262+
URLTemplate: `
5263+
{{$target := ""}}
5264+
{{- if eq .OS "linux" -}}
5265+
{{- if eq .Arch "x86_64" -}}
5266+
{{$target = "x86_64-unknown-linux-musl"}}
5267+
{{ else if eq .Arch "aarch64" -}}
5268+
{{$target = "aarch64-unknown-linux-musl"}}
5269+
{{- end -}}
5270+
{{- else if eq .OS "darwin" -}}
5271+
{{- if eq .Arch "x86_64" -}}
5272+
{{$target = "x86_64-apple-darwin"}}
5273+
{{ else if eq .Arch "arm64" -}}
5274+
{{$target = "aarch64-apple-darwin"}}
5275+
{{- end -}}
5276+
{{- else if HasPrefix .OS "ming" -}}
5277+
{{- if eq .Arch "x86_64" -}}
5278+
{{$target = "x86_64-pc-windows-gnu.exe"}}
5279+
{{- end -}}
5280+
{{- end -}}
5281+
https://github.com/vi/websocat/releases/download/{{.Version}}/websocat.{{$target}}`,
5282+
})
5283+
52555284
return tools
52565285
}

0 commit comments

Comments
 (0)