This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/19577 )
Change subject: vty/command: reflect global attributes in the XML reference
......................................................................
vty/command: reflect global attributes in the XML reference
Given that commands with either/both of the following attributes:
- CMD_ATTR_DEPRECATED,
- CMD_ATTR_HIDDEN,
never end up in the XML reference, only CMD_ATTR_IMMEDIATE would
be reflected for commands taking effect immediately as follows:
<command id='foo'>
<!-- Global attributes -->
<attributes scope='global'>
<attribute doc='This command applies immediately' />
</attributes>
<!-- Application specific attributes -->
<attributes scope='application'>
<!-- ... -->
</attributes>
<params>
<!-- ... -->
</params>
</command>
Change-Id: I8476c1163c23a9a52641987acf3df0b8c49d8f7b
Related: SYS#4937
---
M src/vty/command.c
1 file changed, 26 insertions(+), 0 deletions(-)
Approvals:
Jenkins Builder: Verified
dexter: Looks good to me, approved; Verified
pespin: Looks good to me, but someone else must approve
diff --git a/src/vty/command.c b/src/vty/command.c
index bad2688..30c39a7 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -622,6 +622,13 @@
typedef int (*print_func_t)(void *data, const char *fmt, ...);
+static const struct value_string cmd_attr_desc[] = {
+ { CMD_ATTR_DEPRECATED, "This command is deprecated" },
+ { CMD_ATTR_HIDDEN, "This command is hidden" },
+ { CMD_ATTR_IMMEDIATE, "This command applies immediately" },
+ { 0, NULL }
+};
+
/*
* Write one cmd_element as XML via a print_func_t.
*/
@@ -632,6 +639,25 @@
print_func(data, " <command id='%s'>%s", xml_string, newline);
+ /* Print global attributes and their description */
+ if (cmd->attr != 0x00) { /* ... if at least one flag is set */
+ print_func(data, " <attributes scope='global'>%s", newline);
+
+ for (i = 0; i < ARRAY_SIZE(cmd_attr_desc) - 1; i++) {
+ char *xml_att_desc;
+
+ if (~cmd->attr & cmd_attr_desc[i].value)
+ continue;
+
+ xml_att_desc = xml_escape(cmd_attr_desc[i].str);
+ print_func(data, " <attribute doc='%s' />%s",
+ xml_att_desc, newline);
+ talloc_free(xml_att_desc);
+ }
+
+ print_func(data, " </attributes>%s", newline);
+ }
+
/* Print application specific attributes and their description */
if (cmd->usrattr != 0x00) { /* ... if at least one flag is set */
print_func(data, " <attributes scope='application'>%s", newline);
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/19577
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8476c1163c23a9a52641987acf3df0b8c49d8f7b
Gerrit-Change-Number: 19577
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200929/d45c3e04/attachment.htm>