update toolkit

This commit is contained in:
endigma 2023-08-31 14:29:44 -03:00
parent e8da6cb013
commit 7b9de4a681
Signed by: endigma
GPG Key ID: 915867AD1D297D9F
3 changed files with 74 additions and 2852 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
review/out review/review.json

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
#!/usr/bin/env nu #!/usr/bin/env nu
export def "listMods" [] { export def "listMods" [] {
open all.json | reject body open all.json | reject body gallery
} }
export def "removeMods" [...slugs: string] { export def "removeMods" [...slugs: string] {
@ -11,6 +11,7 @@ export def "removeMods" [...slugs: string] {
save all.json -f save all.json -f
) )
updateMods updateMods
open all.json | where slug in $slugs | select slug title description kind link
} }
export def "searchMods" [term: string] { export def "searchMods" [term: string] {
@ -21,6 +22,10 @@ export def "searchMods" [term: string] {
) )
} }
export def "showMods" [...slugs: string] {
open all.json | where slug in $slugs | select slug title description kind link
}
export def "addMods" [...slugs: string] { export def "addMods" [...slugs: string] {
( (
open all.json | open all.json |
@ -29,6 +34,7 @@ export def "addMods" [...slugs: string] {
save all.json -f save all.json -f
) )
updateMods updateMods
open all.json | where slug in $slugs | select slug title description kind link
} }
export def "updateMods" [] { export def "updateMods" [] {
@ -40,13 +46,8 @@ export def "updateMods" [] {
upsert link {|row| upsert link {|row|
$"https://modrinth.com/mod/($row.slug)" $"https://modrinth.com/mod/($row.slug)"
} | } |
where review | save -f all.json
group-by kind |
items {| k, v |
$v | save $"out/($k).json" -f
}
) )
open all.json
} }
def kindOf [client_side: string, server_side: string] string { def kindOf [client_side: string, server_side: string] string {
@ -69,19 +70,16 @@ export def review [...review: string] {
( (
open all.json | open all.json |
upsert review { upsert review {
if $in.slug in $review { if ("review" in $in) {
if ("review" in $in) { ($in.review | into bool) or ($in.slug in $review)
($in.review | into bool) or true
} else {
true
}
} else { } else {
$in.review false
} }
} | } |
save all.json -f save all.json -f
) )
updateMods updateMods
open all.json | where slug in $review | select slug review
} }
export def conflicts [mod: string, ...conflicts: string] { export def conflicts [mod: string, ...conflicts: string] {
@ -107,6 +105,7 @@ export def conflicts [mod: string, ...conflicts: string] {
save all.json -f save all.json -f
) )
updateMods updateMods
open all.json | where slug in $conflicts or slug == $mod | select slug conflicts
} }
export def getMods [] { export def getMods [] {
@ -120,6 +119,8 @@ export def getMods [] {
insert kind { insert kind {
kindOf client_side, server_side kindOf client_side, server_side
} | } |
insert conflicts [] |
insert review false |
insert link {|row| insert link {|row|
$"https://modrinth.com/mod/($row.slug)" $"https://modrinth.com/mod/($row.slug)"
} }
@ -136,6 +137,8 @@ export def getMod [] {
insert kind { insert kind {
kindOf client_side, server_side kindOf client_side, server_side
} | } |
insert conflicts [] |
insert review false |
insert link {|row| insert link {|row|
$"https://modrinth.com/mod/($row.slug)" $"https://modrinth.com/mod/($row.slug)"
} }