Mercurial > mozilla > hg > talosnames
comparison talosnames/main.py @ 7:68d2384b0a52
switch to command parser
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 10 Jul 2012 14:24:25 -0700 |
parents | 90e477181404 |
children | 20c42ae0f7b7 |
comparison
equal
deleted
inserted
replaced
6:82aad57c7d1d | 7:68d2384b0a52 |
---|---|
5 """ | 5 """ |
6 | 6 |
7 import api | 7 import api |
8 import sys | 8 import sys |
9 import optparse | 9 import optparse |
10 from commandparser import CommandParser | |
10 from pprint import pprint | 11 from pprint import pprint |
12 | |
13 class TalosNamesCLI(CommandParser): | |
14 def __init__(self): | |
15 self.api = api.TalosNames() | |
16 | |
17 def graphserver(self, *names): | |
18 if not names: | |
19 pass | |
11 | 20 |
12 def main(args=sys.argv[1:]): | 21 def main(args=sys.argv[1:]): |
13 | 22 |
14 # parse command line options | 23 # parse command line options |
15 usage = '%prog [options] [name]' | 24 usage = '%prog [options] [name]' |
32 for name, graphserver_name in names(arg): | 41 for name, graphserver_name in names(arg): |
33 print '%s : %s' % (name, graphserver_name) | 42 print '%s : %s' % (name, graphserver_name) |
34 print | 43 print |
35 | 44 |
36 if __name__ == '__main__': | 45 if __name__ == '__main__': |
37 main() | |
38 | 46 |
47 parser = CommandParser(TalosNamesCLI) | |
48 parser.invoke(sys.argv[1:]) | |
49 |