diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-13 15:20:11 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-13 15:20:11 +0100 |
commit | 23a9d88ce2d3072b54f75b3413e4925432bc5a6d (patch) | |
tree | c6bf32fcd6010aa582cc6560ee42b1c5fa63e7ca | |
parent | 8cf237680bcf071eb06790c1d4e4857b6cad1846 (diff) | |
download | poezio-23a9d88ce2d3072b54f75b3413e4925432bc5a6d.tar.gz poezio-23a9d88ce2d3072b54f75b3413e4925432bc5a6d.tar.bz2 poezio-23a9d88ce2d3072b54f75b3413e4925432bc5a6d.tar.xz poezio-23a9d88ce2d3072b54f75b3413e4925432bc5a6d.zip |
Completion for /set
-rw-r--r-- | src/core.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py index 6a388a96..f28016fd 100644 --- a/src/core.py +++ b/src/core.py @@ -122,7 +122,7 @@ class Core(object): 'show': (self.command_status, _('Usage: /show <availability> [status message]\nShow: Sets your availability and (optionally) your status message. The <availability> argument is one of \"available, chat, away, afk, dnd, busy, xa\" and the optional [status message] argument will be your status message.'), self.completion_status), 'status': (self.command_status, _('Usage: /status <availability> [status message]\nStatus: Sets your availability and (optionally) your status message. The <availability> argument is one of \"available, chat, away, afk, dnd, busy, xa\" and the optional [status message] argument will be your status message.'), self.completion_status), 'bookmark': (self.command_bookmark, _("Usage: /bookmark [roomname][/nick]\nBookmark: Bookmark the specified room (you will then auto-join it on each poezio start). This commands uses almost the same syntaxe as /join. Type /help join for syntaxe examples. Note that when typing \"/bookmark\" on its own, the room will be bookmarked with the nickname you\'re currently using in this room (instead of default_nick)"), self.completion_bookmark), - 'set': (self.command_set, _("Usage: /set <option> [value]\nSet: Set the value of the option in your configuration file. You can, for example, change your default nickname by doing `/set default_nick toto` or your resource with `/set resource blabla`. You can also set an empty value (nothing) by providing no [value] after <option>."), None), + 'set': (self.command_set, _("Usage: /set <option> [value]\nSet: Set the value of the option in your configuration file. You can, for example, change your default nickname by doing `/set default_nick toto` or your resource with `/set resource blabla`. You can also set an empty value (nothing) by providing no [value] after <option>."), self.completion_set), 'theme': (self.command_theme, _('Usage: /theme [theme_name]\nTheme: Reload the theme defined in the config file. If theme_name is provided, set that theme before reloading it.'), None), 'list': (self.command_list, _('Usage: /list\nList: Get the list of public chatrooms on the specified server.'), self.completion_list), 'message': (self.command_message, _('Usage: /message <jid> [optional message]\nMessage: Open a conversation with the specified JID (even if it is not in our roster), and send a message to it, if the message is specified.'), None), @@ -1569,6 +1569,18 @@ class Core(object): msg = "%s=%s" % (option, value) self.information(msg, 'Info') + def completion_set(self, the_input): + """Completion for /set""" + txt = the_input.get_text() + args = txt.split() + n = len(args) + if txt.endswith(' '): + n += 1 + if n == 2: + return the_input.auto_completion(config.options('Poezio'), '') + elif n == 3: + return the_input.auto_completion([config.get(args[1], '')], '') + def command_set_plugin(self, arg): """ /set_plugin <plugin> <option> [value] |