Files
AutoZhuyin/scripts/bump-version.sh
T
ays953andClaude Opus 5.5 d1f1112c65 Split mixed Chinese/English input without spaces; add release script
The classifier now segments a buffer into alternating Zhuyin and literal runs
by dynamic programming over split points, so "ji3hello" becomes 我hello and
"hellosu3cl3" becomes hello你好. Each switch costs a penalty, a Zhuyin run
followed by another must end with a tone, and an untoned trailing Zhuyin run
after English is penalized so partial words don't flicker into Bopomofo.
Implemented in both Swift and Python with the same tests; the Mac app colours
each segment separately.

scripts/bump-version.sh bumps the version in Info.plist and ime.json;
scripts/release.sh bumps, tests, packages, commits and tags in one step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 16:21:13 +08:00

33 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Increments the version in every place it lives:
# Resources/Info.plist CFBundleShortVersionString (x.y.z) and CFBundleVersion (build number)
# windows/autozhuyin/ime.json "version"
#
# Usage: scripts/bump-version.sh [patch|minor|major] (default: patch)
# Prints the new version.
set -euo pipefail
cd "$(dirname "$0")/.."
LEVEL="${1:-patch}"
PLIST=Resources/Info.plist
IME=windows/autozhuyin/ime.json
CURRENT="$(plutil -extract CFBundleShortVersionString raw "$PLIST")"
IFS=. read -r MAJOR MINOR PATCH <<< "$CURRENT"
case "$LEVEL" in
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
patch) PATCH=$((PATCH + 1)) ;;
*) echo "usage: $0 [patch|minor|major]" >&2; exit 2 ;;
esac
NEW="$MAJOR.$MINOR.$PATCH"
BUILD=$(( $(plutil -extract CFBundleVersion raw "$PLIST") + 1 ))
plutil -replace CFBundleShortVersionString -string "$NEW" "$PLIST"
plutil -replace CFBundleVersion -string "$BUILD" "$PLIST"
# Edit only the version line so the rest of ime.json keeps its formatting.
sed -i '' -E "s/(\"version\"[[:space:]]*:[[:space:]]*\")[^\"]*\"/\1$NEW\"/" "$IME"
grep -q "\"version\": \"$NEW\"" "$IME" || { echo "failed to update $IME" >&2; exit 1; }
echo "$NEW"