Skip to content

Commit

Permalink
feat: add gptscript as cli
Browse files Browse the repository at this point in the history
feat: add gptscript as cli
Signed-off-by: Engin Diri <engin.diri@ediri.de>
  • Loading branch information
dirien authored and alexellis committed Feb 24, 2024
1 parent 35c1422 commit 61e655e
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ There are 56 apps that you can install on your cluster.
| [golangci-lint](https://github.com/golangci/golangci-lint) | Go linters aggregator. |
| [gomplate](https://github.com/hairyhenderson/gomplate) | A flexible commandline tool for template rendering. Supports lots of local and remote datasources. |
| [goreleaser](https://github.com/goreleaser/goreleaser) | Deliver Go binaries as fast and easily as possible |
| [gptscript](https://github.com/gptscript-ai/gptscript) | Natural Language Programming |
| [grafana-agent](https://github.com/grafana/agent) | Grafana Agent is a telemetry collector for sending metrics, logs, and trace data to the opinionated Grafana observability stack. |
| [grype](https://github.com/anchore/grype) | A vulnerability scanner for container images and filesystems |
| [hadolint](https://github.com/hadolint/hadolint) | A smarter Dockerfile linter that helps you build best practice Docker images |
Expand Down
50 changes: 50 additions & 0 deletions pkg/get/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6933,3 +6933,53 @@ func Test_DownloadCloudHypervisorRemote(t *testing.T) {
}
}
}

func Test_DownloadGPTScript(t *testing.T) {
tools := MakeTools()
name := "gptscript"
const version = "0.1.1"

tool := getTool(name, tools)

tests := []test{
{
os: "ming",
arch: arch64bit,
version: version,
url: `https://github.com/gptscript-ai/gptscript/releases/download/0.1.1/gptscript-0.1.1-windows-amd64.zip`,
},
{
os: "linux",
arch: arch64bit,
version: version,
url: `https://github.com/gptscript-ai/gptscript/releases/download/0.1.1/gptscript-0.1.1-linux-amd64.tar.gz`,
},
{
os: "linux",
arch: archARM64,
version: version,
url: `https://github.com/gptscript-ai/gptscript/releases/download/0.1.1/gptscript-0.1.1-linux-arm64.tar.gz`,
},
{
os: "darwin",
arch: arch64bit,
version: version,
url: `https://github.com/gptscript-ai/gptscript/releases/download/0.1.1/gptscript-0.1.1-macOS-universal.tar.gz`,
},
{
os: "darwin",
arch: archDarwinARM64,
version: version,
url: `https://github.com/gptscript-ai/gptscript/releases/download/0.1.1/gptscript-0.1.1-macOS-universal.tar.gz`,
},
}
for _, tc := range tests {
got, err := tool.GetURL(tc.os, tc.arch, tc.version, false)
if err != nil {
t.Fatal(err)
}
if got != tc.url {
t.Errorf("want: %s, got: %s", tc.url, got)
}
}
}
36 changes: 36 additions & 0 deletions pkg/get/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -3993,5 +3993,41 @@ https://github.com/{{.Owner}}/{{.Repo}}/releases/download/{{.Version}}/{{.Repo}}
ch-remote-static{{$ext}}`,
})

tools = append(tools,
Tool{
Owner: "gptscript-ai",
Repo: "gptscript",
Name: "gptscript",
Description: "Natural Language Programming",
BinaryTemplate: `
{{ $os := .OS }}
{{ $arch := .Arch }}
{{ $ext := "tar.gz" }}
{{- if eq .Arch "aarch64" -}}
{{$arch = "arm64"}}
{{- else if eq .Arch "arm64" -}}
{{ $arch = "arm64" }}
{{- else if eq .Arch "x86_64" -}}
{{ $arch = "amd64" }}
{{- end -}}
{{ if HasPrefix .OS "ming" -}}
{{$os = "windows"}}
{{$ext = "zip"}}
{{- end -}}
{{- if eq .OS "darwin" -}}
{{$os = "macOS"}}
{{ $arch = "universal" }}
{{- else if eq .OS "linux" -}}
{{ $os = "linux" }}
{{- end -}}
gptscript-{{.Version}}-{{$os}}-{{$arch}}.{{$ext}}
`,
})
return tools
}

0 comments on commit 61e655e

Please sign in to comment.