mirror of
https://github.com/fluencelabs/redis
synced 2025-06-13 01:01:22 +00:00
Linenoise updated again (hints support).
This commit is contained in:
10
deps/linenoise/example.c
vendored
10
deps/linenoise/example.c
vendored
@ -11,6 +11,15 @@ void completion(const char *buf, linenoiseCompletions *lc) {
|
||||
}
|
||||
}
|
||||
|
||||
char *hints(const char *buf, int *color, int *bold) {
|
||||
if (!strcasecmp(buf,"hello")) {
|
||||
*color = 35;
|
||||
*bold = 0;
|
||||
return " World";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char *line;
|
||||
char *prgname = argv[0];
|
||||
@ -34,6 +43,7 @@ int main(int argc, char **argv) {
|
||||
/* Set the completion callback. This will be called every time the
|
||||
* user uses the <tab> key. */
|
||||
linenoiseSetCompletionCallback(completion);
|
||||
linenoiseSetHintsCallback(hints);
|
||||
|
||||
/* Load history from file. The history file is just a plain text file
|
||||
* where entries are separated by newlines. */
|
||||
|
Reference in New Issue
Block a user