summaryrefslogtreecommitdiff
path: root/src/core.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-13 15:27:21 +0100
committermathieui <mathieui@mathieui.net>2011-11-13 15:27:21 +0100
commit97ac583aacad4157dba5c37550361ed7097e72bf (patch)
tree51463bd1a6d746f30b7c0ac4e4ff36b4ae1a1017 /src/core.py
parent23a9d88ce2d3072b54f75b3413e4925432bc5a6d (diff)
downloadpoezio-97ac583aacad4157dba5c37550361ed7097e72bf.tar.gz
poezio-97ac583aacad4157dba5c37550361ed7097e72bf.tar.bz2
poezio-97ac583aacad4157dba5c37550361ed7097e72bf.tar.xz
poezio-97ac583aacad4157dba5c37550361ed7097e72bf.zip
Completion for /set_plugin
Diffstat (limited to 'src/core.py')
-rw-r--r--src/core.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py
index f28016fd..bba18484 100644
--- a/src/core.py
+++ b/src/core.py
@@ -135,7 +135,7 @@ class Core(object):
'plugins': (self.command_plugins, _('Usage: /plugins\nPlugins: Show the plugins in use.'), None),
'presence': (self.command_presence, _('Usage: /presence <JID> [type] [status]\nPresence: Send a directed presence to <JID> and using [type] and [status] if provided.'), self.completion_presence),
'rawxml': (self.command_rawxml, _('Usage: /rawxml\nRawXML: Send a custom xml stanza.'), None),
- 'set_plugin': (self.command_set_plugin, _("Usage: /set_plugin <plugin> <option> [value]\nSet Plugin: Set the value of the option in a plugin configuration file."), None),
+ 'set_plugin': (self.command_set_plugin, _("Usage: /set_plugin <plugin> <option> [value]\nSet Plugin: Set the value of the option in a plugin configuration file."), self.completion_set_plugin),
}
self.key_func = {
@@ -1605,6 +1605,25 @@ class Core(object):
msg = "%s=%s" % (option, value)
self.information(msg, 'Info')
+ def completion_set_plugin(self, the_input):
+ """Completion for /set_plugin"""
+ txt = the_input.get_text()
+ args = txt.split()
+ n = len(args)
+ if txt.endswith(' '):
+ n += 1
+
+ if n == 2:
+ return the_input.auto_completion(list(self.plugin_manager.plugins.keys()), '')
+ elif n == 3:
+ if not args[1] in self.plugin_manager.plugins:
+ return
+ return the_input.auto_completion(self.plugin_manager.plugins[args[1]].config.options(args[1]), '')
+ elif n == 4:
+ if not args[1] in self.plugin_manager.plugins:
+ return
+ return the_input.auto_completion([self.plugin_manager.plugins[args[1]].config.get(args[2], '', args[1])], ' ')
+
def close_tab(self, tab=None):
"""
Close the given tab. If None, close the current one