summaryrefslogtreecommitdiff
path: root/lib/command.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-05-11 15:36:04 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2017-06-14 19:29:26 +0200
commit5578a14d949d89e25ec3e6136158603049e5a2dd (patch)
treefc1df6006271fb7f73cf8802c4022b266e0344b1 /lib/command.h
parent29ad6f6882de5a871d6d81c609e8b20d825d6138 (diff)
python: clidef.py
Adds "DEFPY()" which invokes an additional layer of preprocessing, so that we get pre-parsed and named function arguments for the CLI. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command.h')
-rw-r--r--lib/command.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/command.h b/lib/command.h
index ada9003cc9..927c04006c 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -207,6 +207,10 @@ struct cmd_node
int argc __attribute__ ((unused)), \
struct cmd_token *argv[] __attribute__ ((unused)) )
+#define DEFPY(funcname, cmdname, cmdstr, helpstr) \
+ DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \
+ funcdecl_##funcname
+
#define DEFUN(funcname, cmdname, cmdstr, helpstr) \
DEFUN_CMD_FUNC_DECL(funcname) \
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \
@@ -274,6 +278,9 @@ struct cmd_node
#define ALIAS_SH_DEPRECATED(daemon, funcname, cmdname, cmdstr, helpstr) \
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_DEPRECATED, daemon)
+#else /* VTYSH_EXTRACT_PL */
+#define DEFPY(funcname, cmdname, cmdstr, helpstr) \
+ DEFUN(funcname, cmdname, cmdstr, helpstr)
#endif /* VTYSH_EXTRACT_PL */
/* Some macroes */