[MERGED] libosmocore[master]: VTY reference: use node names as section names

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun Dec 10 13:34:37 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: VTY reference: use node names as section names
......................................................................


VTY reference: use node names as section names

In 'show online-help' output, add the node names (currently all derived from
the prompt) as <node><name> entry, so that in the osmo-gsm-manuals, each
section of node commands gets a title. So far, each section of commands has no
name at all, and it is entirely up for guessing which part of the VTY the
commands are about.

Node section names, e.g. for OsmoHLR, will be like

  1 VTY reference
  1.4 config
  1.5 config-log
  1.6 config-line
  1.7 config-ctrl
  1.8 config-hlr
  1.9 config-hlr-gsup

Before this patch, all but '1 VTY reference' were plain empty.

A better solution would be to list the actual command name that enters the
node, and to nest the commands identically to VTY node nesting, but since this
information is currently hidden in node command implementations, it is
impossible to derive it. So we should actually make the VTY reflect the node
nesting structure in its data model, which would resolve both the accurate node
name problem as well as produce well-structured output to generate the VTY
references from. This patch is a workaround for lack of a more profound fix of
the VTY data model. At least it makes the VTY references' sections even
remotely useful.

Change-Id: Iaf745b2ab3d9b02fc47025a0eba3beb711068bfe
---
M src/vty/command.c
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/vty/command.c b/src/vty/command.c
index 7395711..55284ee 100644
--- a/src/vty/command.c
+++ b/src/vty/command.c
@@ -705,6 +705,7 @@
 		if (same_name_count > 1 || !*cnode->name)
 			vty_out(vty, "_%d", same_name_count);
 		vty_out(vty, "'>%s", VTY_NEWLINE);
+		vty_out(vty, "    <name>%s</name>%s", cnode->name, VTY_NEWLINE);
 
 		for (j = 0; j < vector_active(cnode->cmd_vector); ++j) {
 			struct cmd_element *elem;

-- 
To view, visit https://gerrit.osmocom.org/5248
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf745b2ab3d9b02fc47025a0eba3beb711068bfe
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list