Files
mahjong/раскладки/2019-09-19/ген

30 lines
526 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Создать файл JavaScript с набором раскладок в формате Base64.
function gen
{
fileName=$1
target=$2
echo -n "'$fileName' : '" >> $target
base64 $fileName | tr -d \\n >> $target
echo -e "',\n" >> $target
}
function genLayouts
{
target=$1
echo -e "function RR() { return {\n" > $target
layouts=$(ls *.layout)
for layout in $layouts;
do
gen $layout $target
done
echo "}; }" >> $target
}
genLayouts "../2019-09-19.js"