diff options
| author | Caroline Larimore <caroline@larimo.re> | 2025-11-27 12:46:05 -0800 |
|---|---|---|
| committer | Caroline Larimore <caroline@larimo.re> | 2025-11-27 12:46:05 -0800 |
| commit | 35b577e5f31940e8e1ebe870fc8fe5ad1ae6e735 (patch) | |
| tree | 28ff82f5190127160d6237584cfaaa84553701cd /mcsh.sh | |
| parent | 5a683c455863dac52bb88af301a2f4987136c963 (diff) | |
feat: alias latest versions
Diffstat (limited to 'mcsh.sh')
| -rwxr-xr-x | mcsh.sh | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -191,7 +191,12 @@ function update_metadata ( mkdir -p "$VERSIONS_DIR" curl --silent "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json" | jq '{"latest": .latest, "versions": [.versions[] | {"key": .id, "value": .url}] | from_entries}' > "$VERSIONS_DIR/manifest.json" - version="${1:-"$(jq -r '.latest.release' "$VERSIONS_DIR/manifest.json")"}" + version="${1:-}" + if [[ "$version" == "" || "$version" == "latest" || "$version" == "release" ]]; then + version="$(jq -r '.latest.release' "$VERSIONS_DIR/manifest.json")" + elif [[ "$version" == "snapshot" ]]; then + version="$(jq -r '.latest.snapshot' "$VERSIONS_DIR/manifest.json")" + fi printf 'updating %s meta %s\n' "$version" >&2 mkdir -p "$VERSIONS_DIR/$version" |