From: Constantin Berhard Date: Mon, 14 Oct 2013 18:40:06 +0000 (+0200) Subject: command who X-Git-Url: https://git.ralfj.de/saartuer.git/commitdiff_plain/97df5941b08cd53aa66937ded412fa58aac531aa?ds=sidebyside;hp=6f24ccffd4dc1b8401cddad047296a0c11fedb5f command who --- diff --git a/tyshell b/tyshell index 1b90bd0..c9a0927 100755 --- a/tyshell +++ b/tyshell @@ -5,6 +5,7 @@ import shlex import sys import subprocess import socket +import pwd tuerSock = "/run/tuer.sock" @@ -44,12 +45,17 @@ def exitcmd(c): print("Bye") return True +def whocmd(c): + for p in filter(lambda x:x.pw_shell=="/opt/tuer/tyshell",pwd.getpwall()): + print (p.pw_name, " - ", p.pw_gecos) + commands = { 'exit': exitcmd, 'help': helpcmd, 'open': sendcmd(tuerSock, 'unlock'), 'unlock': sendcmd(tuerSock, 'unlock'), 'buzz': sendcmd(tuerSock, 'buzz'), + 'who': whocmd, } def complete_command(cmd):