diff options
author | James Booth <boothj5@gmail.com> | 2016-06-23 00:44:52 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-06-23 00:44:52 +0100 |
commit | 61a09476c511c33abd9b6be3d5786fee1fa93b94 (patch) | |
tree | b723d9527204c9f5849fedc2e3f2926f0cf86902 | |
parent | 1e37b755fe4030586b6994c397ddc855a659af43 (diff) | |
download | profani-tty-61a09476c511c33abd9b6be3d5786fee1fa93b94.tar.gz |
Add macro for plugins completer add
-rw-r--r-- | src/plugins/c_api.c | 7 | ||||
-rw-r--r-- | src/plugins/profapi.c | 2 | ||||
-rw-r--r-- | src/plugins/profapi.h | 3 | ||||
-rw-r--r-- | src/plugins/python_api.c | 3 |
4 files changed, 11 insertions, 4 deletions
diff --git a/src/plugins/c_api.c b/src/plugins/c_api.c index 97d2e2f8..b5624946 100644 --- a/src/plugins/c_api.c +++ b/src/plugins/c_api.c @@ -105,8 +105,11 @@ c_api_register_timed(const char *filename, void(*callback)(void), int interval_s } static void -c_api_completer_add(const char *key, char **items) +c_api_completer_add(const char *filename, const char *key, char **items) { + char *plugin_name = _c_plugin_name(filename); + log_debug("Autocomplete add %s for %s", key, plugin_name); + api_completer_add(key, items); } @@ -307,7 +310,7 @@ c_api_init(void) prof_cons_bad_cmd_usage = c_api_cons_bad_cmd_usage; _prof_register_command = c_api_register_command; _prof_register_timed = c_api_register_timed; - prof_completer_add = c_api_completer_add; + _prof_completer_add = c_api_completer_add; prof_completer_remove = c_api_completer_remove; prof_completer_clear = c_api_completer_clear; prof_notify = c_api_notify; diff --git a/src/plugins/profapi.c b/src/plugins/profapi.c index 33967613..d80e2690 100644 --- a/src/plugins/profapi.c +++ b/src/plugins/profapi.c @@ -48,7 +48,7 @@ void (*_prof_register_command)(const char *filename, const char *command_name, i void (*_prof_register_timed)(const char *filename, void(*callback)(void), int interval_seconds) = NULL; -void (*prof_completer_add)(const char *key, char **items) = NULL; +void (*_prof_completer_add)(const char *filename, const char *key, char **items) = NULL; void (*prof_completer_remove)(const char *key, char **items) = NULL; void (*prof_completer_clear)(const char *key) = NULL; diff --git a/src/plugins/profapi.h b/src/plugins/profapi.h index 697e9598..8c41b2f2 100644 --- a/src/plugins/profapi.h +++ b/src/plugins/profapi.h @@ -37,6 +37,7 @@ #define prof_register_command(command_name, min_args, max_args, synopsis, description, arguments, examples, callback) _prof_register_command(__FILE__, command_name, min_args, max_args, synopsis, description, arguments, examples, callback) #define prof_register_timed(callback, interval_seconds) _prof_register_timed(__FILE__, callback, interval_seconds) +#define prof_completer_add(key, items) _prof_completer_add(__FILE__, key, items) typedef char* PROF_WIN_TAG; @@ -51,7 +52,7 @@ void (*_prof_register_command)(const char *filename, const char *command_name, i void (*_prof_register_timed)(const char *filename, void(*callback)(void), int interval_seconds); -void (*prof_completer_add)(const char *key, char **items); +void (*_prof_completer_add)(const char *filename, const char *key, char **items); void (*prof_completer_remove)(const char *key, char **items); void (*prof_completer_clear)(const char *key); diff --git a/src/plugins/python_api.c b/src/plugins/python_api.c index a5c5d73c..87a2b4d2 100644 --- a/src/plugins/python_api.c +++ b/src/plugins/python_api.c @@ -205,6 +205,9 @@ python_api_completer_add(PyObject *self, PyObject *args) return Py_BuildValue(""); } + char *plugin_name = _python_plugin_name(); + log_debug("Autocomplete add %s for %s", key, plugin_name); + Py_ssize_t len = PyList_Size(items); char *c_items[len]; |