2017-02-27 23:59:32 +00:00
|
|
|
from yaml import load
|
|
|
|
|
2017-04-20 22:21:42 +00:00
|
|
|
summary = """
|
|
|
|
# Summary
|
2017-02-27 23:59:32 +00:00
|
|
|
|
2017-06-21 00:09:16 +00:00
|
|
|
To date, **{}** apps/tools covered, divided in **{}** categories; **8** related sites reviewed and listed.
|
2017-04-20 22:21:42 +00:00
|
|
|
|
|
|
|
# Index
|
|
|
|
|
|
|
|
{}
|
2017-07-09 22:18:09 +00:00
|
|
|
|
2017-04-20 22:21:42 +00:00
|
|
|
Some links to [related resources](#resources).
|
|
|
|
|
|
|
|
I'm always interested to new tools, so if you have any suggestion please drop me an email at `toolleeo@gmail.com`.
|
|
|
|
"""
|
|
|
|
|
2017-07-10 19:53:56 +00:00
|
|
|
resources = """
|
2017-07-10 20:10:47 +00:00
|
|
|
# <a name="resources"></a>Related resources
|
2017-07-10 19:53:56 +00:00
|
|
|
|
|
|
|
A list of some online resoures that contribute interesting links to apps and info.
|
|
|
|
|
|
|
|
{}
|
|
|
|
"""
|
|
|
|
|
2017-04-20 22:21:42 +00:00
|
|
|
def fmt_app(app):
|
|
|
|
descr = ''.join(c if c != '\n' else ' ' for c in app["description"])
|
2017-07-10 20:29:50 +00:00
|
|
|
st = "#### [{}]({})\n\n{}\n".format(app["name"], app["url"], descr)
|
|
|
|
if 'articles' in app:
|
|
|
|
st += '\nReferences\n'
|
|
|
|
for art in app['articles']:
|
|
|
|
st += "* [{}]({}) (rev. {})".format(art['title'], art['url'], art['date'])
|
|
|
|
if 'description' in art:
|
|
|
|
st += ' - ' + art['description']
|
|
|
|
st += '\n'
|
|
|
|
return(st)
|
2017-04-20 22:21:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
def print_apps(cats, apps):
|
|
|
|
for cat_item in cats:
|
|
|
|
category = cat_item["label"]
|
|
|
|
print('## <a name="{}"></a>{}\n'.format(category, cat_item["name"]))
|
|
|
|
for app in apps[category]:
|
|
|
|
print(fmt_app(app))
|
|
|
|
|
|
|
|
|
2017-07-09 22:16:42 +00:00
|
|
|
def fmt_cats(cats, apps):
|
2017-07-09 22:10:28 +00:00
|
|
|
newlist = sorted(cats, key=lambda k: k['name'])
|
2017-04-20 22:21:42 +00:00
|
|
|
st = []
|
2017-07-09 22:10:28 +00:00
|
|
|
for cat_item in newlist:
|
2017-04-20 22:21:42 +00:00
|
|
|
category = cat_item["label"]
|
2017-07-09 22:16:42 +00:00
|
|
|
st.append("[{}](#{}) ({})".format(cat_item["name"], cat_item["label"], len(apps[cat_item["label"]])))
|
2017-07-09 22:10:28 +00:00
|
|
|
return ' | '.join(st)
|
2017-02-27 23:59:32 +00:00
|
|
|
|
|
|
|
|
2017-03-27 20:10:11 +00:00
|
|
|
def count_apps(apps):
|
|
|
|
tot = 0
|
|
|
|
for cat in apps:
|
|
|
|
tot += len(apps[cat])
|
|
|
|
return tot
|
|
|
|
|
2017-04-20 22:21:42 +00:00
|
|
|
|
2017-02-27 23:59:32 +00:00
|
|
|
with open('cli-apps.yaml', 'r') as yf:
|
|
|
|
data = load(yf)
|
|
|
|
# print(data)
|
|
|
|
apps = data["apps"]
|
2017-04-20 22:21:42 +00:00
|
|
|
cats = data["categories"]
|
2017-07-10 19:53:56 +00:00
|
|
|
|
|
|
|
with open('resources.yaml', 'r') as yf:
|
|
|
|
res = load(yf)
|
|
|
|
md_res = ''
|
|
|
|
for r in res['resources']:
|
2017-07-10 20:00:50 +00:00
|
|
|
md_res += '[{}]({}) - {}\n\n'.format(r['title'], r['url'], r['description'])
|
2017-07-10 19:53:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
print(summary.format(count_apps(apps), len(cats), fmt_cats(cats, apps)))
|
|
|
|
print_apps(cats, apps)
|
|
|
|
print(resources.format(md_res))
|