diff options
author | George Joseph <gjoseph@digium.com> | 2017-11-27 13:26:43 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-11-27 13:26:43 -0600 |
commit | 708189ce02465a350e0e1be99fbd767543b06675 (patch) | |
tree | 250e4cf4027087f401ac2fbd0a86e7ab4af6be1f /include/asterisk | |
parent | b69bfc637f1eefeb2e2ebc73ae4770b70ab05775 (diff) | |
parent | 9587a61f4c40d5d7911b1069f4fa353012018e2b (diff) |
Merge "CLI: Create ast_cli_completion_add function."
Diffstat (limited to 'include/asterisk')
-rw-r--r-- | include/asterisk/cli.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h index 51f077fa1..c75fc295d 100644 --- a/include/asterisk/cli.h +++ b/include/asterisk/cli.h @@ -305,6 +305,9 @@ int ast_cli_generatornummatches(const char *, const char *); * Subsequent entries are all possible values, followed by a NULL. * All strings and the array itself are malloc'ed and must be freed * by the caller. + * + * \warning This function cannot be called recursively so it will always + * fail if called from a CLI_GENERATE callback. */ char **ast_cli_completion_matches(const char *, const char *); @@ -326,10 +329,30 @@ char **ast_cli_completion_matches(const char *, const char *); * by the caller. * * \note The vector is sorted and does not contain any duplicates. + * + * \warning This function cannot be called recursively so it will always + * fail if called from a CLI_GENERATE callback. */ struct ast_vector_string *ast_cli_completion_vector(const char *text, const char *word); /*! + * \brief Add a result to a request for completion options. + * + * \param value A completion option text. + * + * \retval 0 Success + * \retval -1 Failure + * + * This is an alternative to returning individual values from CLI_GENERATE. Instead + * of repeatedly being asked for the next match and having to start over, you can + * call this function repeatedly from your own stateful loop. When all matches have + * been added you can return NULL from the CLI_GENERATE function. + * + * \note This function always eventually results in calling ast_free on \a value. + */ +int ast_cli_completion_add(char *value); + +/*! * \brief Command completion for the list of active channels. * * This can be called from a CLI command completion function that wants to |