代码拉取完成,页面将自动刷新
#!/bin/bash
################################################################
# Function : Create markdown document for scripts
# Platform : All Linux Based Platform
# Version : 1.0
# Date : 2022-06-23
# Author : ncnynl
# Contact : 1043931@qq.com
# Company : Foshan AiZheTeng Information Technology Co.,Ltd.
# URL: https://ncnynl.com
################################################################
#Document Format
url="https://gitee.com/ncnynl/commands/blob/master/commands_extra/"
source ${HOME}/commands/cs_utils.sh
function create_markdown_document(){
i=1
cd ${HOME}/commands
for dir in $(ls)
do
if [ -d $dir/shell ]; then
if is_empty_dir $dir/shell
then
continue
fi
echo "$(printf '%s' "# 分类$dir的命令列表")" >> ${HOME}/tools/commands/DOCUMENT.md
for file in $(ls $dir/shell/*.sh)
do
if [ -f $file ]; then
result=$(echo $file | grep "$1")
if [[ $result != "" ]] ; then
local script_file="${HOME}/commands/$result"
path_name="${result%.*}"
script_name=${path_name##*/}
dir_name=${path_name%%/*}
# Desc
local start=`grep "Desc" -n $script_file | head -n 1 | cut -d ":" -f1`
local script_desc=`cat $script_file | tail -n +$start | head -n 1 | sed "s/^# Desc ://" | sed "s/^ *//g"`
# Function
local f_start=`grep "Function" -n $script_file | head -n 1 | cut -d ":" -f1`
local f_script_desc=`cat $script_file | tail -n +$f_start | head -n 1 | sed "s/^# Function ://" | sed "s/^ *//g"`
if [[ $script_desc ]]; then
echo "$(printf '%s' "## 第 $i 条命令 ")" >> ${HOME}/tools/commands/DOCUMENT.md
echo "$(printf '%s' " - 命令格式: rcm $dir_name $script_name <a href="${url}${file}" target="_blank">查看代码</a>")" >> ${HOME}/tools/commands/DOCUMENT.md
echo "$(printf '%s' " - 中文介绍: $script_desc")" >> ${HOME}/tools/commands/DOCUMENT.md
echo "$(printf '%s' " - English Desc: $f_script_desc")" >> ${HOME}/tools/commands/DOCUMENT.md
fi
let i++
fi
fi
done
fi
done
}
create_markdown_document $*
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。