Skip to content

Commit

Permalink
Merge pull request #15 from wzshiming/fix/comments
Browse files Browse the repository at this point in the history
Fix the content in the processed comments
  • Loading branch information
wzshiming authored Aug 8, 2022
2 parents 9b37882 + 768c951 commit 1f12780
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bin/command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,21 @@ function exec_cmd() {
"${cmdpath}" $@
}

function clearComment() {
sed -e ':begin; /<!--/,/-->/ { /-->/! { $! { N; b begin }; }; s/<!--.*-->/COMMENT/; };'
}

function extractCommand() {
grep -e '^/[a-z]\+'
}

function main() {
if [[ "${MESSAGE}" == "" ]]; then
return 0
fi
echo "${MESSAGE}" | grep -e '^/[a-z]\+' | while read line; do
echo "${MESSAGE}" |
clearComment |
extractCommand | while read line; do
line=$(echo ${line} | sed 's/\t/ /g' | sed 's/ */ /g' | tr -d '\r')
cmd=("${line#/}")
echo "Exec command: ${cmd[@]}"
Expand Down

0 comments on commit 1f12780

Please sign in to comment.