chshersh / tool-sync

🧰 Download pre-built binaries of all your favourite tools with a single command
https://crates.io/crates/tool-sync
Mozilla Public License 2.0
72 stars 17 forks source link

Add the 'version' field in TOML #68

Open chshersh opened 2 years ago

chshersh commented 2 years ago

This field is an alternative to the tag field (so it should be an error to specify both of them).

This field should support more flexible version matching of tags while the tag field supports tags exactly. With version, it should be possible to specify the following:

version = "latest"  # uses exactly the latest version
version = "13.0.0"  # matches both tags 'v13.0.0' and '13.0.0' so you don't need to know the naming scheme of a particular repository
version = "13"      # should automatically download the latest minor version matching '13.*.*'

See the following issue for more context:

MitchellBerend commented 2 years ago

I think regex is also a good option to solve this issue. I'm starting to lean towards adding the regex crate more and more since #50 and #116 probably would also benefit from this.

chshersh commented 2 years ago

Maybe we can use wildmatch as suggested before? And if this is not enough, we can use regex instead. I believe, with wildmatch is should be possible to write 13.*.* and it should match what we want. It doesn't check as substring so it'll actually check from the beginning which is what we want (if I correctly understand the docs but this can be double-checked in the code).

MitchellBerend commented 2 years ago

There is no end of pattern marker in wildmatch I think so 13.*.*-alpha (like in mirrord) would also be matched with 13.*.*