搭建网页版源码阅读器的方法

标签:nohup   cep   dirname   luminous   glob   wds   htm   $1   执行   

本文主要搭建网页版源码阅读器,阅读源码更方便。
centos7 平台为例;

安装gtags 和 htags

查看rpm包是否安装
rpm -qa | grep global
安装rpm包
yum install global

关键步骤

cd /root/ceph : 进入ceph源码目录
gtags -v : 生成tag文件
htags -sanohITvt ‘Welcome to ceph source tour!‘ :tag 文件生成后, 执行 htags 命令生成 HTML 文件
htags --suggest2
#htags-server >& log
nohup htags-server -b 0.0.0.0 9091 &

实践脚本

执行脚本

cat gtags.sh
#!/bin/bash
#L 9092
#J 9093
DIR=$(dirname $(readlink -f "$0"))

echo $DIR
if [ $# -ne 2 ]; then
  echo "args num is 2"
  echo "arg1 is ceph dir"
  echo "arg2 is http port"
  echo "Example:http://192.168.0.103:9092/"
  exit 1
fi

cd $DIR/$1
gtags -v
htags -sanohITvt ‘Welcome to ceph source tour!‘
htags --suggest2
nohup htags-server -b 0.0.0.0 $2 &
sleep 3
echo "==================="
ps -ef | grep tags
sleep 3
echo "==================="
netstat -tunlp | grep $2

外部调用脚本

[[email protected] ~]# cat ceph_L.sh 
#!/bin/bash
#http://192.168.0.110:9092/
#http://192.168.0.110:9093/
#http://127.0.0.1:8000
cd /root/mycode/community_code/
if [ ${1}x == "Lx" ];then
    sh gtags.sh ceph_luminous 9092
elif [ ${1}x == "Jx" ];then
    sh gtags.sh ceph_10.2.5  9093
else
    echo "Not support version! exit!"
    exit 1
fi

搭建网页版源码阅读器

原文地址:https://blog.51cto.com/wendashuai/2494157