TranslateProject/scripts/check/common.inc.sh
2018-10-23 20:43:19 -07:00

31 lines
779 B
Bash
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/sh
################################################################################
# 公用常量和函数
################################################################################
# 定义类别目录
export SRC_DIR='sources' # 未翻译
export TSL_DIR='translated' # 已翻译
export PUB_DIR='published' # 已发布
# 定义匹配规则
export CATE_PATTERN='(news|talk|tech)' # 类别
export FILE_PATTERN='[0-9]{8} [a-zA-Z0-9_.,() -]*\.md' # 文件名
# 用法get_operation_regex 状态 类型
#
# 状态为:
# - A添加
# - M修改
# - D删除
# 类型为:
# - SRC未翻译
# - TSL已翻译
# - PUB已发布
get_operation_regex() {
STAT="$1"
TYPE="$2"
echo "^${STAT}\\s+\"?$(eval echo "\$${TYPE}_DIR")/"
}