删除一些冗余api文件

This commit is contained in:
eson 2023-07-10 14:00:23 +08:00
parent 0db491bc01
commit 2681c10b4c
7 changed files with 34 additions and 76 deletions

3
.gitignore vendored
View File

@ -35,4 +35,5 @@ __debug_bin
.idea
.vscode
screenlog.*
screenlog.*
allapis.txt

32
concatenate_apis.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# 定义输出文件名
output_file="allapis.txt"
# 清空输出文件(如果存在)
> "$output_file"
# 定义要处理的 .api 文件列表
api_files=("server_api/basic.api" "server_api/home-user-auth.api")
# 遍历 server_api 目录下的指定 .api 文件
# for api_file in server_api/*.api; do
for api_file in "${api_files[@]}"; do
# 获取文件名(不包含扩展名)
filename=$(basename "$api_file" .api)
# 将文件名添加到输出文件
echo "// ${filename}.api" >> "$output_file"
# 删除指定内容并将过滤后的 .api 文件内容追加到输出文件
sed -e '/syntax = "v1"/d' \
-e '/info (/,/)/d' \
-e '/title: \/\/ TODO: add title/d' \
-e '/desc: \/\/ TODO: add description/d' \
-e '/author: ""/d' \
-e '/email: ""/d' "$api_file" >> "$output_file"
# 在不同 .api 文件内容之间添加一个空行
echo "" >> "$output_file"
done

View File

@ -1,15 +0,0 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

View File

@ -1,15 +0,0 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

View File

@ -1,15 +0,0 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

View File

@ -1,15 +0,0 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}

View File

@ -1,15 +0,0 @@
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
service user-auth {
@handler GreetHandler
get /greet/from/:name(request) returns (response);
}