Merge "Fix issue with printing longHelp"
diff --git a/src/grammars.hpp b/src/grammars.hpp
index 51361fc..a70cce0 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -130,7 +130,7 @@
     x3::eps;
 
 auto const help = x3::rule<struct help_class, help_>{"help"} =
-    help_::name > createCommandSuggestions >> -command_names;
+    help_::name >> -(space_separator >> createCommandSuggestions > -(command_names));
 
 struct datastore_symbol_table : x3::symbols<Datastore> {
     datastore_symbol_table()
diff --git a/tests/command_completion.cpp b/tests/command_completion.cpp
index 7aafd02..48daa9c 100644
--- a/tests/command_completion.cpp
+++ b/tests/command_completion.cpp
@@ -90,5 +90,20 @@
         expectedContextLength = 0;
     }
 
+    SECTION("help - add space")
+    {
+        input = "help";
+        expectedCompletions = {"help "};
+        expectedContextLength = 4;
+    }
+
+    SECTION("help - list commands")
+    {
+        input = "help ";
+        expectedCompletions = {"cd", "copy", "create", "delete", "set", "commit", "get", "ls", "discard", "help", "describe", "move", "dump", "prepare", "exec", "cancel", "switch", "quit"};
+        expectedContextLength = 0;
+    }
+
+
     REQUIRE(parser.completeCommand(input, errorStream) == (Completions{expectedCompletions, expectedContextLength}));
 }
diff --git a/tests/misc_commands.cpp b/tests/misc_commands.cpp
index 868189d..ae36808 100644
--- a/tests/misc_commands.cpp
+++ b/tests/misc_commands.cpp
@@ -38,4 +38,31 @@
         }
         REQUIRE(boost::get<switch_>(parser.parseCommand(input, errorStream)) == expected);
     }
+
+    SECTION("help")
+    {
+        std::string input;
+        bool expectedCommand = false;
+        SECTION("Short help")
+        {
+            input = "help";
+        }
+        SECTION("Short help with trailing whitespace")
+        {
+            input = "help ";
+        }
+        SECTION("Long help")
+        {
+            input = "help cd";
+            expectedCommand = true;
+        }
+        SECTION("Long help with trailing whitespace")
+        {
+            input = "help cd ";
+            expectedCommand = true;
+        }
+
+        auto result = boost::get<help_>(parser.parseCommand(input, errorStream));
+        REQUIRE(!!result.m_cmd == expectedCommand);
+    }
 }