创建一个文件:getcode.sh
#!/bin/bash
cat `find $1 -name "*.js" -or -name "*.vue"`|sed -e "/\s*\\/\\*/,/\\*\\/\s*/d" -e /^[[:space:]]*$/d -e '/^[[:space:]]*\/\//d' >doc.txt
linux 或 git shell 下执行:
./getcode.sh /my/code/path
则会在当前目录下生成一个 合并后的 doc.txt 文件。
说明:
1. 根据自己的开发语言,修改需要过滤的文件后缀: -name "*.js" -or -name "*.vue" -or -name "*.html"
2. 目前会自动删除: /* xxxxx */ 跨多行代码段、// 注释行、空行