Update nodeloc_vps_autotest_response.sh

This commit is contained in:
Jensfrank 2024-06-27 15:16:39 +08:00 committed by GitHub
parent 1cf9a936a1
commit 179d629733
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -108,6 +108,12 @@ show_welcome() {
# 定义一个数组来存储每个命令的输出
declare -a test_results
# 去除响应板块ANSI转义码
response_process_output() {
local input="$1"
echo "$input" | sed 's/\x1b\[[0-9;]*m//g'
}
# 在每个命令执行后保存结果
run_and_capture() {
local command_output
@ -131,10 +137,13 @@ run_all_tests() {
# 格式化结果为 Markdown
format_results() {
# 处理响应测试结果
local processed_response_result
processed_response_result=$(response_process_output "$response_result")
result="[tabs]
[tab=\"响应\"]
\`\`\`
$response_result
$processed_response_result
\`\`\`
[/tab]
[/tabs]"