From: Constantin Berhard Date: Sun, 20 Oct 2013 02:00:46 +0000 (+0200) Subject: Merge branch 'master' of ralfj.de:saartuer X-Git-Url: https://git.ralfj.de/saartuer.git/commitdiff_plain/f821d08610f37224ff13df938715da4438592907?hp=41111d6443061891dd2ec7d5bf5ab856c0546fc0 Merge branch 'master' of ralfj.de:saartuer --- diff --git a/tyshell b/tyshell index f8627d2..708ac50 100755 --- a/tyshell +++ b/tyshell @@ -51,14 +51,21 @@ def whocmd(c): p = pwd.getpwnam(n) print (p.pw_name, " - ", p.pw_gecos) -commands = { +def alias (cmds, aliases): + for newname, oldname in aliases.items(): + cmds[newname] = cmds[oldname] + return cmds + +commands = alias({ 'exit': exitcmd, 'help': helpcmd, 'open': sendcmd(tuerSock, 'unlock'), - 'unlock': sendcmd(tuerSock, 'unlock'), 'buzz': sendcmd(tuerSock, 'buzz'), 'who': whocmd, -} +},{ + # aliases + 'unlock': 'open', +}) def complete_command(cmd): '''returns a list of commands (as strings) starting with cmd'''