From 4534e12fe761f1897eb88d04b0a5e53bb1717ba8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20=C5=A0torc?= <storcond@fit.cvut.cz>
Date: Sat, 10 Jun 2023 17:37:45 +0200
Subject: [PATCH] aql: add incorrect commands to history

Incorrect (unparseable) commands were not saved into history. When this
happens usually you want to quickly fix the mistake and run again. But
the command was not saved to history so we were unable to do that.
---
 aql2/src/REPL.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/aql2/src/REPL.cpp b/aql2/src/REPL.cpp
index b875d010b..37c5bdc6c 100644
--- a/aql2/src/REPL.cpp
+++ b/aql2/src/REPL.cpp
@@ -118,10 +118,10 @@ cli::CommandResult REPL::run(cli::Environment& env)
         if (input.empty()) {
             continue;
         }
+        rx.history_add(input);
+
         try {
             state = env.execute(input);
-            if (state == cli::CommandResult::OK)
-                rx.history_add(input);
         } catch (const std::exception& e) {
             std::cerr << e.what() << '\n';
         }
-- 
GitLab