Skip to content

Commit

Permalink
Consider the notion of private goals #31
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Aug 17, 2021
1 parent 2a998bb commit 02f9b46
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makesurefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
@depends_on tests/12_update.tush
@depends_on tests/13_errors.tush
@depends_on tests/14_doc.tush
@depends_on tests/15_private.tush

@goal stable
@doc prepares for release
Expand Down
6 changes: 4 additions & 2 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ BEGIN {
split("",ArgGoals) # invoked goals
split("",Options)
split("",GoalNames) # list
split("",GoalsByName) # name -> ""
split("",GoalsByName) # name -> private
split("",Code) # name -> body
split("",DefineOverrides) # k -> v
DefinesFile=""
Expand Down Expand Up @@ -167,7 +167,7 @@ function registerGoal(goal_name, priv) {
if (goal_name in GoalsByName)
addError("Goal '" goal_name "' is already defined")
arrPush(GoalNames, goal_name)
GoalsByName[goal_name]
GoalsByName[goal_name] = priv
}

function calcGlob(pattern, script, file) {
Expand Down Expand Up @@ -273,6 +273,8 @@ body,goal_body,goal_bodies,resolved_goals,exit_code, t0,t1,t2, goal_timed) {
print "Available goals:"
for (i = 0; i < arrLen(GoalNames); i++) {
goal_name = GoalNames[i]
if (GoalsByName[goal_name]) # private
continue
printf " "
if (goal_name in Doc)
printf "%s - %s\n", goal_name, Doc[goal_name]
Expand Down
12 changes: 12 additions & 0 deletions tests/15_private.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

@goal a
echo a

@goal b @private
echo b

@goal_glob 15_private.sh
echo $ITEM

@goal_glob 15_private.tush @private
echo $ITEM
7 changes: 7 additions & 0 deletions tests/15_private.tush
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


$ cd "$MYDIR"; ./makesure -f tests/15_private.sh -l
| Available goals:
| a
| 15_private.sh

0 comments on commit 02f9b46

Please sign in to comment.