diff options
| author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-11-29 19:27:06 +0100 |
|---|---|---|
| committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-11-29 19:27:06 +0100 |
| commit | ff4058183bc6dfdc130a7172105bb0a02f76b4ec (patch) | |
| tree | 3ade37200909e83c16fc88e234c0811f11ecba18 /deps/linenoise/example.c | |
| parent | a2a69d5803d05ce9ccd2d911389b8aa28239dfba (diff) | |
| download | redis-ff4058183bc6dfdc130a7172105bb0a02f76b4ec.tar.gz | |
Update linenoise
Diffstat (limited to 'deps/linenoise/example.c')
| -rw-r--r-- | deps/linenoise/example.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/deps/linenoise/example.c b/deps/linenoise/example.c index b3f9e9e35..ea0b515c1 100644 --- a/deps/linenoise/example.c +++ b/deps/linenoise/example.c @@ -2,9 +2,18 @@ #include <stdlib.h> #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') { |
