mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 16:26:10 +00:00
lib, python: DEFPY_ATTR, DEFPY_HIDDEN
Add support for element attributes in DEFPY macros. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
e1a8a773a2
commit
e31f4dbec6
@ -221,6 +221,13 @@ struct cmd_node {
|
||||
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \
|
||||
funcdecl_##funcname
|
||||
|
||||
#define DEFPY_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \
|
||||
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, attr, 0) \
|
||||
funcdecl_##funcname
|
||||
|
||||
#define DEFPY_HIDDEN(funcname, cmdname, cmdstr, helpstr) \
|
||||
DEFPY_ATTR(funcname, cmdname, cmdstr, helpstr, CMD_ATTR_HIDDEN)
|
||||
|
||||
#define DEFUN(funcname, cmdname, cmdstr, helpstr) \
|
||||
DEFUN_CMD_FUNC_DECL(funcname) \
|
||||
DEFUN_CMD_ELEMENT(funcname, cmdname, cmdstr, helpstr, 0, 0) \
|
||||
@ -298,6 +305,9 @@ struct cmd_node {
|
||||
#else /* VTYSH_EXTRACT_PL */
|
||||
#define DEFPY(funcname, cmdname, cmdstr, helpstr) \
|
||||
DEFUN(funcname, cmdname, cmdstr, helpstr)
|
||||
|
||||
#define DEFPY_ATTR(funcname, cmdname, cmdstr, helpstr, attr) \
|
||||
DEFUN_ATTR(funcname, cmdname, cmdstr, helpstr, attr)
|
||||
#endif /* VTYSH_EXTRACT_PL */
|
||||
|
||||
/* Some macroes */
|
||||
|
@ -132,6 +132,8 @@ SPECIAL [(),]
|
||||
"DEFUN_NOSH" value = strdup(yytext); return DEFUNNY;
|
||||
"DEFUN_HIDDEN" value = strdup(yytext); return DEFUNNY;
|
||||
"DEFPY" value = strdup(yytext); return DEFUNNY;
|
||||
"DEFPY_ATTR" value = strdup(yytext); return DEFUNNY;
|
||||
"DEFPY_HIDDEN" value = strdup(yytext); return DEFUNNY;
|
||||
"ALIAS" value = strdup(yytext); return DEFUNNY;
|
||||
"ALIAS_HIDDEN" value = strdup(yytext); return DEFUNNY;
|
||||
"install_element" value = strdup(yytext); return INSTALL;
|
||||
|
@ -186,7 +186,7 @@ def process_file(fn, ofd, dumpfd, all_defun):
|
||||
filedata = clippy.parse(fn)
|
||||
|
||||
for entry in filedata['data']:
|
||||
if entry['type'] == 'DEFPY' or (all_defun and entry['type'].startswith('DEFUN')):
|
||||
if entry['type'].startswith('DEFPY') or (all_defun and entry['type'].startswith('DEFUN')):
|
||||
cmddef = entry['args'][2]
|
||||
cmddef = ''.join([i[1:-1] for i in cmddef])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user