aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaroline Larimore <caroline@larimo.re>2025-11-27 12:46:05 -0800
committerCaroline Larimore <caroline@larimo.re>2025-11-27 12:46:05 -0800
commit35b577e5f31940e8e1ebe870fc8fe5ad1ae6e735 (patch)
tree28ff82f5190127160d6237584cfaaa84553701cd
parent5a683c455863dac52bb88af301a2f4987136c963 (diff)
feat: alias latest versions
-rwxr-xr-xmcsh.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/mcsh.sh b/mcsh.sh
index 3853b4e..774903e 100755
--- a/mcsh.sh
+++ b/mcsh.sh
@@ -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"