Add return status codes
This commit is contained in:
parent
2c1eba5698
commit
c724da9e4c
1 changed files with 9 additions and 1 deletions
10
query_finger
10
query_finger
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import pprint
|
import pprint
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
finger = "/afs/stacken.kth.se/home/stacken/Private/finger.json"
|
finger = "/afs/stacken.kth.se/home/stacken/Private/finger.json"
|
||||||
|
@ -26,6 +27,13 @@ if options.username:
|
||||||
for user in data:
|
for user in data:
|
||||||
if user.get('användarnamn', None) == options.username:
|
if user.get('användarnamn', None) == options.username:
|
||||||
if options.field:
|
if options.field:
|
||||||
print(user.get(options.field, ""))
|
if user.get(options.field, None):
|
||||||
|
print(user[options.field])
|
||||||
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
print(user)
|
print(user)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
sys.exit(1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue