summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2017-11-27 12:10:11 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-11-27 12:10:11 -0600
commit2e3f8784232e785c730787d0d49317eeafa33778 (patch)
tree5dab9146f61bbec63bf6865bb9e4482a8a9807ef /include
parent635583dabd77a9da420c2e1b0474262fb4a18303 (diff)
parent8a63f4e7093b619d7e9b84bf7f3df7aa92aa0d33 (diff)
Merge "CLI: Create ast_cli_completion_add function." into 13
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/cli.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h
index 0a05a4c11..c2401a85d 100644
--- a/include/asterisk/cli.h
+++ b/include/asterisk/cli.h
@@ -300,6 +300,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 *);
@@ -321,10 +324,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