Skip to content

Commit

Permalink
Present --list output as prose instead of JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Nixinova committed Aug 24, 2024
1 parent b312a81 commit 2f5e198
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next
- Changed output of `getVersions` to replace '`.x`' with the actual game version.
- Changed CLI output of `--list` to present the versions in prose instead of JSON.

## 1.3.16
- Updated resource pack format to `36`.
Expand Down
15 changes: 13 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,19 @@ else if (args.list) {
}
else {
const type = args.data ? 'data' : 'resource'
console.log(`Versions for ${type} pack format ${ver}:`)
console.log(getVersions(+ver, type))
const vers = getVersions(+ver, type)

const rels = [vers.releases.min, vers.releases.max].filter(x => x)
const snaps = [vers.snapshots.min, vers.snapshots.max].filter(x => x)
const relText = ['', rels[0], rels.join('–')][[...new Set(rels)].length]
const snapsText = ['', snaps[0], snaps.join('–')][[...new Set(snaps)].length]
const fullText = relText ? `${relText} (${snapsText})` : `${snapsText}`

if (snapsText)
console.log(`A ${type} pack format of ${ver} is used for ${fullText}`)
else
console.log(`A ${type} pack format of ${ver} is not used`)

}
}
// List the latest pack formats
Expand Down

0 comments on commit 2f5e198

Please sign in to comment.