1#!/usr/bin/env python3
2from collections import defaultdict
3from subprocess import check_output
4
5lines = check_output(["go", "run", "./cmd/chroma/main.go", "--list"]).decode('utf-8').splitlines()
6lines = [line.strip() for line in lines if line.startswith(" ") and not line.startswith(" ")]
7lines = sorted(lines, key=lambda l: l.lower())
8
9table = defaultdict(list)
10
11for line in lines:
12 table[line[0].upper()].append(line)
13
14for key, value in table.items():
15 print("{} | {}".format(key, ', '.join(value)))