From 50e2b4191e62a460e1440b1fbcd6f249e88b4171 Mon Sep 17 00:00:00 2001 From: Tiago Ilieve Date: Tue, 8 Oct 2024 20:15:32 -0300 Subject: [PATCH] Add 'uv' Added without tests as an experiment to confirm how useful (or not) they are. --- main.go | 9 +++++++++ tools/asset.go | 6 ++++++ tools/tables.go | 22 ++++++++++++++++++++++ tools/tools.go | 3 +++ 4 files changed, 40 insertions(+) diff --git a/main.go b/main.go index 13dbaa4..f4045c2 100644 --- a/main.go +++ b/main.go @@ -150,6 +150,14 @@ func main() { }, } + uvCmd := &cobra.Command{ + Use: tools.Uv, + Short: "An extremely fast Python package and project manager", + Run: func(cmd *cobra.Command, args []string) { + run(tools.Uv) + }, + } + xhCmd := &cobra.Command{ Use: tools.Xh, Short: "Friendly and fast tool for sending HTTP requests", @@ -183,6 +191,7 @@ func main() { rootCmd.AddCommand(ripgrepCmd) rootCmd.AddCommand(shellcheckCmd) rootCmd.AddCommand(upxCmd) + rootCmd.AddCommand(uvCmd) rootCmd.AddCommand(xhCmd) rootCmd.AddCommand(yjCmd) rootCmd.AddCommand(versionCmd) diff --git a/tools/asset.go b/tools/asset.go index d5333e4..cf36eca 100644 --- a/tools/asset.go +++ b/tools/asset.go @@ -57,6 +57,12 @@ func (t *Tool) AssetUPX() { t.Asset.WithinArchive = path.Join(baseName, t.Name) } +func (t *Tool) AssetUv() { + baseName := fmt.Sprintf("uv-%v-%v", t.Arch, t.OS) + t.Asset.Name = baseName + ".tar.gz" + t.Asset.WithinArchive = path.Join(baseName, t.Name) +} + func (t *Tool) AssetXh() { baseName := fmt.Sprintf("xh-%v-%v-%v", t.Version, t.Arch, t.OS) t.Asset.Name = baseName + ".tar.gz" diff --git a/tools/tables.go b/tools/tables.go index 7857352..2df53cb 100644 --- a/tools/tables.go +++ b/tools/tables.go @@ -1,3 +1,4 @@ +//nolint:dupl package tools var Arch = map[string]map[string]map[string]string{ @@ -85,6 +86,16 @@ var Arch = map[string]map[string]map[string]string{ "arm64": "arm64", }, }, + Uv: { + "darwin": { + "amd64": "x86_64", + "arm64": "aarch64", + }, + "linux": { + "amd64": "x86_64", + "arm64": "aarch64", + }, + }, Xh: { "darwin": { "amd64": "x86_64", @@ -192,6 +203,16 @@ var OS = map[string]map[string]map[string]string{ "arm64": "linux", }, }, + Uv: { + "darwin": { + "amd64": "apple-darwin", + "arm64": "apple-darwin", + }, + "linux": { + "amd64": "unknown-linux-gnu", + "arm64": "unknown-linux-gnu", + }, + }, Xh: { "darwin": { "amd64": "apple-darwin", @@ -224,6 +245,7 @@ var URL = map[string]string{ Ripgrep: "https://github.com/BurntSushi/ripgrep", Shellcheck: "https://github.com/koalaman/shellcheck", UPX: "https://github.com/upx/upx", + Uv: "https://github.com/astral-sh/uv", Xh: "https://github.com/ducaale/xh", Yj: "https://github.com/sclevine/yj", } diff --git a/tools/tools.go b/tools/tools.go index 90c18d3..1cb251b 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -21,6 +21,7 @@ const ( Ripgrep = "rg" Shellcheck = "shellcheck" UPX = "upx" + Uv = "uv" Xh = "xh" Yj = "yj" ) @@ -173,6 +174,8 @@ func (t *Tool) SetAsset() error { t.AssetShellcheck() case UPX: t.AssetUPX() + case Uv: + t.AssetUv() case Xh: t.AssetXh() case Yj: