-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecSS
More file actions
executable file
·71 lines (54 loc) · 1.52 KB
/
execSS
File metadata and controls
executable file
·71 lines (54 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/python
import os
import sys
import time
import getopt
import pynoccio
progname = os.path.basename(sys.argv[0])
def printUsage(msg):
if not msg == '':
print msg
print "usage: %s [options] user password command command ..." % (progname)
print "options:"
print
print " -t <troop> troup name"
print " -s <scout> scout name"
print " -v level set pynoccio debug level"
def main():
try:
options, argv = getopt.getopt(sys.argv[1:], "t:s:v:")
except getopt.GetoptError:
printUsage('Error parsing arguments')
sys.exit(1)
if len(argv) < 2:
printUsage("")
sys.exit(1)
troop_name = "Rancho de la Basura Blanca"
scout_name = "Billy"
debug_level = None
for o,a in options:
if o == "-t":
troop_name = a
elif o == "-s":
scout_name = a
elif o == "-v":
debug_level = int(a)
else:
printUsage("Unrecognised option - \"%s\"" % (o))
sys.exit(1)
if debug_level is not None:
pynoccio.set_debug(debug_level)
a = pynoccio.Account(argv[0], argv[1])
for t in a.troops:
print "troop:", t
for s in t.scouts:
print "\tscout:", s
scout = a.troop(troop_name).scout(scout_name)
print >>sys.stderr, 'talking to scout named', scout.name
for cmd in argv[2:]:
exec 'print >>sys.stderr, scout.'+cmd+".reply"
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
sys.exit(0)