diff --git a/check_samples_in_README.awk b/check_samples_in_README.awk index de9b7eb..2e50fde 100644 --- a/check_samples_in_README.awk +++ b/check_samples_in_README.awk @@ -22,11 +22,14 @@ function fixLine() { sub(/\[ goal_name \]/,"goal_name") sub(/\[ lib_name \]/,"lib_name") sub("","'*.*'") + sub("","true") + sub(/\[ goal2 \[ goal3.+]/,"goal2 goal3\n") } function checkSample( tmp,out) { # print "\n-------- checking: " Sample if (isMakesureSample()) { + fixSample() # print "\n------- Makesurefile: " Sample print Sample > (tmp = "/tmp/makesuresample1.txt") close(tmp) @@ -39,8 +42,22 @@ function checkSample( tmp,out) { } } } +function fixSample() { + if (Sample ~ /@reached_if/) { + Sample = "@goal g\n" Sample + } else if (Sample ~ /@depends_on goal_name @args/) { + Sample = "@goal goal_name @params A B C\n" Sample + } else if (Sample ~ /@depends_on goal1 goal2 goal3/) { + Sample = "@goal goal1\n@goal goal2\n@goal goal3\n@goal goal\n" Sample + } +} + function isMakesureSample() { return Sample ~ /(^|\n)@[a-z]+/ } -END { print "\nTotal errors: " ErrorsCnt } \ No newline at end of file +BEGIN { system("touch '/tmp/file with spaces1.txt'") } +END { + print "\nTotal errors: " ErrorsCnt + exit ErrorsCnt > 0 +} \ No newline at end of file