tool-sync icon indicating copy to clipboard operation
tool-sync copied to clipboard

Add the 'version' field in TOML

Open chshersh opened this issue 3 years ago • 3 comments

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:

  • https://github.com/chshersh/tool-sync/issues/65

chshersh avatar Sep 07 '22 11:09 chshersh

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.

MitchellBerend avatar Sep 23 '22 13:09 MitchellBerend

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).

chshersh avatar Sep 23 '22 21:09 chshersh

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

MitchellBerend avatar Sep 24 '22 08:09 MitchellBerend