Skip to content

Commit 3453487

Browse files
committed
autoupdate: add 'regex' alias for 'find'
1 parent 76fdb6b commit 3453487

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/autoupdate.ps1

+8-1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u
168168
$jsonpath = $config.jsonpath
169169
$hashmode = 'json'
170170
}
171+
$regex = ''
172+
if ($config.find) {
173+
$regex = $config.find
174+
}
175+
if ($config.regex) {
176+
$regex = $config.regex
177+
}
171178

172179
if (!$hashfile_url -and $url -match "(?:downloads\.)?sourceforge.net\/projects?\/(?<project>[^\/]+)\/(?:files\/)?(?<file>.*)") {
173180
$hashmode = 'sourceforge'
@@ -178,7 +185,7 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u
178185

179186
switch ($hashmode) {
180187
'extract' {
181-
$hash = find_hash_in_textfile $hashfile_url $basename $config.find
188+
$hash = find_hash_in_textfile $hashfile_url $basename $regex
182189
}
183190
'json' {
184191
$hash = find_hash_in_json $hashfile_url $basename $jsonpath

schema.json

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
"additionalProperties": false,
2727
"properties": {
2828
"find": {
29+
"format": "regex",
30+
"type": "string",
31+
"description": "Same as 'regex'"
32+
},
33+
"regex": {
2934
"format": "regex",
3035
"type": "string"
3136
},

0 commit comments

Comments
 (0)