-commands = {
- 'exit': exitcmd,
- 'help': helpcmd,
- 'open': sendcmd(tuerSock, 'unlock'),
- 'unlock': sendcmd(tuerSock, 'unlock'),
- 'buzz': sendcmd(tuerSock, 'buzz'),
- 'who': whocmd,
-}
+def alias (cmds, aliases):
+ for newname, oldname in aliases.items():
+ cmds[newname] = cmds[oldname]
+ return cmds
+
+CmdEntry = namedtuple('CmdEntry','function helpstring')
+
+commands = alias({
+ 'exit': CmdEntry(exitcmd, 'Quits this shell'),
+ 'help': CmdEntry(helpcmd, 'Helps you getting to know the available commands'),
+ 'unlock': CmdEntry(sendcmd(tuerSock, 'unlock'), 'Will try to unlock the apartment door'),
+ 'buzz': CmdEntry(sendcmd(tuerSock, 'buzz'), 'Will buzz the buzzer for the street door'),
+ 'who': CmdEntry(whocmd, 'Shows the list of people, who are allowed to control this system'),
+},{
+ # aliases
+ 'open': 'unlock',
+})