Skip to content

Commit

Permalink
#171 @call
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Dec 29, 2024
1 parent 5d76b18 commit 0039f8d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
19 changes: 12 additions & 7 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ BEGIN {
srand()
prepareArgs()
ProgAbs = "" # absolute path to makesure executable
MakesurefileAbs = "" # absolute path to Makesurefile being called
MyDirScript = "MYDIR=" quoteArg(getMyDir(ARGV[1])) ";export MYDIR;cd \"$MYDIR\""
Error = ""
makesure()
Expand Down Expand Up @@ -201,9 +202,11 @@ function handleCalls( i) {
}

function processCalls( i) {
for (i = 2; i <= NF; i++)
addCodeLine(quoteArg(ProgAbs) " " quoteArg($i))
# addCodeLine("echo " quoteArg(ProgAbs) " " quoteArg($i))
for (i = 2; i <= NF; i++) {
# addCodeLine("pwd; echo " quoteArg(ProgAbs) " --file " quoteArg(MakesurefileAbs) " " quoteArg($i))
# addCodeLine("echo " quoteArg(ProgAbs) " --file " quoteArg(MakesurefileAbs) " " quoteArg($i))
addCodeLine(quoteArg(ProgAbs) " --file " quoteArg(MakesurefileAbs) " " quoteArg($i))
}
}

function registerUseLib(goalName) {
Expand Down Expand Up @@ -570,12 +573,14 @@ function shellExec(script, comment, res) {
return res
}

function getMyDir(makesurefilePath, script,res,p) {
script = "echo \"$(cd \"$(dirname "(p=quoteArg(Prog))")\" && pwd)/$(basename "p")\";cd \"$(dirname " quoteArg(makesurefilePath) ")\";pwd"
function getMyDir(makesurefilePath, script,myDir,p,m,baseName) {
script = "echo \"$(basename "(m=quoteArg(makesurefilePath))")\";echo \"$(cd \"$(dirname "(p=quoteArg(Prog))")\" && pwd)/$(basename "p")\";cd \"$(dirname " m ")\";pwd"
script | getline baseName
script | getline ProgAbs
script | getline res
script | getline myDir
closeErr(script)
return res
MakesurefileAbs = myDir "/" baseName
return myDir
}

function handleCodeLine(line) {
Expand Down
7 changes: 6 additions & 1 deletion tests/32_calls.tush
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@

$ ./$MAKESURE -f tests/32_calls.sh x-updated
$ touch /tmp/x ; ./$MAKESURE -f tests/32_calls.sh x-updated
| goal 'x-updated' ...
| goal 'x-deleted' ...
| running x-deleted
| goal 'x-created' ...
| running x-created

0 comments on commit 0039f8d

Please sign in to comment.