Change in libosmocore[master]: vty/command: add 'hidden only' VTY reference generation mode

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/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Nov 17 09:43:52 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/21208 )

Change subject: vty/command: add 'hidden only' VTY reference generation mode
......................................................................

vty/command: add 'hidden only' VTY reference generation mode

Change-Id: I511ce26350cd04bb0f66d130b5286cab84f16df2
Related: SYS#4910
---
M include/osmocom/vty/command.h
M src/vty/command.c
2 files changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/include/osmocom/vty/command.h b/include/osmocom/vty/command.h
index b608848..add57e2 100644
--- a/include/osmocom/vty/command.h
+++ b/include/osmocom/vty/command.h
@@ -464,6 +464,8 @@
 	VTY_REF_GEN_MODE_DEFAULT = 0,
 	/*! Expert mode: all commands including hidden, excluding deprecated. */
 	VTY_REF_GEN_MODE_EXPERT,
+	/*! "Inverse" mode: only hidden commands. */
+	VTY_REF_GEN_MODE_HIDDEN,
 };
 
 extern const struct value_string vty_ref_gen_mode_names[];
diff --git a/src/vty/command.c b/src/vty/command.c
index c233aa6..b38be34 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -897,12 +897,14 @@
 const struct value_string vty_ref_gen_mode_names[] = {
 	{ VTY_REF_GEN_MODE_DEFAULT,	"default" },
 	{ VTY_REF_GEN_MODE_EXPERT,	"expert" },
+	{ VTY_REF_GEN_MODE_HIDDEN,	"hidden" },
 	{ 0, NULL }
 };
 
 const struct value_string vty_ref_gen_mode_desc[] = {
 	{ VTY_REF_GEN_MODE_DEFAULT,	"all commands except deprecated and hidden" },
 	{ VTY_REF_GEN_MODE_EXPERT,	"all commands including hidden, excluding deprecated" },
+	{ VTY_REF_GEN_MODE_HIDDEN,	"hidden commands only" },
 	{ 0, NULL }
 };
 
@@ -914,12 +916,18 @@
 int vty_dump_xml_ref_mode(FILE *stream, enum vty_ref_gen_mode mode)
 {
 	unsigned char gflag_mask;
+	bool match = false;
 
 	switch (mode) {
 	case VTY_REF_GEN_MODE_EXPERT:
 		/* All commands except deprecated */
 		gflag_mask = CMD_ATTR_DEPRECATED;
 		break;
+	case VTY_REF_GEN_MODE_HIDDEN:
+		/* Only hidden commands */
+		gflag_mask = CMD_ATTR_HIDDEN;
+		match = true;
+		break;
 	case VTY_REF_GEN_MODE_DEFAULT:
 	default:
 		/* All commands except deprecated and hidden */
@@ -927,7 +935,7 @@
 		break;
 	}
 
-	return vty_dump_nodes(print_func_stream, stream, "\n", gflag_mask, false);
+	return vty_dump_nodes(print_func_stream, stream, "\n", gflag_mask, match);
 }
 
 /*! Print the XML reference of all VTY nodes to the given stream.

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/21208
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I511ce26350cd04bb0f66d130b5286cab84f16df2
Gerrit-Change-Number: 21208
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201117/97bf776f/attachment.htm>


More information about the gerrit-log mailing list