]> git.saurik.com Git - redis.git/blobdiff - deps/linenoise/example.c
redis-check-dump now understands dumps produced by Redis 2.6
[redis.git] / deps / linenoise / example.c
index b3f9e9e3517fce46a3a3719b7b3be85e69e4034a..ea0b515c1fce3a1f2100a4f3315d1613444dc56f 100644 (file)
@@ -2,9 +2,18 @@
 #include <stdlib.h>
 #include "linenoise.h"
 
 #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;
 
 int main(void) {
     char *line;
 
+    linenoiseSetCompletionCallback(completion);
     linenoiseHistoryLoad("history.txt"); /* Load the history at startup */
     while((line = linenoise("hello> ")) != NULL) {
         if (line[0] != '\0') {
     linenoiseHistoryLoad("history.txt"); /* Load the history at startup */
     while((line = linenoise("hello> ")) != NULL) {
         if (line[0] != '\0') {