Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
smgano committed May 24, 2024
1 parent 1a8952b commit cd332a2
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 26 deletions.
26 changes: 0 additions & 26 deletions deploy-resource/scripts/openapi.sh

This file was deleted.

31 changes: 31 additions & 0 deletions deploy-resource/scripts/rename.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# 定义目标目录, 将目录下的所有文件重命名, 文件名结尾添加 ".tpl"
DIR=$(PWD)"/cmd/kitctl/internal/cmd/templates/skeleton"

# 确保目标目录存在
if [ -d "$DIR" ]; then
# 使用 find 命令递归查找所有文件并重命名
find "$DIR" -type f | while read -r FILE; do
# 检查文件是否以 .tpl 结尾
if [[ "$FILE" != *.tpl ]]; then
# 获取文件的目录路径
DIRNAME=$(dirname "$FILE")
# 获取文件名
BASENAME=$(basename "$FILE")
if [ $BASENAME == "docs.go" ]; then
#echo "跳过:$FILE"
continue # 跳过当前迭代
fi
# 新文件名
NEWNAME="${BASENAME}.tpl"
# 重命名文件
mv "$FILE" "$DIRNAME/$NEWNAME"
else
echo "文件已以 .tpl 结尾,跳过:$FILE"
fi
done
echo "所有文件已重命名并添加 .tpl 后缀"
else
echo "目录不存在:$DIR"
fi
24 changes: 24 additions & 0 deletions deploy-resource/scripts/replace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# 设置 LC_ALL 以避免非法字节序列错误
export LC_ALL=C

# 定义要替换的目录
target_dir=$(PWD)"/cmd/kitctl/internal/cmd/templates/skeleton"

# 使用 find 命令递归查找所有文件,并使用 sed 进行替换
find "$target_dir" -type f -exec sed -i '' 's|github.com/yituoshiniao/gin-api-http|{{ .Mod }}|g' {} +

find "$target_dir" -type f -exec sed -i '' 's|github.com/yituoshiniao/kit|gitlab.abc.net/cs-server2/kit|g' {} +

# 替换应用名称
find "$target_dir" -type f -exec sed -i '' 's|gin-api-http|{{ .AppName }}|g' {} +
find "$target_dir" -type f -exec sed -i '' 's|goodsCenterLogic|{{ .AppName }}|g' {} +




# 将 abcdefg/cad 替换成 {{ .Mod }}
#find "$target_dir" -type f -exec sed -i '' 's|abcdefg/cad|{{ .Mod }}|g' {} +

echo "替换完成"

0 comments on commit cd332a2

Please sign in to comment.