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