lilydjwg / nvchecker

New version checker for software releases
MIT License
425 stars 68 forks source link

An option for to_pattern to support "to lowercase"? #274

Open fabiscafe opened 2 months ago

fabiscafe commented 2 months ago

I'm currently trying to compare the git of orca, that comes with tag names like ORCA_47_ALPHA, with the Arch package, where this would be "47alpha".

In general this is my nvchecker.toml

[orca]
source = "git"
git = "https://gitlab.gnome.org/GNOME/orca.git"
from_pattern = 'ORCA_(\d+)_([A-Z]+)'
to_pattern = '\1\2'

and it works to have "47ALPHA". That is however not the same as 47alpha and I couldn't find a way to change that to lower case. It looks like pythons re doesn't have an own feature for this, because in python there is str.lower().

So this is probably a cry for help, or a feature request :laughing:

lilydjwg commented 2 months ago

I suggest to change form outside nvchecker. If a method call should be supported, there soon would be requests to support other, more complex cases, e.g. make a substring to lowercase, or to turn Jul 08, 2024 into 2024-07-08. Maybe the solution would be to allow writing Python code in the config, but wouldn't it gone too far?