Closed MitchellBerend closed 1 year ago
The config I tested with and its result.
$ cat tools.toml
# This config file was generated for version 0.1.0
#
# # tool-sync default configuration file
# https://github.com/chshersh/tool-sync
# This file was automatically generated by tool-sync
#####################################################
#
#
store_directory = "$HOME/rust/tool-sync/bin"
#
# tool-sync provides native support for some of the tools without the need to configure them
# Uncomment the tools you want to have them
#
# [bat]
# [difftastic]
# [exa]
# [fd]
[ripgrep]
# [tool-sync]
#
# To add configuration for other tools these are the config options:
[github]
owner = "cli"
repo = "cli"
exe_name = "gh"
# Uncomment to download a specific version or tag.
# Without this tag latest will be used
tag = "v2.14.7"
# Asset name to download on linux OSes
asset_name.linux = "linux_amd64"
#
# uncomment if you want to install on macOS as well
# asset_name.macos = "apple-darwin"
#
# uncomment if you want to install on Windows as well
# asset_name.windows = "x86_64-pc-windows-msvc"
$ cargo run -- --config tools.toml sync
Compiling tool-sync v0.1.0 (/home/mitchell/rust/tool-sync)
Finished dev [unoptimized + debuginfo] target(s) in 2.40s
Running `target/debug/tool --config tools.toml sync`
❌ github
Multiple name matches found for this asset:
* gh_2.14.7_linux_amd64.deb
* gh_2.14.7_linux_amd64.rpm
* gh_2.14.7_linux_amd64.tar.gz
Please add one of these to the config.
🔄 All done! 📦 Estimated total download size: 2.01 MiB
✅ ripgrep 13.0.0 Completed! ✨ Successfully installed 1 tools!
📁 Installation directory: /home/mitchell/rust/tool-sync/bin
@chshersh The hardcoded gh
binary on mac now downloads the amd64 version, it does not support arm (yes) but this might be possible in the future. The same is true for x86 and arm for linux, should there be an error in the realm of:
hey your arch is x but this config/hardcoded tool currently downloads y, add
On line 90, you extract name from all original assets fetched from GitHub. I think, it would be better to show only those assets that match the provided query.
The variable naming is not optimal here.
This part has asset
contain a Vec<Asset>
with only matches.
https://github.com/chshersh/tool-sync/blob/265e1f3105291e979c4ccc6704515ea3d66151f8/src/model/tool.rs#L79-L83
This part then pulls out the names of all matches. https://github.com/chshersh/tool-sync/blob/265e1f3105291e979c4ccc6704515ea3d66151f8/src/model/tool.rs#L90-L91
This should probably be ensured in the test though so I will add an asset that does not match.
Resolves #54
This pr add an extra path that gets checked once the binary is downloaded from github. Additionally it also adds an error case where multiple matches are found.
Additional tasks