|
19 | 19 |
|
20 | 20 | #include <algorithm> |
21 | 21 | #include <cstdio> |
| 22 | +#include <functional> |
22 | 23 | #include <iostream> |
23 | 24 | #include <optional> |
24 | 25 | #include <thread> |
@@ -91,7 +92,11 @@ DEFINE_bool(csv_doublequote, true, |
91 | 92 | "If `csv-doublequote` is false, 'csv-escapechar' must be set."); |
92 | 93 |
|
93 | 94 | // history |
94 | | -DEFINE_string(history, "/tmp/.memgraph", "Use the specified directory to save history."); // Use /tmp because in K8s deployments users want to have read-only root filesystem. Folder /home/memgraph is part then of the root fileystem and hence read-only |
| 95 | +DEFINE_string( |
| 96 | + history, "~/.memgraph", |
| 97 | + "Use the specified directory to save history."); // Use /tmp because in K8s deployments users want to have |
| 98 | + // read-only root filesystem. Folder /home/memgraph is part then |
| 99 | + // of the root fileystem and hence read-only |
95 | 100 | DEFINE_bool(no_history, false, "Do not save history."); |
96 | 101 |
|
97 | 102 | DEFINE_string( |
@@ -188,7 +193,14 @@ int main(int argc, char **argv) { |
188 | 193 | }; |
189 | 194 |
|
190 | 195 | if (console::is_a_tty(STDIN_FILENO)) { // INTERACTIVE |
191 | | - return mode::interactive::Run(bolt_config, FLAGS_history, FLAGS_no_history, FLAGS_verbose_execution_info, csv_opts, |
| 196 | + auto const history_file = std::invoke([&]() -> std::string { |
| 197 | + if (const char *env_file = std::getenv("MGCONSOLE_HISTORY_PATH")) { |
| 198 | + return env_file; |
| 199 | + } |
| 200 | + return FLAGS_history; |
| 201 | + }); |
| 202 | + |
| 203 | + return mode::interactive::Run(bolt_config, history_file, FLAGS_no_history, FLAGS_verbose_execution_info, csv_opts, |
192 | 204 | output_opts); |
193 | 205 | } else if (FLAGS_import_mode == constants::kParserMode) { |
194 | 206 | return mode::parsing::Run(FLAGS_collect_parser_stats, FLAGS_print_parser_stats); |
|
0 commit comments