]>
Commit | Line | Data |
---|---|---|
cacbf70c PD |
1 | #!/usr/bin/env python |
2 | import json, sys | |
3 | ||
4 | runs = json.load(sys.stdin) | |
5 | ||
c885fb84 | 6 | selectors = dict(s.split('=',1) for s in sys.argv[1:]) |
cacbf70c PD |
7 | |
8 | selected=list() | |
9 | ||
10 | names=set() | |
11 | ||
12 | for run in runs: | |
13 | match = True | |
c885fb84 | 14 | for k,v in selectors.iteritems(): |
cacbf70c PD |
15 | # print k, v, run[k] |
16 | if run[k] != v: | |
17 | match = False | |
18 | break | |
19 | ||
20 | if match: | |
21 | selected.append((run['tag'], run)) | |
22 | names.update(run) | |
23 | ||
24 | selected.sort() | |
25 | ||
26 | names.discard('tag') | |
27 | ||
bb027ace | 28 | fmt=''.join('%%%ds' % max(15, i+4) for i in [3]+map(len, sorted(names))) |
cacbf70c PD |
29 | print fmt % tuple(['tag']+sorted(names)) |
30 | for tag, stats in selected: | |
bb027ace | 31 | print fmt % tuple([tag] + [stats.get(s) for s in sorted(names)]) |