diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2015-11-26 01:02:07 +0000 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-06-11 20:49:46 +0100 |
commit | bfb02d64a88bf9ca0bbd78cf389c9c648adbf725 (patch) | |
tree | 958c11b8287e80edc13ee19a14016e2db150c6ac /poezio/tabs/basetabs.py | |
parent | 721756c5c1512e05f44637afe22b25506889d62a (diff) | |
download | poezio-bfb02d64a88bf9ca0bbd78cf389c9c648adbf725.tar.gz poezio-bfb02d64a88bf9ca0bbd78cf389c9c648adbf725.tar.bz2 poezio-bfb02d64a88bf9ca0bbd78cf389c9c648adbf725.tar.xz poezio-bfb02d64a88bf9ca0bbd78cf389c9c648adbf725.zip |
Make poezio.core.struct more Cython-friendly.
Status and Command are now slotted classes instead of namedtuples,
which led to a few changes to access them with their named parameters
instead of as a tuple.
“short” being a C type, I renamed Command.short into
Command.short_desc, which is more explicit anyway.
I also renamed possible_show into POSSIBLE_SHOW, as it is a
module-level constant dict.
Diffstat (limited to 'poezio/tabs/basetabs.py')
-rw-r--r-- | poezio/tabs/basetabs.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py index bb0c0ea4..5f0bc138 100644 --- a/poezio/tabs/basetabs.py +++ b/poezio/tabs/basetabs.py @@ -252,10 +252,10 @@ class Tab(object): command = self.core.commands[command_name] else: # Unknown command, cannot complete return False - if command[2] is None: + if command.comp is None: return False # There's no completion function else: - return command[2](the_input) + return command.comp(the_input) return False def execute_command(self, provided_text): @@ -270,15 +270,15 @@ class Tab(object): arg = txt[2+len(command):] # jump the '/' and the ' ' func = None if command in self.commands: # check tab-specific commands - func = self.commands[command][0] + func = self.commands[command].func elif command in self.core.commands: # check global commands - func = self.core.commands[command][0] + func = self.core.commands[command].func else: low = command.lower() if low in self.commands: - func = self.commands[low][0] + func = self.commands[low].func elif low in self.core.commands: - func = self.core.commands[low][0] + func = self.core.commands[low].func else: if self.missing_command_callback is not None: error_handled = self.missing_command_callback(low) |