From 5824cc968b7e567052d76480009c5d4fe3d52942 Mon Sep 17 00:00:00 2001 From: Tullio Facchinetti Date: Mon, 10 Jul 2017 00:10:28 +0200 Subject: [PATCH] Changed index format. Now it is also sorted. --- cli2md.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cli2md.py b/cli2md.py index bf79e54..42f75d0 100644 --- a/cli2md.py +++ b/cli2md.py @@ -27,11 +27,12 @@ def print_apps(cats, apps): def fmt_cats(cats): + newlist = sorted(cats, key=lambda k: k['name']) st = [] - for cat_item in cats: + for cat_item in newlist: category = cat_item["label"] - st.append("* [{}](#{})\n".format(cat_item["name"], cat_item["label"])) - return ''.join(st) + st.append("[{}](#{})".format(cat_item["name"], cat_item["label"])) + return ' | '.join(st) def count_apps(apps):