summaryrefslogtreecommitdiff
path: root/poezio/tabs/basetabs.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2017-10-14 12:53:31 +0200
committermathieui <mathieui@mathieui.net>2017-10-14 12:54:49 +0200
commit3b5e3964699f6e5eee05ac3d62847d782a9fe135 (patch)
tree2e6471e995e243e22db6a9668fd1469176161699 /poezio/tabs/basetabs.py
parentcee802b6efa027702d1e9fbaa6f440b22cc2996b (diff)
downloadpoezio-3b5e3964699f6e5eee05ac3d62847d782a9fe135.tar.gz
poezio-3b5e3964699f6e5eee05ac3d62847d782a9fe135.tar.bz2
poezio-3b5e3964699f6e5eee05ac3d62847d782a9fe135.tar.xz
poezio-3b5e3964699f6e5eee05ac3d62847d782a9fe135.zip
Split command declaration from init in muctab
Make it slightly more declarative and readable (and longer), and put it at the end of the file.
Diffstat (limited to 'poezio/tabs/basetabs.py')
-rw-r--r--poezio/tabs/basetabs.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index 3a898129..90b1d54d 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -183,6 +183,21 @@ class Tab(object):
"""
return False
+ def register_commands_batch(self, commands):
+ """
+ Add several commands in a row, using a list of dictionaries
+ """
+ for command in commands:
+ name = command['name']
+ func = command['func']
+ desc = command.get('desc', '')
+ shortdesc = command.get('shortdesc', '')
+ completion = command.get('completion')
+ usage = command.get('usage', '')
+ self.register_command(name, func, desc=desc, shortdesc=shortdesc,
+ completion=completion, usage=usage)
+
+
def register_command(self, name, func, *, desc='', shortdesc='', completion=None, usage=''):
"""
Add a command