lilydjwg / nvchecker

New version checker for software releases
MIT License
428 stars 69 forks source link

Print out an error when `include_regex` fails to match #269

Closed guihkx closed 6 months ago

guihkx commented 6 months ago

I'm combining the jq source with the include_regex option, but if the regex fails to match, it's not immediately obvious that version extraction fails, because nvchecker doesn't output anything.

source.toml (bad):

[__config__]
oldver = "old.json"
newver = "new.json"

[GPU-Z]
source = "jq"
filter = ".url" # this is broken on purpose, replace it with ".latest" to make it work
include_regex = "^[\\d.]+$"
url = "https://www.gpu-z.com/gpuz/version_v2"

And then testing it:

$ nvchecker -c source.toml --failures
$ echo $?
3

In the example above, nvchecker clearly fails, but no error output is given, like with regex sources, e.g.:

[GPU-Z]
source = "regex"
regex = "^[\\d.]+$"
url = "https://www.gpu-z.com/gpuz/version_v2"

...

$ nvchecker -c source.toml
[E 04-25 12:34:14.670 core:358] GPU-Z: version string not found.

I apologize if there's already a way to do this, but I couldn't find it in the documentation.

Thanks.