diff --git a/src/main.cpp b/src/main.cpp index 4ede8b96..2aeb28ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -188,7 +189,14 @@ int main(int argc, char **argv) { }; if (console::is_a_tty(STDIN_FILENO)) { // INTERACTIVE - return mode::interactive::Run(bolt_config, FLAGS_history, FLAGS_no_history, FLAGS_verbose_execution_info, csv_opts, + auto const history_file = std::invoke([&]() -> std::string { + if (const char *env_file = std::getenv("MGCONSOLE_HISTORY_PATH")) { + return env_file; + } + return FLAGS_history; + }); + + return mode::interactive::Run(bolt_config, history_file, FLAGS_no_history, FLAGS_verbose_execution_info, csv_opts, output_opts); } else if (FLAGS_import_mode == constants::kParserMode) { return mode::parsing::Run(FLAGS_collect_parser_stats, FLAGS_print_parser_stats);