From 9eebf97e3d3fe8bff0d3c5ecdae39f15bd93f40b Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 4 Oct 2022 13:30:04 +0200 Subject: lib: make cmd_element->attr a bitmask & clarify It already "looks" like a bitmask, but we currently can't flag a command both YANG and HIDDEN at the same time. It really should be a bitmask. Also clarify DEPRECATED behaviour (or the absence thereof.) Signed-off-by: David Lamparter --- lib/command_graph.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/command_graph.c') diff --git a/lib/command_graph.c b/lib/command_graph.c index 09d802e796..e940685250 100644 --- a/lib/command_graph.c +++ b/lib/command_graph.c @@ -494,9 +494,10 @@ void cmd_graph_node_print_cb(struct graph_node *gn, struct buffer *buf) snprintf(nbuf, sizeof(nbuf), "%s", lookup_msg(tokennames, tok->type, NULL)); buffer_putstr(buf, nbuf); - if (tok->attr == CMD_ATTR_DEPRECATED) + if (tok->attr & CMD_ATTR_DEPRECATED) buffer_putstr(buf, " (d)"); - else if (tok->attr == CMD_ATTR_HIDDEN) + /* DEPRECATED implies HIDDEN, don't print both */ + else if (tok->attr & CMD_ATTR_HIDDEN) buffer_putstr(buf, " (h)"); if (tok->text) { if (tok->type == WORD_TKN) -- cgit v1.2.3