Skip to content

Commit

Permalink
support for multiple @match'es. Now also adds @exclude to reamde
Browse files Browse the repository at this point in the history
  • Loading branch information
on committed Feb 26, 2025
1 parent d0fa566 commit f348c71
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions generate-readme.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ foreach ($file in $userJsFiles) {
$version = "Beta"
$author = ""
$match = ""
$exclude = ""
$description = ""

do {
Expand All @@ -40,7 +41,17 @@ foreach ($file in $userJsFiles) {
} elseif ($key -eq 'author') {
$author = $value
} elseif ($key -eq 'match') {
$match = $value
if ($match -eq "") {
$match = $value
} else {
$match += "`n$value"
}
} elseif ($key -eq 'exclude') {
if ($exclude -eq "") {
$exclude = $value
} else {
$exclude += "`n$value"
}
}
}

Expand All @@ -61,7 +72,25 @@ foreach ($file in $userJsFiles) {
if ($author) {
$scriptList += "`n - **Author:** $author`n"
}
$scriptList += " - **Match:** ``$match```n"
$all_match = $match -split "`n"
if ($all_match.count -eq 1) {
$scriptList += " - **Match:** ``$match```n"
} else {
$scriptList += " - **Match:**`n"
foreach ($m in $all_match) {
$scriptList += " - ``$m```n"
}
}
$all_exclude = $exclude -split "`n"
if (($exclude -ne "") -and ($all_exclude.count -eq 1)) {
$scriptList += " - **Exclude:** ``$exclude```n"
} elseif ($all_exclude.count -gt 1) {
$scriptList += " - **Exclude:**`n"
foreach ($e in $all_exclude) {
$scriptList += " - ``$e```n"
}
}
#$scriptList += " - **Match:** ``$match```n"
$scriptList += " - **Description:** $description`n"

$baseName = $file.Name -replace '\.user\.js$', ''
Expand Down

0 comments on commit f348c71

Please sign in to comment.