mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-09-26 23:35:55 +00:00
autoupdate: add 'regex' alias for 'find'
This commit is contained in:
+8
-1
@@ -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?\/(?<project>[^\/]+)\/(?:files\/)?(?<file>.*)") {
|
||||
$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
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"find": {
|
||||
"format": "regex",
|
||||
"type": "string",
|
||||
"description": "Same as 'regex'"
|
||||
},
|
||||
"regex": {
|
||||
"format": "regex",
|
||||
"type": "string"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user