首页 > 代码库 > 给源代码自动加 license 头部
给源代码自动加 license 头部
function filtCodeFile() { filename="$1" filepath="$2/$1" blackList="Pods" if [[ $filepath =~ $blackList ]]; then return 1 fi if [ "${filename##*.}" = "h" -o "${filename##*.}" == "m" ]; then if [ ! -z "`grep "MIT License" $filepath`" ]; then echo "[$filepath] aleady has license describe." #test else echo "/* " > ./copy_license_file.txt cat "./LICENSE" >> ./copy_license_file.txt echo " */" >> ./copy_license_file.txt cat "$filepath" >> ./copy_license_file.txt mv ./copy_license_file.txt $filepath echo "[$filepath] add license finish!" fi fi } function traversingFiles() { #1st param, the dir name for file in `ls $1`; do if [ -d "$1/$file" ]; then #filtCodeFile $file $1 traversingFiles "$1/$file" "$1" else filtCodeFile $file $1 fi done rm -f ./copy_license_file.txt } traversingFiles "."
给源代码自动加 license 头部
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。