X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/e902b579b4eb5f695680427cb34725159a4fa64f..c4cbffa3a1b7f83fd27359961b4d9e287847c4b6:/deps/linenoise/example.c diff --git a/deps/linenoise/example.c b/deps/linenoise/example.c index b3f9e9e3..ea0b515c 100644 --- a/deps/linenoise/example.c +++ b/deps/linenoise/example.c @@ -2,9 +2,18 @@ #include #include "linenoise.h" + +void completion(const char *buf, linenoiseCompletions *lc) { + if (buf[0] == 'h') { + linenoiseAddCompletion(lc,"hello"); + linenoiseAddCompletion(lc,"hello there"); + } +} + int main(void) { char *line; + linenoiseSetCompletionCallback(completion); linenoiseHistoryLoad("history.txt"); /* Load the history at startup */ while((line = linenoise("hello> ")) != NULL) { if (line[0] != '\0') {