Accept multiple dict files at code-generator

This commit is contained in:
moznion
2020-12-09 23:43:24 +09:00
parent cda352e87f
commit 0064a28520
2 changed files with 43 additions and 23 deletions

View File

@@ -7,6 +7,7 @@ DICTS_DIR="${REPO_ROOT}/dicts"
SRC_DIR="${REPO_ROOT}/radius/src"
DICTS=$(ls "$DICTS_DIR")
DICT_FILES=()
# shellcheck disable=SC2068
for DICT in ${DICTS[@]}; do
@@ -14,17 +15,12 @@ for DICT in ${DICTS[@]}; do
DICT_FILE="${DICTS_DIR}/dictionary.${DICT_NAME}"
if [ -f "$DICT_FILE" ]; then
cat /dev/null > "${SRC_DIR}/${DICT_NAME}.rs"
DICT_FILES+=("$DICT_FILE")
fi
done
# shellcheck disable=SC2068
for DICT in ${DICTS[@]}; do
DICT_NAME="${DICT##*.}"
DICT_FILE="${DICTS_DIR}/dictionary.${DICT_NAME}"
if [ -f "$DICT_FILE" ]; then
cargo run --bin code-generator "$DICT_FILE" "${SRC_DIR}/${DICT_NAME}.rs"
fi
done
cargo run --bin code-generator -- --out-dir="${SRC_DIR}/" ${DICT_FILES[@]}
cargo fix --allow-dirty --allow-staged
cargo fmt