0
|
1 #!/usr/bin/env python
|
|
2
|
|
3 """
|
|
4 correlate names of talos
|
|
5 """
|
|
6
|
|
7 import api
|
|
8 import sys
|
|
9 import optparse
|
7
|
10 from commandparser import CommandParser
|
3
|
11 from pprint import pprint
|
0
|
12
|
7
|
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
|
|
20
|
3
|
21 def main(args=sys.argv[1:]):
|
0
|
22
|
|
23 # parse command line options
|
3
|
24 usage = '%prog [options] [name]'
|
0
|
25 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
|
|
26 """description formatter for console script entry point"""
|
|
27 def format_description(self, description):
|
|
28 if description:
|
|
29 return description.strip() + '\n'
|
|
30 else:
|
|
31 return ''
|
|
32 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
|
|
33 options, args = parser.parse_args(args)
|
|
34
|
3
|
35 # get the names from graphserver
|
0
|
36 names = api.TalosNames()
|
|
37
|
3
|
38 if not args:
|
|
39 args = [None]
|
|
40 for arg in args:
|
|
41 for name, graphserver_name in names(arg):
|
|
42 print '%s : %s' % (name, graphserver_name)
|
|
43 print
|
|
44
|
0
|
45 if __name__ == '__main__':
|
|
46
|
7
|
47 parser = CommandParser(TalosNamesCLI)
|
|
48 parser.invoke(sys.argv[1:])
|
|
49
|