@@ -55,28 +55,25 @@ function M.action(selected_option)
5555 name = " - C compiler" ,
5656 strategy = { " orchestrator" ,
5757 tasks = {{ " shell" , name = " - Run program → " .. entry_point ,
58- cmd = output .. -- run
59- " && echo " .. output .. -- echo
58+ cmd = output .. -- run
59+ " && echo " .. output .. -- echo
6060 " && echo '" .. final_message .. " '"
6161 },},},})
6262 task :start ()
6363 vim .cmd (" OverseerOpen" )
6464 elseif selected_option == " option4" then
6565 local entry_points
66+ local task = {}
6667 local tasks = {}
67- local task
68+ local executables = {}
6869
6970 -- if .solution file exists in working dir
7071 local solution_file = utils .get_solution_file ()
7172 if solution_file then
7273 local config = utils .parse_solution_file (solution_file )
73- local executable
7474
7575 for entry , variables in pairs (config ) do
76- if variables .executable then
77- executable = utils .os_path (variables .executable )
78- goto continue
79- end
76+ if entry == " executables" then goto continue end
8077 entry_point = utils .os_path (variables .entry_point )
8178 files = utils .find_files_to_compile (entry_point , " *.c" )
8279 output = utils .os_path (variables .output )
@@ -93,21 +90,23 @@ function M.action(selected_option)
9390 :: continue::
9491 end
9592
96- if executable then
97- task = { " shell" , name = " - Run program → " .. executable ,
98- cmd = executable .. -- run
99- " && echo " .. executable .. -- echo
100- " && echo '" .. final_message .. " '"
101- }
102- else
103- task = {}
93+ local solution_executables = config [" executables" ]
94+ if solution_executables then
95+ for entry , executable in pairs (solution_executables ) do
96+ task = { " shell" , name = " - Run program → " .. executable ,
97+ cmd = executable .. -- run
98+ " && echo " .. executable .. -- echo
99+ " && echo '" .. final_message .. " '"
100+ }
101+ table.insert (executables , task ) -- store all the executables we've created
102+ end
104103 end
105104
106105 task = overseer .new_task ({
107106 name = " - C compiler" , strategy = { " orchestrator" ,
108107 tasks = {
109- tasks , -- Build all the programs in the solution in parallel
110- task -- Then run the solution executable
108+ tasks , -- Build all the programs in the solution in parallel
109+ executables -- Then run the solution executable(s)
111110 }}})
112111 task :start ()
113112 vim .cmd (" OverseerOpen" )
0 commit comments