diff options
Diffstat (limited to 'jim-history.c')
-rw-r--r-- | jim-history.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/jim-history.c b/jim-history.c index 9a56e04..fe6e628 100644 --- a/jim-history.c +++ b/jim-history.c @@ -9,7 +9,7 @@ static int history_cmd_getline(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_Obj *objPtr; - char *line = Jim_HistoryGetline(Jim_String(argv[0])); + char *line = Jim_HistoryGetline(interp, Jim_String(argv[0])); /* On EOF returns -1 if varName was specified; otherwise the empty string. */ if (line == NULL) { @@ -35,6 +35,12 @@ static int history_cmd_getline(Jim_Interp *interp, int argc, Jim_Obj *const *arg return JIM_OK; } +static int history_cmd_setcompletion(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +{ + Jim_HistorySetCompletion(interp, Jim_Length(argv[0]) ? argv[0] : NULL); + return JIM_OK; +} + static int history_cmd_load(Jim_Interp *interp, int argc, Jim_Obj *const *argv) { Jim_HistoryLoad(Jim_String(argv[0])); @@ -67,6 +73,13 @@ static const jim_subcmd_type history_command_table[] = { 2, /* Description: Reads one line from the user. Similar to gets. */ }, + { "completion", + "command", + history_cmd_setcompletion, + 1, + 1, + /* Description: Sets an autocompletion callback command, or none if "" */ + }, { "load", "filename", history_cmd_load, |