]> git.puffer.fish Git - matthieu/frr.git/commitdiff
Add grammar sandbox framework
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 23 Jun 2016 14:47:32 +0000 (14:47 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 12 Jul 2016 15:05:05 +0000 (15:05 +0000)
lib/command.c
lib/grammar_sandbox.c [new file with mode: 0644]

index 34864e9d3f23f489441a6c942619f47d2144fb1e..b5a754fccf6f4901b3193f585fe4a54d0ed12ed0 100644 (file)
@@ -34,6 +34,8 @@ Boston, MA 02111-1307, USA.  */
 #include "workqueue.h"
 #include "vrf.h"
 
+#include "grammar_sandbox.c"
+
 /* Command vector which includes some level of command lists. Normally
    each daemon maintains each own cmdvec. */
 vector cmdvec = NULL;
@@ -4079,6 +4081,10 @@ cmd_init (int terminal)
   install_element (ENABLE_NODE, &show_version_cmd);
   install_element (ENABLE_NODE, &show_commandtree_cmd);
 
+  /**/
+  grammar_sandbox_init();
+  /**/
+
   if (terminal)
     {
       install_element (ENABLE_NODE, &config_terminal_length_cmd);
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
new file mode 100644 (file)
index 0000000..c19be7f
--- /dev/null
@@ -0,0 +1,53 @@
+#include "command.h"
+
+#define GRAMMAR_STR "CLI grammar sandbox\n"
+
+DEFUN (grammar_midkey_test,
+       grammar_midkey_test_cmd,
+       "grammar {one|two} test",
+       GRAMMAR_STR
+       "First option\n"
+       "Second option\n"
+       "Test parameter to end string\n")
+{
+   return CMD_SUCCESS;
+}
+
+DEFUN (grammar_onemidkey_test,
+       grammar_onemidkey_test_cmd,
+       "grammar {onekey} test",
+       GRAMMAR_STR
+       "First option\n"
+       "Test parameter to end string\n")
+{
+   return CMD_SUCCESS;
+}
+
+DEFUN (grammar_smashmouth_test,
+       grammar_smashmouth_test_cmd,
+       "grammar {smash MOUTH} test",
+       GRAMMAR_STR
+       "It ain't easy bein' cheesy\n"
+       "Test parameter to end string\n")
+{
+   return CMD_SUCCESS;
+}
+
+DEFUN (grammar_midopt_test,
+       grammar_midopt_test_cmd,
+       "grammar [option] test",
+       GRAMMAR_STR
+       "optional argument\n"
+       "Test parameter to end string\n")
+{
+   return CMD_SUCCESS;
+}
+
+
+void grammar_sandbox_init(void);
+void grammar_sandbox_init() {
+  install_element (ENABLE_NODE, &grammar_midkey_test_cmd);
+  install_element (ENABLE_NODE, &grammar_onemidkey_test_cmd);
+  install_element (ENABLE_NODE, &grammar_midopt_test_cmd);
+  install_element (ENABLE_NODE, &grammar_smashmouth_test_cmd);
+}