Skip to content

Instantly share code, notes, and snippets.

@theoparis
Created June 23, 2022 23:10
Show Gist options
  • Save theoparis/3007855e74b11fa8172d0ba876f26e5d to your computer and use it in GitHub Desktop.
Save theoparis/3007855e74b11fa8172d0ba876f26e5d to your computer and use it in GitHub Desktop.
Get minecraft jar via nushell

Usage

let version = (fetch_version --version-id 1.19 --version-type release)

fetch_jar $version --download-type client
#!/bin/nu
def fetch_version [
--version-id: string
--version-type: string
] {
mkdir work
let version_manifest = (fetch https://launchermeta.mojang.com/mc/game/version_manifest.json)
let version = ($version_manifest.versions | where id == $version-id | where type == $version-type | first 1)
fetch $version.url
}
def fetch_jar [
--download-type: string
version_data
] {
let jar_url = ($version_data.downloads | get $download-type | get url)
fetch $jar_url | save ($download-type + ".jar")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment