Skip to content

Commit

Permalink
Add 'uv'
Browse files Browse the repository at this point in the history
Added without tests as an experiment to confirm how useful (or not) they
are.
  • Loading branch information
myhro committed Oct 8, 2024
1 parent eb51045 commit 50e2b41
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions tools/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
22 changes: 22 additions & 0 deletions tools/tables.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//nolint:dupl
package tools

var Arch = map[string]map[string]map[string]string{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
}
3 changes: 3 additions & 0 deletions tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
Ripgrep = "rg"
Shellcheck = "shellcheck"
UPX = "upx"
Uv = "uv"
Xh = "xh"
Yj = "yj"
)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 50e2b41

Please sign in to comment.