Files
radius-rs/scripts/generate-code.sh
moznion 2b6b80a83e Support the following RFC dictionaries
- RFC4603
- RFC4675
- RFC4818
- RFC4849
- RFC5176
- RFC6911
- RFC7055
- RFC7155
2020-12-06 16:09:03 +09:00

32 lines
704 B
Bash
Executable File

#!/bin/bash
set -eu
REPO_ROOT="$(cd ./"$(git rev-parse --show-cdup)" || exit; pwd)"
DICTS_DIR="${REPO_ROOT}/dicts"
SRC_DIR="${REPO_ROOT}/radius/src"
DICTS=$(ls "$DICTS_DIR")
# shellcheck disable=SC2068
for DICT in ${DICTS[@]}; do
DICT_NAME="${DICT##*.}"
DICT_FILE="${DICTS_DIR}/dictionary.${DICT_NAME}"
if [ -f "$DICT_FILE" ]; then
cat /dev/null > "${SRC_DIR}/${DICT_NAME}.rs"
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 fix --allow-dirty --allow-staged
cargo fmt