X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/2612e0521fde55db2c720092d4ad02a8f015f46e..ff4058183bc6dfdc130a7172105bb0a02f76b4ec:/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') {