Skip to content

Commit

Permalink
Improve parsing algorithm to handle spaces and comments #63
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Oct 14, 2021
1 parent 161b293 commit 48669c0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ function calcGlob(goalName, pattern, script, file) {
GlobCnt = 0
GlobGoalName = goalName
split("",GlobFiles)
gsub(/ /,"\\ ",pattern)
script = MyDirScript ";for f in ./" pattern ";do test -e \"$f\" && echo \"$f\";done"
while ((script | getline file)>0) {
GlobCnt++
Expand Down
9 changes: 9 additions & 0 deletions tests/21_parsing.tush
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,23 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_spaces.sh -la
| 21_parsing 1.txt
| 21_parsing 2.txt
| 21_parsing*.txt
| g1@21_parsing 1.txt
| g1@21_parsing 2.txt
| g1
| test2
| test3

$ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_spaces.sh test2
| goal '21_parsing 2.txt' ...
| 21_parsing 2.txt
| 2
| goal 'test2' [empty].

$ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_spaces.sh test3
| goal 'g1@21_parsing 2.txt' ...
| 21_parsing 2.txt
| 2
| goal 'test3' [empty].

$ cd "$MYDIR"; ./$MAKESURE -f tests/21_parsing_comments.sh -la
| Available goals:
Expand Down
9 changes: 8 additions & 1 deletion tests/21_parsing_spaces.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,12 @@
echo "$ITEM"
cat "$ITEM"

@goal g1 @glob '21_parsing ?.txt'
echo "$ITEM"
cat "$ITEM"

@goal test2
@depends_on '21_parsing 2.txt'
@depends_on '21_parsing 2.txt'

@goal test3
@depends_on 'g1@21_parsing 2.txt'

0 comments on commit 48669c0

Please sign in to comment.