diff options
author | David Lamparter <equinox@opensourcerouting.org> | 2016-11-18 12:06:57 +0100 |
---|---|---|
committer | Quentin Young <qlyoung@users.noreply.github.com> | 2017-05-15 16:27:43 +0200 |
commit | 16705ecc653dd657c5b8149934d8734e89c27c07 (patch) | |
tree | 382236b56dcc7542e95d302d031c686ae6618eb7 /lib/grammar_sandbox.c | |
parent | Merge pull request #520 from opensourcerouting/bgpd-fixes-master (diff) | |
download | frr-16705ecc653dd657c5b8149934d8734e89c27c07.tar.xz frr-16705ecc653dd657c5b8149934d8734e89c27c07.zip |
lib: parser: add named variables in CLI
struct cmd_token now has a "varname" field which is derived from the
DEFUN's string definition. It can be manually specified with "$name"
after some token, e.g. "foo WORD$var". A later commit adds code to
automatically fill the value if nothing is specified.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/grammar_sandbox.c')
-rw-r--r-- | lib/grammar_sandbox.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c index 0da7981fc..f35b8beff 100644 --- a/lib/grammar_sandbox.c +++ b/lib/grammar_sandbox.c @@ -526,6 +526,8 @@ pretty_print_graph (struct vty *vty, struct graph_node *start, int level, vty_out(vty, "%s", LOOKUP_DEF(tokennames, tok->type, tokennum)); if (tok->text) vty_out(vty, ":\"%s\"", tok->text); + if (tok->varname) + vty_out(vty, " => %s", tok->varname); if (desc) vty_out(vty, " ?'%s'", tok->desc); vty_out(vty, " "); |