From 144884d819719fba88f3cb6c052c2bd520a135eb Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 10 Oct 2016 22:46:53 +0100 Subject: [PATCH] Update plugins to use filepath completion --- imgur.py | 1 + tests/python-test.py | 11 ++++++++--- tests/test-c-plugin/test-c-plugin.c | 5 +++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/imgur.py b/imgur.py index 4662e72..48d572f 100644 --- a/imgur.py +++ b/imgur.py @@ -59,3 +59,4 @@ def prof_init(version, status, account_name, fulljid): prof.register_command("/imgur", 1, 1, synopsis, description, args, examples, _cmd_imgur) prof.completer_add("/imgur", [ "screenshot" ]) + prof.filepath_completer_add("/imgur") diff --git a/tests/python-test.py b/tests/python-test.py index e3e7e38..72e03ef 100644 --- a/tests/python-test.py +++ b/tests/python-test.py @@ -442,7 +442,8 @@ def prof_init(version, status, account_name, fulljid): "/python-test int get ", "/python-test int set ", "/python-test incoming ", - "/python-test completer add|remove " + "/python-test completer add|remove ", + "/python-test file" ] description = "Python test plugins. All commands focus the plugin window." args = [ @@ -473,7 +474,8 @@ def prof_init(version, status, account_name, fulljid): [ "int set ", "Set a integer setting" ], [ "incoming ", "Show an incoming message." ], [ "completer add ", "Add an autocomplete item to the /c-test command." ], - [ "completer remove ", "Remove an autocomplete item from the /c-test command." ] + [ "completer remove ", "Remove an autocomplete item from the /c-test command." ], + [ "file", "Complete a file path." ] ] examples = [ "/python-test sendline /about", @@ -504,7 +506,8 @@ def prof_init(version, status, account_name, fulljid): "string_list", "int", "incoming", - "completer" + "completer", + "file" ] ) prof.completer_add("/python-test get", @@ -529,6 +532,8 @@ def prof_init(version, status, account_name, fulljid): [ "add", "remove" ] ) + prof.filepath_completer_add("/python-test file") + prof.register_timed(timed_callback, 5) diff --git a/tests/test-c-plugin/test-c-plugin.c b/tests/test-c-plugin/test-c-plugin.c index 5794560..5d4116b 100644 --- a/tests/test-c-plugin/test-c-plugin.c +++ b/tests/test-c-plugin/test-c-plugin.c @@ -605,6 +605,7 @@ prof_init(const char * const version, const char * const status, const char *con "/c-test int set ", "/c-test incoming ", "/c-test completer add|remove ", + "/c-test file", NULL }; char *description = "C test plugin. All commands focus the plugin window."; @@ -637,6 +638,7 @@ prof_init(const char * const version, const char * const status, const char *con { "incoming ", "Show an incoming message." }, { "completer add ", "Add an autocomplete item to the /c-test command." }, { "completer remove ", "Remove an autocomplete item from the /c-test command." }, + { "file", "Complete a file path." }, { NULL, NULL } }; @@ -670,6 +672,7 @@ prof_init(const char * const version, const char * const status, const char *con "int", "incoming", "completer", + "file", NULL }; prof_completer_add("/c-test", cmd_ac); @@ -695,6 +698,8 @@ prof_init(const char * const version, const char * const status, const char *con char *completer_ac[] = { "add", "remove", NULL }; prof_completer_add("/c-test completer", completer_ac); + prof_filepath_completer_add("/c-test file"); + prof_register_timed(timed_callback, 5); }