command who
authorConstantin Berhard <constantin@exxxtremesys.lu>
Mon, 14 Oct 2013 18:40:06 +0000 (20:40 +0200)
committerConstantin Berhard <constantin@exxxtremesys.lu>
Mon, 14 Oct 2013 18:40:06 +0000 (20:40 +0200)
tyshell

diff --git a/tyshell b/tyshell
index 1b90bd0ed0cb306b28988f88b5282e997ac7ad70..c9a09273c96d837f1e3a018320aa8122e961e1b8 100755 (executable)
--- 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):