run.min
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
#!/usr/bin/env min ;Capture a reference of default symbols before more are added symbols =min-symbols 2 :n-args 1 :taskspec-arg (compiled?) ( 1 @n-args 0 @taskspec-arg ) when ; Validation (args size n-args <) ("No task specified" error 1 exit) when args taskspec-arg get ":" split =taskspec taskspec 0 get :task "default" :subtask (taskspec size 1 >) (taskspec 1 get @subtask) when "tasks/$#.min" (task) =% :task-file task-file require :tasklist "tasklist/$#" (subtask) =% invoke ; Load task module ;task-file load ; Execute task ;"$#-tasks" (task) =% eval subtask ^ |