Increase default window width to accomodate Build ETA column.
[tpot/bbremote.git] / bbtest
1 #!/usr/bin/python
2
3 import sys, string
4
5 from twisted.internet import reactor
6 from twisted.python import log
7
8 import bbmodel
9
10 # Command line parsing
11
12 from optparse import OptionParser
13
14 optparser = OptionParser(
15     usage = '%prog HOSTNAME:PORT -u USER -p PASS')
16
17 optparser.add_option('-u', '--user', dest = 'user',
18                      action = 'store', type = 'string',
19                      help = 'user to connect as')
20
21 optparser.add_option('-p', '--password', dest = 'password',
22                      action = 'store', type = 'string',
23                      help = 'password to connect user as')
24
25 (opts, argv) = optparser.parse_args()
26
27 if len(argv) != 1:
28     optparser.print_usage()
29     sys.exit(1)
30
31 if opts.user is None:
32     print 'Username required'
33     optparser.print_usage()
34     sys.exit(1)
35
36 if opts.password is None:
37     print 'Password required'
38     optparser.print_usage()
39     sys.exit(1)
40
41 host, port = string.split(argv[0], ':')
42
43 # Main program
44
45 log.startLogging(sys.stdout)
46
47 bb = bbmodel.BBModel()
48 bb.connect(host, int(port), opts.user, opts.password)
49
50 reactor.run()