#!/bin/bashfunction usage() {echo "uasge: 0ドル {start|restart|kill|toc|build|publish|release_src|release|help|-h}"}function kill_teedoc() {ps aux | grep teedoc | grep python3 | awk '{print 2ドル}' | xargs kill -9 >/dev/null}function teedoc_build() {teedoc buildret=$?retry_count=1# 等于1表示,文件夹存在,重新运行while ((ret==1))doteedoc buildret=$?let "retry_count=$retry_count+1"echo $retry_countdone}function restart() {teedoc_buildkill_teedocteedoc serve &}function start() {teedoc serve &}function creat_toc() {# 读取所有的 sidebar.yml 生成目录echo "生成目录"python3 script/auto_creat_toc.py --out_file Quecpython_toc.yml --input_file docs/Quecpython_intro/zh/config.json --action toc}function teedoc_release() {# 检查是否存在 out文件release_filename=Community-document-$(date "+%Y%m%d-%H%M")if [ ! -d "out" ]; thenteedoc_buildfitar cf ${release_filename}.tar outtar jcf ${release_filename}.tar.bz2 ${release_filename}.tarrm -rf ${release_filename}.tarmv ${release_filename}.tar.bz2 ..}function teedoc_src_release() {release_filename=Community-document-src-$(date "+%Y%m%d-%H%M")tar -zcvf ${release_filename}.tar.gz --exclude-from .tar_excludefile .mv ${release_filename}.tar.gz ..}function teedoc_publish_to_server() {OUT_DOC_TOP_DIC=./out/doccp ${OUT_DOC_TOP_DIC}/doc/*.html ${OUT_DOC_TOP_DIC}cp ${OUT_DOC_TOP_DIC}/doc/*.ico ${OUT_DOC_TOP_DIC}cp ${OUT_DOC_TOP_DIC}/doc/*.json ${OUT_DOC_TOP_DIC}rm ${OUT_DOC_TOP_DIC}/doc/*.htmlrm ${OUT_DOC_TOP_DIC}/doc/*.icorm ${OUT_DOC_TOP_DIC}/doc/*.json# 首页的英文页面mkdir ${OUT_DOC_TOP_DIC}/en/assets/cp ${OUT_DOC_TOP_DIC}/doc/en/*.html ${OUT_DOC_TOP_DIC}/en/cp ${OUT_DOC_TOP_DIC}/doc/en/*.ico ${OUT_DOC_TOP_DIC}/en/cp ${OUT_DOC_TOP_DIC}/doc/en/*.json ${OUT_DOC_TOP_DIC}/en/cp -r ${OUT_DOC_TOP_DIC}/assets/* ${OUT_DOC_TOP_DIC}/en/assets/rm -rf ${OUT_DOC_TOP_DIC}/doc/en/case 1ドル in"root@192.168.25.215:/home/dist/doc")echo "确认发布到服务器: "sudo chmod -R 777 ${OUT_DOC_TOP_DIC}rsync ${OUT_DOC_TOP_DIC}/ 1ドル -r -i;;*)echo "发布到 /www/wwwroot/test.com/doc 文件夹"sudo chmod -R 777 ${OUT_DOC_TOP_DIC}rsync ${OUT_DOC_TOP_DIC}/ /www/wwwroot/test.com/doc -r -i >/dev/null;;esac}function copy_file() {python3 script/auto_creat_toc.py --input_file pages/index/zh/config.json --action copy}function apply_patch() {. script/out_doc_static_css_theme_default_light_patch.sh}case 1ドル in"start")start;;"restart")restart;;"kill")kill_teedoc;;"--help")usage;;"build")teedoc_build;;"-h")usage;;"release")teedoc_release;;"release_src")teedoc_src_release;;"publish")apply_patchteedoc_publish_to_server 2ドル;;"toc")# 生成目录creat_toc;;"copy")# 覆盖相同的文档copy_file;;"patch")apply_patch;;*)if [ $# = 0 ]; then# 没有参数,默认teedoc_buildelse# 错误的参数echo "ERROR: 0ドル1ドル 错误的参数"usageexit -1fi;;esac
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。