Skip to content

Commit 4fc65ac

Browse files
CzBalticassava
authored andcommitted
engine: Add --output-path to cloe-engine
1 parent 7184411 commit 4fc65ac

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

engine/src/main.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,17 @@ int main(int argc, char** argv) {
7171
run->add_option("-u,--uuid", run_options.uuid, "Override simulation UUID")
7272
->envname("CLOE_SIMULATION_UUID");
7373
run->add_flag("--allow-empty", run_options.allow_empty, "Allow empty simulations");
74-
run->add_flag("--write-output,!--no-write-output", run_options.write_output,
74+
run->add_flag("-w,--write-output,!--no-write-output", run_options.write_output,
7575
"Do (not) write any output files")
7676
->envname("CLOE_WRITE_OUTPUT");
77+
run->add_option("-o,--output-path", run_options.output_path, "Write output to given directory")
78+
->envname("CLOE_OUTPUT_PATH");
7779
run->add_flag("--progress,!--no-progress", run_options.report_progress,
7880
"Do (not) report progress");
7981
run->add_flag("--require-success,!--no-require-success", run_options.require_success,
8082
"Require simulation success")
8183
->envname("CLOE_REQUIRE_SUCCESS");
82-
run->add_flag("--debug-lua", run_options.debug_lua,
83-
"Debug the Lua simulation");
84+
run->add_flag("--debug-lua", run_options.debug_lua, "Debug the Lua simulation");
8485
run->add_option("--debug-lua-port", run_options.debug_lua_port,
8586
"Port to listen on for debugger to attach to")
8687
->envname("CLOE_DEBUG_LUA_PORT");
@@ -171,6 +172,7 @@ int main(int argc, char** argv) {
171172
lua_options.no_system_lua = true;
172173
run_options.require_success = true;
173174
}
175+
174176
stack_options.environment->prefer_external(false);
175177
stack_options.environment->allow_undefined(stack_options.interpolate_undefined);
176178
stack_options.environment->insert(CLOE_SIMULATION_UUID_VAR, "${" CLOE_SIMULATION_UUID_VAR "}");

engine/src/main_commands.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ struct RunOptions {
6767

6868
// Options
6969
std::string uuid;
70+
std::string output_path;
7071

7172
// Flags:
7273
int json_indent = 2;

engine/src/main_run.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ int run(const RunOptions& opt, const std::vector<std::string>& filepaths) {
9191
return EXIT_FAILURE;
9292
}
9393

94+
if (!opt.output_path.empty()) {
95+
stack.engine.output_path = opt.output_path;
96+
}
97+
9498
// Create simulation:
9599
Simulation sim(std::move(stack), std::move(lua), uuid);
96100
GLOBAL_SIMULATION_INSTANCE = &sim;

0 commit comments

Comments
 (0)