tyshell who works now
[saartuer.git] / tyshell
diff --git a/tyshell b/tyshell
index 1b90bd0ed0cb306b28988f88b5282e997ac7ad70..8d7070a06a8874bef7fe4660f86f79133cf7ea83 100755 (executable)
--- a/tyshell
+++ b/tyshell
@@ -5,6 +5,8 @@ import shlex
 import sys
 import subprocess
 import socket
+import pwd
+import grp
 
 tuerSock = "/run/tuer.sock"
 
@@ -44,12 +46,18 @@ def exitcmd(c):
        print("Bye")
        return True
 
+def whocmd(c):
+       for n in grp.getgrnam("tuer").gr_mem:
+               p = pwd.getpwnam(n)
+               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):