Skip to content

Commit

Permalink
improve cli list command speed
Browse files Browse the repository at this point in the history
  • Loading branch information
froehlichA committed Apr 17, 2022
1 parent 089046e commit 9910449
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/cmd/list.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ proc paxList*(status: bool, info: bool): void =
let manifest = readManifestFromDisk()

let fileCount = manifest.files.len
let mcModRequests = manifest.files.map((x) => fetchAddon(x.projectId))
let mcModFileRequests = manifest.files.map((x) => fetchAddonFile(x.projectId, x.fileId))
let mcMods = all(mcModRequests)
let mcModFiles = all(mcModFileRequests)
let mcMods: Future[seq[CfAddon]] = manifest.files.map((x) => x.projectId).fetchAddons
let mcModFiles: Future[seq[CfAddonFile]] = manifest.files.map((x) => x.fileId).fetchAddonFiles

echoInfo "Loading mods.."
waitFor(mcMods and mcModFiles)
let modDataOptions = zip(mcMods.read(), mcModFiles.read())
var modData = modDataOptions.map((x) => (x[0].get(), x[1].get()))
var modData = zip(mcMods.read(), mcModFiles.read())
modData = modData.sorted((x,y) => cmp(x[0].name, y[0].name))

echoRoot "ALL MODS ".fgMagenta, ("(" & $fileCount & ")").dim
Expand Down

0 comments on commit 9910449

Please sign in to comment.