Fix exec with space and no arguments

Issue: https://tree.taiga.io/project/jktjkt-netconf-cli/issue/214
Change-Id: I3efd4fac8c17cbd9006f4f8bbd02a95720d1b89d
diff --git a/src/grammars.hpp b/src/grammars.hpp
index 03f0c90..e86748c 100644
--- a/src/grammars.hpp
+++ b/src/grammars.hpp
@@ -262,7 +262,7 @@
     prepare_::name > space_separator > as<dataPath_>[RpcActionPath<AllowInput::Yes>{}];
 
 auto const exec_def =
-    exec_::name > -(space_separator > as<dataPath_>[RpcActionPath<AllowInput::No>{}]);
+    exec_::name > -(space_separator > -as<dataPath_>[RpcActionPath<AllowInput::No>{}]);
 
 auto const cancel_def =
     cancel_::name >> x3::attr(cancel_{});
diff --git a/tests/parser_rpc.cpp b/tests/parser_rpc.cpp
index c8458d8..eed1a42 100644
--- a/tests/parser_rpc.cpp
+++ b/tests/parser_rpc.cpp
@@ -66,5 +66,29 @@
             input = "exec example:shutdown";
             REQUIRE_THROWS_AS(parser.parseCommand(input, errorStream), InvalidCommandException);
         }
+
+        SECTION("require space between arguments")
+        {
+            input = "execexample:fire";
+            REQUIRE_THROWS_AS(parser.parseCommand(input, errorStream), InvalidCommandException);
+        }
+    }
+
+    SECTION("exec with no arguments")
+    {
+        exec_ execExpected;
+
+        SECTION("without space")
+        {
+            input = "exec";
+        }
+
+        SECTION("with space")
+        {
+            input = "exec ";
+        }
+        command_ command = parser.parseCommand(input, errorStream);
+        auto lol = boost::get<exec_>(command);
+        REQUIRE(boost::get<exec_>(command) == execExpected);
     }
 }