summaryrefslogtreecommitdiff
path: root/lib/command.h
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-11-18 12:06:57 +0100
committerQuentin Young <qlyoung@users.noreply.github.com>2017-05-15 10:27:43 -0400
commit16705ecc653dd657c5b8149934d8734e89c27c07 (patch)
tree382236b56dcc7542e95d302d031c686ae6618eb7 /lib/command.h
parent6a72763d738c7c4132fbc4af03a688a7cc0e49e3 (diff)
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/command.h')
-rw-r--r--lib/command.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/command.h b/lib/command.h
index 8f6abc85ba..9b2af57991 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -210,6 +210,7 @@ struct cmd_token
char *desc; // token description
long long min, max; // for ranges
char *arg; // user input that matches this token
+ char *varname;
struct graph_node *forkjoin; // paired FORK/JOIN for JOIN/FORK
};
@@ -446,6 +447,7 @@ extern struct cmd_token *new_cmd_token (enum cmd_token_type, u_char attr,
const char *text, const char *desc);
extern void del_cmd_token (struct cmd_token *);
extern struct cmd_token *copy_cmd_token (struct cmd_token *);
+extern void cmd_set_varname(struct cmd_token *token, const char *varname);
extern vector completions_to_vec (struct list *completions);
extern void cmd_merge_graphs (struct graph *old, struct graph *new, int direction);