From 3453487ed65378cc9ba2efc658ed6bc1431ef463 Mon Sep 17 00:00:00 2001 From: Richard Kuhnt Date: Tue, 18 Sep 2018 19:30:18 +0200 Subject: [PATCH] autoupdate: add 'regex' alias for 'find' --- lib/autoupdate.ps1 | 9 ++++++++- schema.json | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/autoupdate.ps1 b/lib/autoupdate.ps1 index 273db0ffa3..3e9365994e 100644 --- a/lib/autoupdate.ps1 +++ b/lib/autoupdate.ps1 @@ -168,6 +168,13 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u $jsonpath = $config.jsonpath $hashmode = 'json' } + $regex = '' + if ($config.find) { + $regex = $config.find + } + if ($config.regex) { + $regex = $config.regex + } if (!$hashfile_url -and $url -match "(?:downloads\.)?sourceforge.net\/projects?\/(?[^\/]+)\/(?:files\/)?(?.*)") { $hashmode = 'sourceforge' @@ -178,7 +185,7 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u switch ($hashmode) { 'extract' { - $hash = find_hash_in_textfile $hashfile_url $basename $config.find + $hash = find_hash_in_textfile $hashfile_url $basename $regex } 'json' { $hash = find_hash_in_json $hashfile_url $basename $jsonpath diff --git a/schema.json b/schema.json index 6aeb5dd4ad..de774541d7 100644 --- a/schema.json +++ b/schema.json @@ -26,6 +26,11 @@ "additionalProperties": false, "properties": { "find": { + "format": "regex", + "type": "string", + "description": "Same as 'regex'" + }, + "regex": { "format": "regex", "type": "string" },