0
|
1 #!/usr/bin/env python
|
|
2
|
|
3 """
|
|
4 correlate names of talos
|
|
5 """
|
|
6
|
|
7 import api
|
|
8 import sys
|
|
9 import optparse
|
3
|
10 from pprint import pprint
|
0
|
11
|
3
|
12 def main(args=sys.argv[1:]):
|
0
|
13
|
|
14 # parse command line options
|
3
|
15 usage = '%prog [options] [name]'
|
0
|
16 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
|
|
17 """description formatter for console script entry point"""
|
|
18 def format_description(self, description):
|
|
19 if description:
|
|
20 return description.strip() + '\n'
|
|
21 else:
|
|
22 return ''
|
|
23 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
|
|
24 options, args = parser.parse_args(args)
|
|
25
|
3
|
26 # get the names from graphserver
|
0
|
27 names = api.TalosNames()
|
|
28
|
3
|
29 if not args:
|
|
30 args = [None]
|
|
31 for arg in args:
|
|
32 for name, graphserver_name in names(arg):
|
|
33 print '%s : %s' % (name, graphserver_name)
|
|
34 print
|
|
35
|
0
|
36 if __name__ == '__main__':
|
|
37 main()
|
|
38
|