52 lines
1.1 KiB
Bash
Executable file
52 lines
1.1 KiB
Bash
Executable file
#!/bin/zsh
|
|
|
|
version=$(cat bin/.translate_version)
|
|
|
|
show() {
|
|
printf "Log translation %s\n" $version
|
|
git log -p t/$(echo $version)
|
|
}
|
|
|
|
next() {
|
|
printf "Increment translation version\n"
|
|
version=$(($version+1))
|
|
echo $version > bin/.translate_version
|
|
}
|
|
|
|
if [ "$1" = "set" ]; then
|
|
if [ "$2" ]; then
|
|
version="$2"
|
|
printf "Set version to %s\n" $2
|
|
echo $version > bin/.translate_version
|
|
show
|
|
fi
|
|
elif [ "$1" = "fetch" ]; then
|
|
printf "Fetch from version %s\n" $version
|
|
bin/cli i18n fetch $(echo $version)
|
|
elif [ "$1" = "s" ]; then
|
|
show
|
|
elif [ "$1" = "a" ]; then
|
|
printf "Apply translation %s\n" $version
|
|
git cherry-pick t/$(echo $version)
|
|
returncode=$?
|
|
if [ $returncode = 1 ]; then
|
|
git mergetool
|
|
elif [ $returncode = 0 ]; then
|
|
next
|
|
show
|
|
fi
|
|
elif [ "$1" = "p" ]; then
|
|
printf "Picking translation %s\n" $version
|
|
git cherry-pick -n t/$(echo $version)
|
|
tig status
|
|
elif [ "$1" = "n" ]; then
|
|
next
|
|
show
|
|
elif [ "$1" = "c" ]; then
|
|
printf "Commit resolved conflict\n"
|
|
git clean -f
|
|
git commit -C t/$(echo $version)
|
|
fi
|
|
|
|
printf "current version: %s\n" $version
|